- ERROR: must be member of role "test"
Last active
January 13, 2025 11:38
-
-
Save tuannvm/25a333011bfb9080293499df627ce3da to your computer and use it in GitHub Desktop.
#postgres #cheatsheet
- Query all postgres settings:
SELECT name,setting,unit FROM pg_settings;
- Create new schema and grant privileges:
CREATE USER abc WITH PASSWORD 'ks839#@S';
CREATE SCHEMA abc;
GRANT ALL ON ALL TABLES IN SCHEMA abc TO abc;
ALTER DEFAULT PRIVILEGES IN SCHEMA abc GRANT ALL ON TABLES TO abc;
GRANT ALL PRIVILEGES ON SCHEMA abc TO abc;
- Read-only user:
GRANT SELECT ON ALL TABLES IN SCHEMA public TO abc;
GRANT USAGE ON SCHEMA public TO abc;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO abc;
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.