PG::UndefinedObject: ERROR: type "hstore" does not exist but it does
You have installed the hstore
extension in a schema named hstore
which is presumably not on your default search_path
.
You must do one of these:
- Add
hstore
tosearch_path
during connection setup; - Add
hstore
tosearch_path
with anALTER USER ... SET
orALTER DATABASE ... SET
; - Move the hstore extension from the
hstore
schema intopublic
; or - schema-qualify all references to
hstore
, e.g.hstore.hstore(...)
. This must be done for operators too;->
becomesOPERATOR(hstore.->)
This is how I solved the problem. Create a schema called extensions and grant authorization to the db username you use in the project.
psql -U postgres -d template1 -c "CREATE SCHEMA extensions AUTHORIZATION <yourDbUserName>;"
create the extensions in the created schema (extensions)
psql -U postgres -d template1 -c "CREATE EXTENSION IF NOT EXISTS hstore SCHEMA extensions;"