Commands
ALTER DEFAULT PRIVILEGES
Use ALTER DEFAULT PRIVILEGES
to set privileges on objects created in the future, such as tables, views, sources, sinks, functions, schemas, and more. This removes the need to run GRANT
or REVOKE
manually each time a new object is created.
Syntax
Where abbreviated_grant_or_revoke
is one of:
Parameters
Parameter | Description |
---|---|
target_user | Change default privileges for objects created by target_user . If omitted, the current user is used. |
schema_name | The name of an existing schema. If specified, default privileges apply only to objects created in that schema; if omitted, privileges will be granted or revoked on all schemas in the current database. Note that IN SCHEMA is not allowed when setting default privileges on schemas, as schemas cannot be nested. |
user_name | The name of the existing user to grant or revoke privileges for. |
Example
Grant privileges on schemas
Revoke privileges on views