ruby-on-rails – postgres hstore存在并且不存在同时
发布时间:2020-12-16 22:00:20 所属栏目:百科 来源:网络整理
导读:参见英文答案 How to create a new database with the hstore extension already installed?1 我在远程服务器上设置了一个Rails应用程序,并创建了一个hstore扩展 sudo -u postgres psql CREATE EXTENSION hstore; 然后,我在其中一个postgres表中部署了使用hs
参见英文答案 >
How to create a new database with the hstore extension already installed?1
我在远程服务器上设置了一个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; 但它告诉我,商店已经存在 ERROR: extension "hstore" already exists 这个圈子继续下去了. 任何想法可能导致这个问题?我在Ubuntu 12.04服务器上使用postgres 9.1 更新 sudo -u postgres psql -U username psql: FATAL: Peer authentication failed for user "username" 更新 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) 解决方法
要在数据库中创建扩展名,必须显式连接到该数据库.所以,如果你的数据库是my_app_development,你必须做:
sudo -u postgres psql my_app_development create extension hstore; 另外,你不知道你在哪个rails版本.如果你不在rails-4上,你将不得不使用postgres hstore gem. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |