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 to search_path during connection setup;
  • Add hstore to search_path with an ALTER USER ... SET or ALTER DATABASE ... SET;
  • Move the hstore extension from the hstore schema into public; or
  • schema-qualify all references to hstore, e.g. hstore.hstore(...). This must be done for operators too; -> becomes OPERATOR(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;"