Search code examples
ruby-on-railspostgresqlrvmpghstore

Rails 4 + PostgreSQL hstore, can't execute "CREATE EXTENSION hstore"


I have RubyOnRails 4.1.4 and PostgreSQL installed on my MacOS X by:

brew install postgresql

When I'm trying to migrate this one:

CREATE EXTENSION hstore

It gives out me an error:

PG::UndefinedFile: ERROR:  could not open extension control file "/usr/share/postgresql/9.3/extension/hstore.control": No such file or directory

I tried to find "hstore.control" in filesystem using:

find / -name "hstore.control"

And found out that this file is located in the different path:

usr/local/Cellar/postgresql/9.3.4/share/postgresql/extension/hstore.control

So how can I redefine "PG" gem's configuration to correct the path of the hstore extension? I just tried to remove the gem and install it with:

rvm all do gem install pg -- --with-pg-config=/usr/local/Cellar/postgresql/9.3.4/bin/pg_config

But it didn't work. I still have the same error.

Thank you in advance.

UPDATE:

I just created symlink to correct path, but anyway it gives me out the same error.


Solution

  • OK, I just created a symlink, reinstalled gem pg, and now all works fine.