HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

What will GRANT <privilege> ON ALL TABLES IN SCHEMA <scheme> TO <role> do?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
tablesschemeprivilegewhatallgrantrolewillschema

Problem

It seems obvious that PostgreSQL will GRANT some privileges ON ALL TABLES IN some schema TO some role when I'll command.

But, will it make it permanent for the schema that on all tables within it, they will be granted the indicated privileges to the indicated roles, so new tables will be affected in the future?.

Or it works as a batch command so after a new table is created in the schema I have to GRANT the indicated privileges to the indicated roles again?.

Solution

so new tables will be affected in the future?

No, to affect new tables set DEFAULT PRIVILEGES:

PostgreSQL CREATE TABLE creates with incorrect owner

Note that default privileges are set per role.

Context

StackExchange Database Administrators Q#69489, answer score: 3

Revisions (0)

No revisions yet.