错误:必须是语言PLPGSQL老板 [英] ERROR: must be owner of language plpgsql

查看:92
本文介绍了错误:必须是语言PLPGSQL老板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用 PostgreSQL的v9.0.1 的Rails (和它的DEPS)@ v2.3.8 ,由于使用的Postgres的全文能力,我有被定义为一个表:

I'm using PostgreSQL v9.0.1 with Rails (and it's deps) @ v2.3.8, owing to the use of the fulltext capability of postgres, I have a table which is defined as:


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.active_record.schema_format =:SQL ./到config / environment.rb ;并使用耙分贝:测试:clone_structure 而不是耙分贝:测试:克隆

Note the last line, this ensures that active record isn't able to process it with the standard schema dumper, so I have to set config.active_record.schema_format = :sql in ./config/environment.rb; and use rake db:test:clone_structure instead of rake db:test:clone.

这一切都不是太出色,只能不方便 - 但耙分贝:测试:clone_structure 失败,出现错误:

None of this is too remarkable, only inconvenient - however rake db:test:clone_structure fails with the error:

错误:必须是语言PLPGSQL的所有者

由于在我得到的#16 ./ DB / development_schema.sql

CREATE OR REPLACE PROCEDURAL LANGUAGE PLPGSQL;

的PostgreSQL 9.0 + 语言 plpsql 是由超级用户安装,初始模板,然后提供给新创建的模式。

Under PostgreSQL v9.0+ the language plpsql is installed by the superuser, to the initial template, which is then available to the newly created schema.

我不能没有解决这个运行在这个项目的测试中,甚至修改 ./ DB / development_schema.sql 手动是徒劳的,因为它是我每次执行<再生code>耙分贝:测试:clone_structure (和耙分贝:测试:克隆)

I cannot run tests on this project without resolving this, and even editing ./db/development_schema.sql manually is futile as it is regenerated every time I run rake db:test:clone_structure (and ignored by rake db:test:clone).

我希望有人能提供一些线索这光?

I hope someone can shed some light on this?

注意:我已经用两个第0.9.0 适配器的宝石,而的Postgres 宝石在版本 0.7.9.2008.01.28 - 既显示相同的行为

Note: I have used both the pg 0.9.0 adapter gem, and the postgres gem at version 0.7.9.2008.01.28 - both display identical behaviour.

我的队友跑的PostgreSQL V8.4 ,其中的语言安装一个手动步骤。

My teammates run PostgreSQL v8.4 where the language installation is a manual step.

推荐答案

解决方法如下:

在我的安装,有标准模板 template0中的template1 - 至少根据我的理解Postgres将看最高编号 templateN 创建一个新的数据库时,除非指定的模板。

On my installation, there are standard templates template0 and template1 - at least as I understand it postgres will look for the highest numbered templateN when creating a new database, unless the template is specified.

在这种情况下,为 template0中包括 PLPGSQL ,所以没有的template1 ...的想法是,你需要自定义的template1 适合您的网站的特定默认的需求,并且在你吹的一切行动的情况下,你会恢复的template1 template0中

In this instance, as template0 included plpgsql, so did template1… the idea being that you will customise template1 to suite your site specific default needs, and in the case that you blow everything up, you would restore template1 from template0.

由于我的网站的具体要求是安装 PLPGSQL 作为我的Web应用程序(一个步骤中,我们不得不继续保持8.4兼容)的自动化构建的一部分 - 该解决方案很简单:删除 PLPGSQL 的template1 和警告/错误走了

As my site specific requirement was to install plpgsql as part of the automated build of my web application (a step we had to keep to maintain 8.4 compatibility) - the solution was easy: remove plpgsql from template1 and the warning/error went away.

在这种情况下,该网站特定的默认值会改变,我们应该需要返回到默认行为,我们将简单地删除的template1 并重新创建它(这将使用 template0中

In the case that the site-specific defaults would change, and we should need to go back to the default behaviour, we would simply remove template1 and recreate it (which would use template0)

这篇关于错误:必须是语言PLPGSQL老板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆