我在远程服务器上设置了 Rails 应用程序并创建了 hstore 扩展
sudo -u postgres psql
CREATE EXTENSION hstore;
然后,我部署了应用程序的迭代,该迭代在 postgres 表之一中使用 hstore,但是当它运行迁移时,它给出了一条错误消息
PG::UndefinedObject: ERROR: type "hstore" does not exist
然后我又尝试这样做
sudo -u postgres psql
CREATE EXTENSION hstore;
但它告诉我 hstore 已经存在
ERROR: extension "hstore" already exists
这个循环还在继续。
知道什么可能导致这个问题吗?我在 Ubuntu 12.04 服务器上使用 postgres 9.1
Update请注意,想知道这个问题是否与权限有关,我尝试像这样检查我的权限,但收到以下错误
sudo -u postgres psql -U username
psql: FATAL: Peer authentication failed for user "username"
Update虽然安装了 hstore,但它不是我正在使用的数据库的扩展。如何将其安装到特定的数据库中?
psql -d db_production -c '\dx'
List of installed extensions
Name | Version | Schema | Description
---------+---------+------------+------------------------------
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
(1 row)