Skip to content

Latest commit

 

History

History
16 lines (11 loc) · 478 Bytes

create-read-only-user-in-pg.md

File metadata and controls

16 lines (11 loc) · 478 Bytes
CREATE ROLE readonly_user WITH LOGIN PASSWORD 'password';

GRANT CONNECT ON DATABASE "gvault-prod-db" TO readonly_user;
GRANT USAGE ON SCHEMA public TO readonly_user;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO readonly_user;
GRANT SELECT ON ALL SEQUENCES IN SCHEMA public TO readonly_user;


ALTER DEFAULT PRIVILEGES IN SCHEMA public
GRANT SELECT ON TABLES TO readonly_user;
ALTER DEFAULT PRIVILEGES IN SCHEMA public
GRANT SELECT ON SEQUENCES TO readonly_user;