Skip to content

Instantly share code, notes, and snippets.

@fabriciocolombo
Created April 24, 2012 20:57
Show Gist options
  • Save fabriciocolombo/2483652 to your computer and use it in GitHub Desktop.
Save fabriciocolombo/2483652 to your computer and use it in GitHub Desktop.
PostgreSQL read-only user
GRANT CONNECT ON DATABASE $dbName TO $user;
GRANT USAGE ON SCHEMA $schema TO $user;
GRANT SELECT ON ALL TABLES IN SCHEMA $schema TO $user;
Default privileges
ALTER DEFAULT PRIVILEGES IN SCHEMA $schema
GRANT SELECT ON TABLES TO $user;
see more at http://www.postgresql.org/docs/9.0/static/sql-alterdefaultprivileges.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment