You can grant to all tables in a schema at once:
GRANT SELECT, UPDATE ON ALL TABLES IN SCHEMA public TO restricted_user;
If there are serial
columns or other SEQUENCES in use, you need also:
GRANT USAGE ON ALL SEQUENCES IN SCHEMA public TO restricted_user;
Run for every relevant schema. More in the fine manual for GRANT
.
You also need is the USAGE
privilege on each schema:
GRANT USAGE ON SCHEMA public TO restricted_user;
If you have another user creating more objects, you probably want to grant the same privileges for future objects by default, too. That's where DEFAULT PRIVILEGES
come in:
ALTER DEFAULT PRIVILEGES FOR creating_user IN SCHEMA public
GRANT SELECT, UPDATE ON TABLES TO restricted_user;
ALTER DEFAULT PRIVILEGES FOR creating_user IN SCHEMA public
GRANT USAGE ON SEQUENCES TO restricted_user;