我使用PostgreSQL v9.0.1
和Rails
(它是deps)@v2.3.8
,由于使用了postgres的全文功能,我有一个表定义为:
CREATE TABLE affiliate_products ( id integer NOT NULL, name character varying(255), model character varying(255), description text, price numeric(9,2), created_at timestamp without time zone, updated_at timestamp without time zone, textsearch_vector tsvector, );
注意最后一行,这确保了活动记录不能用标准模式转储程序处理它,所以我必须在./config/environment.rb
中设置config.active_record.schema_format = :sql
;用rake db:test:clone_structure
代替rake db:test:clone
.
所有这些都不太引人注目,只是不方便——但是rake db:test:clone_structure
失败了,出现了错误:
ERROR: must be owner of language plpgsql
因为我的结果./db/development_schema.sql
中的第#16
行:
CREATE OR REPLACE PROCEDURAL LANGUAGE plpgsql;
在PostgreSQL v9.0+
下,超级用户将语言plpsql
安装到初始模板中,然后新创建的模式可以使用该模板.
如果不解决这个问题,我就无法在这个项目上运行测试,甚至手动编辑./db/development_schema.sql
也是徒劳的,因为每次我运行rake db:test:clone_structure
时都会重新生成它(rake db:test:clone
会忽略它).
我希望有人能解释一下?
Note:我使用了pg 0.9.0
适配器gem和0.7.9.2008.01.28
版本的postgres
gem,它们都显示出相同的行为.
我的队友们跑了PostgreSQL v8.4
米,语言安装是手动的.