Creating a readonly user postgres 9.4

CREATE ROLE ti_readonly with login encrypted password '<some-password>';

2.  connect to the db you want to grant privileges.

3. run this command:

GRANT SELECT ON ALL TABLES IN SCHEMA public to ti_readonly;

If the previous command fails, you may be connected as the wrong user. In RDS this can be even more confusing.  In my case, I was a specific user I created for managing Odoo databases.

Notes

  • There doesn’t seem to be an easy way to connect to the instance and do GRANT SELECT ON Database Foo to Bar  – so don’t bother looking.