Skip to content

Instantly share code, notes, and snippets.

@garystafford
Last active April 18, 2022 15:42
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 garystafford/83334a267e64b9d44902d332aa8dad53 to your computer and use it in GitHub Desktop.
Save garystafford/83334a267e64b9d44902d332aa8dad53 to your computer and use it in GitHub Desktop.
CREATE USER read_only_user WITH ENCRYPTED PASSWORD 'change_me!';
GRANT CONNECT ON DATABASE pagila TO read_only_user;
GRANT USAGE ON SCHEMA films TO read_only_user;
GRANT SELECT ON ALL TABLES IN SCHEMA films TO read_only_user;
ALTER DEFAULT PRIVILEGES IN SCHEMA films
GRANT SELECT ON TABLES TO read_only_user;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment