Last active
January 18, 2016 20:58
-
-
Save pedroagabreu/85e11f83572ccab9dea1 to your computer and use it in GitHub Desktop.
Create read-only user/role in Postgres.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create user | |
create role myuser login password 'somepassword'; | |
grant connect on database events to myuser; | |
grant usage on schema public to myuser; | |
# privs on current stuff | |
grant select on all tables in schema public to myuser; | |
grant select on all sequences in schema public to myuser; | |
grant execute on all functions in schema public to myuser; | |
# privs on future stuff | |
alter default privileges in schema public grant select on tables to myuser; | |
alter default privileges in schema public grant select on sequences to myuser; | |
alter default privileges in schema public grant execute on functions to myuser; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment