Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ERROR: must be member of role "" PostgreSQL

Tags:

postgresql


I need to change owner of table.
I created table:

CREATE TABLE example (some columns);

Then I tried to change owner:

ALTER TABLE database.expample OWNER TO "secondary";

and them I got this error:

ERROR: must be member of role "secondary"

Can anybody help me?
Thanks in advance.

like image 516
Dawenear Avatar asked Jun 21 '15 19:06

Dawenear


1 Answers

See this from the Postgresql documentation:

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.)

like image 187
CoryatJohn Avatar answered Oct 19 '22 07:10

CoryatJohn