I have a Postgres database with a schema named foo owned by a user also named foo, which also owns all of the tables in it.

While logged in as foo, I created a user bar and granted it everything foo:

grant foo to bar;
grant all on all tables in schema foo to bar;
grant all on all sequences in schema foo to bar;

Now, logged in as bar, I attempt to alter a table in the foo schema:

alter table foo.baz add column col1 varchar(1);

And I get the error:

ERROR:  must be owner of table baz

Why won't Postgres let bar, as a member of foo, alter one of foo's tables? From everything I've read, granting the role should do the trick.

  • Having the same privileges as the table owner is not the same as being the table owner.
    – mustaccio
    Commented Aug 10, 2023 at 18:17

1 Answer 1


The problem is that bar has NOINHERIT set, which means that it doesn't automatically assume the privileges of roles granted to it.

I can fix this on a query-by-query basis by having bar first do


To fix it permanently, I can have foo (which also created bar) make bar inherit:


Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.