create role schema_owner;
create role table_owner; 

Current signed in role is postgres

create schema test;
grant schema_owner to postgres;
grant table_owner to postgres;
alter schema test owner to schema_owner;

This Works....

create table test.t1 (a int);
alter table test.t1 owner to table_owner;

This last statement doesn't work. Why ?

Error is : permission denied for schema test

Why the postgres user cant change the owner of table t1 in schema test to table_owner. Postgres is a already a member of table_owner and schema_owner? How can I achieve this?

  • I cannot reproduce that. But then, postgres is a superuser in my cluster. You should provide a more complete example that includes how you created postgres. Aug 30 at 8:01
  • This is a PAAS service. As a user I don't have access to the superuser. Think of postgres as the admin user of the server and also the owner of the database in which the above statements are run.
    – armchair
    Aug 30 at 9:48
  • Still that should not happen. Chances are that your service provider has hacked the PostgreSQL permission system somehow. Try to reproduce the problem with real PostgreSQL. If you can, please provide a complete script. If you cannot, the problem is between you and your hosting provider. Aug 30 at 11:26


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.