PG :: UndefinedObject: ERROR: type "hstore" does not exist, but it

First of all, it may look like a duplicate:

postgres hstore exists and does not exist at the same time

but this is not so. Although in this case I get the same error message. When you check if hstore is installed in the database, we see that it is:

./psql -d photographerio_development -c '\dx'
                       List of installed extensions
  Name   | Version |   Schema   |                   Description                    
---------+---------+------------+--------------------------------------------------
 hstore  | 1.2     | hstore     | data type for storing sets of (key, value) pairs
 plpgsql | 1.0     | pg_catalog | PL/pgSQL procedural language

and it is also in the template_1 database.

So, when I try to migrate to add hstore, I get PG::Error: ERROR: extension "hstore" already exists, and when I comment on this migration, on the next one that requires hstore, she says PG::UndefinedObject: ERROR: type "hstore" does not existthat is a bit of a paradox.

This is a Rails 4.0.1 application with postgresql 9, and I have hstore working on several other projects running on this computer.

+4
2

hstore hstore, search_path.

:

  • hstore search_path ;
  • hstore search_path ALTER USER ... SET ALTER DATABASE ... SET;
  • hstore hstore public;
  • schema- hstore, . hstore.hstore(...). ; -> OPERATOR(hstore.->)
+10

. db, .

psql -U postgres -d template1 -c "CREATE SCHEMA extensions AUTHORIZATION <yourDbUserName>;"

()

psql -U postgres -d template1 -c "CREATE EXTENSION IF NOT EXISTS hstore SCHEMA extensions;"
+3

Source: https://habr.com/ru/post/1527900/


All Articles