SHOW SYSTEM GRANTS

On this page Carat arrow pointing down
Warning:
As of June 5, 2024, CockroachDB v22.2 is no longer supported. For more details, refer to the Release Support Policy.

New in v22.2: The SHOW SYSTEM GRANTS statement lists the system privileges granted to users.

Syntax

Use the following syntax to show the system privileges granted to users:

SHOW SYSTEM GRANTS [FOR <users...>]

Parameters

Parameter Description
users The user, or comma-separated list of users, whose system privileges you want to show.

Response

Privilege grants

The SHOW SYSTEM GRANTS statement returns the following fields:

Field Description
grantee The name of the user.
privilege_type The name of the system privilege granted to the user.
is_grantable t (true) if the user has the grant option on the object; f (false) if not.

Required privileges

  • No privileges are required to use SHOW SYSTEM GRANTS.

Examples

Show all system grants

To list all system grants for all users and roles:

icon/buttons/copy
> SHOW SYSTEM GRANTS;
  grantee |    privilege_type    | is_grantable
----------+----------------------+---------------
  max     | VIEWACTIVITY         |      t
  max     | VIEWCLUSTERMETADATA  |      t
  max     | VIEWDEBUG            |      t
  alice   | VIEWACTIVITYREDACTED |      f
  alice   | NOSQLLOGIN           |      f
(5 rows)

Show a specific user or role's grants

To list all system grants for a specific user or role:

icon/buttons/copy
> CREATE USER max;
icon/buttons/copy
> GRANT SYSTEM ALL TO max WITH GRANT OPTION;
icon/buttons/copy
> SHOW SYSTEM GRANTS FOR max;
  grantee | privilege_type | is_grantable
----------+----------------+---------------
  max     | ALL            |      t
(1 row)

See also


Yes No
On this page

Yes No