patternsqlMinor
PostgreSQL: set default privileges on schemas themselves?
Viewed 0 times
postgresqlprivilegesschemasdefaultsetthemselves
Problem
According to the PostgreSQL documentation on
Is there any way to set default privileges on schemas themselves, so that the privileges specified in the
ALTER DEFAULT PRIVILEGES, default privileges can be set on tables, sequences, functions, types.Is there any way to set default privileges on schemas themselves, so that the privileges specified in the
GRANT clause are by default applied to any new schema in the database upon its creation?Solution
As mentioned by @a_horse_with_no_name, this is now implemented in PostgreSQL v10
ALTER DEFAULT PRIVILEGES allows you to set the privileges that will be applied to objects created in the future. (It does not affect privileges assigned to already-existing objects.) Currently, only the privileges for schemas, tables (including views and foreign tables), sequences, functions, and types (including domains) can be altered.
Example,
ALTER DEFAULT PRIVILEGES allows you to set the privileges that will be applied to objects created in the future. (It does not affect privileges assigned to already-existing objects.) Currently, only the privileges for schemas, tables (including views and foreign tables), sequences, functions, and types (including domains) can be altered.
Example,
ALTER DEFAULT PRIVILEGES
GRANT USAGE ON SCHEMAS
TO role;Code Snippets
ALTER DEFAULT PRIVILEGES
GRANT USAGE ON SCHEMAS
TO role;Context
StackExchange Database Administrators Q#175197, answer score: 3
Revisions (0)
No revisions yet.