I have a role group called
normal_users, my username is
rbourgeon (I am superuser) and there is another superuser called
I previously ran the following query:
ALTER DEFAULT PRIVILEGES IN SCHEMA myschema GRANT ALL ON TABLES TO normal_users;
Now, if I am logged in as
rbourgeon and create a new table in the schema, I can see the privilege
normal_users=arwdDxt, which is the expected behaviour.
But now, the strange thing is, if I log in as
admin and create another table in the same schema, the role
normal_users will not be granted these privileges on this table.
The official PostgreSQL documentation, on this issue, reads:
ALTER DEFAULT PRIVILEGES allows you to set the privileges that will be applied to objects created in the future. (It does not affect privileges assigned to already-existing objects.) Currently, only the privileges for tables (including views), sequences, and functions can be altered.
You can change default privileges only for objects that will be created by yourself or by roles that you are a member of. The privileges can be set globally (i.e., for all objects created in the current database), or just for objects created in specified schemas. Default privileges that are specified per-schema are added to whatever the global default privileges are for the particular object type.
Is there a workaround? Because many users may create tables in this database.