ALTER DEFAULT PRIVILEGES

Function

ALTER DEFAULT PRIVILEGES allows you to set the permissions that will be used for objects to be created. It does not affect permissions assigned to existing objects.

To isolate permissions, the WITH GRANT OPTION syntax is disabled in the current GaussDB(DWS) version.

A user can modify only the default permissions of the objects created by the user or the role to which the user belongs. These permissions can be set globally (that is, all objects created in the database) or for objects in a specified schema.

To view information about the default permissions of database users, query the system catalog .

Precautions

Only the permissions for tables (including views), sequences, functions, and types (including domains) can be altered.

Syntax

1
2
3
4
ALTER DEFAULT PRIVILEGES
    [ FOR { ROLE | USER } target_role [, ...] ]
    [ IN SCHEMA schema_name [, ...] ]
    abbreviated_grant_or_revoke;

Parameter Description

If you want to delete a role that has been assigned default permissions, you must revoke the changes to the default permissions or use DROP OWNED BY to get rid of the default permission entry for the role.

Examples

Helpful Links

GRANT, REVOKE