Skip to main content
The SHOW GRANTS lists one of the following:
  • The granted to in a cluster.
  • The to on , , , , , or .

Syntax

Show privilege grants

Use the following syntax to show the privileges granted to users on database objects:
The object-focused form (ON...) shows only privileges granted directly on the object. It does not resolve privileges inherited through role membership. The principal-focused form (FOR...) includes privileges inherited through role membership for the specified users and can be combined with ON... to filter by object. For an example of inherited grants, refer to Show direct and inherited grants. For inherited privileges, the grantee column reports the role that carries the privilege. To inspect role memberships, use SHOW GRANTS ON ROLE or . When DATABASE is omitted, the schema, tables, and types in the are listed.

Show role grants

Use the following syntax to the show the role grants for users in a cluster.

Parameters

ParameterDescription
targetsA comma-separated list of database, function, schema, table, or user-defined type names. If the function name is not unique, you must provide the full function signature. To list the privilege grants for all tables in the current database, you can use SHOW GRANTS ON TABLE \*.
usersA comma-separated list of the whose privileges or roles you want to show.
rolesA comma-separated list of the roles whose grants you want to show.

Response

Privilege grants

Results for SHOW GRANTS ON... without FOR list only direct grants on the object. Results for SHOW GRANTS... FOR <users> include privileges inherited through role membership for the specified users, and the grantee column can report roles that grant those privileges. The SHOW GRANTS ON [DATABASE | FUNCTION | SCHEMA | TABLE | TYPE | EXTERNAL CONNECTION] statement can return the following fields, depending on the target object specified:
FieldDescription
database\_nameThe name of the database.
function\_nameThe name of the user-defined function.
schema\_nameThe name of the schema.
table\_nameThe name of the table.
type\_nameThe name of the user-defined type.
connection\_nameThe name of the external connection.
granteeThe name of the user or role that the row reports privileges for. When you omit FOR, this is the direct grantee on the object and has the listed . When you use FOR, this can be a role that grants inherited privileges to the specified users.
privilege\_typeThe name of the privilege.
is\_grantableTRUE if the grantee has the grant option on the object; FALSE if not.

Role grants

The SHOW GRANTS ON ROLE statement returns the following fields:
FieldDescription
role\_nameThe name of the role.
memberThe users in the role.
is\_adminIf true, the role is an role.

Required privileges

  • No are required to view privileges granted to users.
  • For SHOW GRANTS ON ROLES, the user must have the on the system table.

Examples

Show all grants

To list all grants for all users and roles on the current database and its tables:

Show a specific user or role’s grants

Show grants on databases

Specific database, all users and roles:
Specific database, specific user or role:

Show grants on tables

Specific table, all users and roles:
Specific table, specific role or user:
All tables, all users and roles:
All tables, specific users or roles:

Show direct and inherited grants

In this example, a role has ALL on a table and a user inherits that role. The object-focused form (SHOW GRANTS ON...) lists only the direct role grant, while the principal-focused form (SHOW GRANTS... FOR <user>) lists the inherited privileges for the user.

Show grants on schemas

Specific schema, all users or roles:
Specific schema, specific users or roles:

Show grants on user-defined types

To show privileges on , use the following statements.
Specific type, all users or roles:
Specific type, specific users or roles:

Show grants on user-defined functions

To show the grants defined on the num_users function created in , run:

Show all grants on external connections

To show all grants defined on an , run:

Show grants on external connections by user

To show the grants defined on an for a specific user, run:

Show role memberships

All members of all roles:
Members of a specific role:
Roles of a specific user or role:

See also