As discussed in the question at GRANT SELECT to all tables in postgresql, as of PG 9.0 you can mass-grant privileges on all existing tables to user u, using a command like:
GRANT ALL ON ALL TABLES IN SCHEMA public TO u;
Logged in as u, you can now do this to pre-existing table a:
SELECT * FROM a;
But if you now create table b and do:
SELECT * FROM b;
You get:
ERROR: permission denied for relation b
SQL state: 42501
This can be remedied by re-executing
GRANT ALL ON ALL TABLES IN SCHEMA public TO u;
But it's a problem to have to remember to do this after each time you create a table.
Is there a way to get PostgreSQL to apply these global grants automatically to newly created tables?
~ Thanks in advance ~ Ken