postgres predefined role - ghdrako/doc_snipets GitHub Wiki
pg_read_all_data (Postgres14)
- https://www.crunchydata.com/blog/creating-a-read-only-postgres-user ALTER DEFAULT PRIVILEGES only work for the user that is creating the objects.
With ALTER DEFAULT PRIVILEGES, the role that creates the objects will assign the privileges for those objects. This means that if a different user were to create a new table, "scraper" would not be able to access it. To work around this, you must get ALTER DEFAULT PRIVILEGES for all other users creates objests.
Postgres 14 makes this much easier: 'pg_read_all_data' lets you assign the read only privileges to a user; the user is able to have read only privileges on any objects created by any user in the database.
GRANT pg_read_all_data TO scraper;