Skip to content

Instantly share code, notes, and snippets.

@2color
Created February 2, 2021 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 2color/bf649744b5923eebaf687f3eb1ac586c to your computer and use it in GitHub Desktop.
Save 2color/bf649744b5923eebaf687f3eb1ac586c to your computer and use it in GitHub Desktop.
PostgreSQL grant user permissions to a database
REVOKE ALL ON DATABASE example_database FROM example_user;
GRANT CONNECT ON DATABASE example_database TO example_user;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO example_user;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO example_user;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment