On PostgreSQL 10, I\'ve a schema called tn_schema
and a database called tn_beta_db
. I think so, although I do have to be connected to the relevant dat
A list of things you misunderstood:
ALTER DEFAULT PRIVILEGES does not change the permissions on any existing object, in your case the schema.
You need to grant the CREATE privilege on the schema:
GRANT CREATE ON SCHEMA tn_schema TO tn_beta_migrator;
The ALTER DEFAULT PRIVILEGES
statement you ran will only affect the permissions on tables created by user postgres
in schema tn_schema
, but it seems that you want tn_beta_migrator
to create tables.
You don't need ALTER DEFAULT PRIVILEGES
at all, since the user that creates the table becomes the table owner and has all privileges on the table by default.
You can view default privileges with \ddp
in psql
.
Schemas are part of a database, so you need to connect to the database to see its schemas.
If you want that the tables created by tn_beta_migrator
get certain permissions by default, you must define default privileges for that user (and not for postgres
, like you did):
ALTER DEFAULT PRIVILEGES FOR ROLE tn_beta_migrator IN SCHEMA tn_schema GRANT ...;