Fork me on GitHub

Show grants on table

SELECT grantee, string_agg(privilege_type, ', ') AS privileges FROM information_schema.role_table_grants WHERE table_name='table_name' GROUP BY grantee;

Set grants on all table on current database

GRANT SELECT ON ALL TABLES IN SCHEMA public to readonly_user;