Reputation: 6270
I have a created read only user with below commands
CREATE ROLE read_only WITH LOGIN PASSWORD 'password'
NOSUPERUSER INHERIT NOCREATEDB NOCREATEROLE NOREPLICATION VALID UNTIL
'infinity';
Then I gave select permision
GRANT USAGE ON SCHEMA public TO read_only;
GRANT SELECT ON ALL SEQUENCES IN SCHEMA public TO read_only;
GRANT SELECT ON ALL TABLES IN SCHEMA public to read_only;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO
read_only;
My requirement is whenever there is a new schema added it should inherit the permissions for read_only user. Currently I manually assign these permissions for new schema.
Upvotes: 1
Views: 705
Reputation: 246033
There is no way to do that automatically, you will have to continue doing that explicitly.
Upvotes: 2