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.

A user can modify only the default permissions of objects created by the user or the role to which the user belongs. These permissions can be set globally (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

To drop a role for which the default permissions have been assigned, to reverse the changes in its default permissions or use DROP OWNED BY to get rid of the default privileges entry for the role.

Examples

Run the following statements to create two users:

1
CREATE USER jack PASSWORD '{Password}';

Creating mode:

1
CREATE SCHEMA tpcds;

Helpful Links

GRANT, REVOKE