Skip to content

Instantly share code, notes, and snippets.

@coder4web
Last active July 17, 2018 13:24
Show Gist options
  • Save coder4web/c5c041685e32c322eb007197b28f5ae6 to your computer and use it in GitHub Desktop.
Save coder4web/c5c041685e32c322eb007197b28f5ae6 to your computer and use it in GitHub Desktop.
PostgreSQL roles
-- Full access
GRANT ALL ON schema public TO admin_user;
GRANT ALL ON ALL TABLES IN SCHEMA public TO admin_user;
GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA public TO admin_user;
-- Read-only access
GRANT USAGE ON SCHEMA public TO read_user;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO read_user;
GRANT SELECT ON ALL SEQUENCES IN SCHEMA public TO read_user;
GRANT EXECUTE ON ALL FUNCTIONS IN SCHEMA public TO read_user;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment