Last Updated: February 25, 2016
·
221
· an0nym0use

Readonly user in PostgreSQL

All tables are available from pg_stat_user_tables.

Grant connection with grant connect on database database_name to readonly

Table-by-table privileges with psql database_name -tc "select 'grant select on '||relname||' to readonly_user;' from pg_stat_user_tables" | psql database_name