How to add privileges to a role (act as group) without specifying particular schema. Basically I have a database with a schema (my_first_schema
). I create multiple new schemas by cloning my_first_schema
. Then create a new database user and GRANT my group privileges to this user.
How to add privileges to group role without knowing schema name (because I create schema dynamically)?
Update I tried to revoke all privileges on all schemas in database and grant select privilege to a dynamically created schema,so that the user can access the a particular schema only. But it revokes all privileges on all tables in all database and I got Permission denied error message after grant SELECT privilege to particular schema for the user.
ALTER DEFAULT PRIVILEGES REVOKE ALL ON TABLES FROM PUBLIC;
ALTER DEFAULT PRIVILEGES IN SCHEMA john_smith_gmail_com GRANT SELECT ON TABLES TO john_smith_gmail_com;