Skip to content

Instantly share code, notes, and snippets.

@chanmix51
Created December 19, 2013 09:22
Show Gist options
  • Save chanmix51/8036615 to your computer and use it in GitHub Desktop.
Save chanmix51/8036615 to your computer and use it in GitHub Desktop.
read only user in postgresql
CREATE USER backup_user WITH ENCRYPTED PASSWORD 'password';
GRANT CONNECT ON DATABASE production to backup_user;
\c production
GRANT USAGE ON SCHEMA public to backup_user; /*thanks Dominic!*/
GRANT SELECT ON ALL SEQUENCES IN SCHEMA public TO backup_user;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO backup_user;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment