Skip to content

Instantly share code, notes, and snippets.

### Keybase proof
I hereby claim:
* I am iruga on github.
* I am iruga (https://keybase.io/iruga) on keybase.
* I have a public key whose fingerprint is CA68 1F9F 8BA7 2C03 764E 0061 D4D6 B46B 80B8 3713
To claim this, I am signing this object:
@iruga
iruga / read-access.sql
Created September 21, 2021 12:08 — forked from oinopion/read-access.sql
How to create read only user in PostgreSQL
-- Create a group
CREATE ROLE readaccess;
-- Grant access to existing tables
GRANT USAGE ON SCHEMA public TO readaccess;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO readaccess;
-- Grant access to future tables
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO readaccess;