Postgresql: >= 9.0 Create Read-only role

1
2
3
CREATE ROLE ro;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO ro;
CREATE ROLE "<PUT_READONLY_USERNAME_HERE>" WITH LOGIN ENCRYPTED PASSWORD '<USE_A_NICE_STRONG_PASSWORD_PLEASE>' IN ROLE ro;