2015-06-21 286 views
5


我需要更改表的所有者。
我创建的表:
错误:必须是角色成员“”PostgreSQL

CREATE TABLE example (some columns); 

然后我试图改变所有者:

ALTER TABLE database.expample OWNER TO "secondary"; 

和他们,我得到这个错误:

ERROR: must be member of role "secondary" 

任何人可以帮助我吗?
在此先感谢。

+0

是你登录的'postgres'? –

回答

4

看到这个从PostgreSQL文档:

http://www.postgresql.org/docs/current/static/sql-altertable.html

You must own the table to use ALTER TABLE. To change the schema of a table, you must also have CREATE privilege on the new schema. To alter the owner, you must also be a direct or indirect member of the new owning role, and that role must have CREATE privilege on the table's schema. (These restrictions enforce that altering the owner doesn't do anything you couldn't do by dropping and recreating the table. However, a superuser can alter ownership of any table anyway.)

+2

短版:你不能“放弃”表,你必须是目标角色的成员。 –

相关问题