Skip to content

Instantly share code, notes, and snippets.

@AnatomicJC
Created March 3, 2020 14:02
Show Gist options
  • Save AnatomicJC/c41d878bba333656002ba58674dd5531 to your computer and use it in GitHub Desktop.
Save AnatomicJC/c41d878bba333656002ba58674dd5531 to your computer and use it in GitHub Desktop.
PostgreSQL read-only user
CREATE ROLE "ro-user" WITH PASSWORD 'secret';
ALTER ROLE "ro-user" WITH LOGIN;
GRANT USAGE ON SCHEMA public TO "ro-user";
GRANT SELECT ON ALL TABLES IN SCHEMA public TO "ro-user";
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO "ro-user";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment