# create user with password
CREATE USER read_user WITH ENCRYPTED PASSWORD 'password';
# grant access to existing tables
GRANT CONNECT ON DATABASE cpu TO read_user;
GRANT USAGE ON SCHEMA public TO read_user;
GRANT SELECT ON ALL SEQUENCES IN SCHEMA public TO read_user;
GRANT SELECT ON ALL TABLES IN SCHEMA public to read_user;
# grant access to future tables
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO read_user;
Last active
June 6, 2017 13:47
-
-
Save francisco-rojas/da8234ce90b9dabd44dd60bbeaa133ac to your computer and use it in GitHub Desktop.
Postgresql read only user
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment