psql -d appdb -c "ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO app;"

Category: Databases & SQL

psql -d appdb -c "ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO app;"

Grant privileges on future tables

Sets privileges that apply automatically to tables created later, solving the classic new-tables-are-invisible problem. The default applies to objects created by the current role, so run it as the schema owner.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.