Created
May 28, 2022 08:36
-
-
Save gc/3d749160c77cf81dc8114bac0aecb234 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Read only postgres user | |
```sql | |
CREATE ROLE read_only; | |
GRANT USAGE ON SCHEMA public TO read_only; | |
GRANT SELECT ON ALL TABLES IN SCHEMA public TO read_only; | |
GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA public TO read_only; | |
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO read_only; | |
CREATE USER reader WITH PASSWORD 'hunter2'; | |
GRANT read_only TO reader; | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment