Skip to content

Instantly share code, notes, and snippets.

@Teebor-Choka
Last active September 30, 2022 11:43
Show Gist options
  • Save Teebor-Choka/2b698d9ce4086e7fb944c3169b548059 to your computer and use it in GitHub Desktop.
Save Teebor-Choka/2b698d9ce4086e7fb944c3169b548059 to your computer and use it in GitHub Desktop.
Create a read-only user in postgresql
CREATE ROLE test_ro_access;
GRANT CONNECT ON DATABASE test TO test_ro_access;
GRANT USAGE ON SCHEMA public TO test_ro_access;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO test_ro_access;
CREATE USER test_read_user WITH PASSWORD 'passw0rd';
GRANT test_ro_access TO test_read_user;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment