doc-exports/docs/dli/sqlreference/dli_08_0145.html
Su, Xiaomeng 04d4597cf3 dli_sqlreference_0511_version
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com>
Co-authored-by: Su, Xiaomeng <suxiaomeng1@huawei.com>
Co-committed-by: Su, Xiaomeng <suxiaomeng1@huawei.com>
2023-11-02 14:34:08 +00:00

5.7 KiB

Displaying the Granted Permissions

Function

This statement is used to show the permissions granted to a user or role in the resource.

Syntax

1
SHOW GRANT ((ROLE [db_name].role_name) | (USER user_name)) ON resource;

Keyword

ROLE: The subsequent role_name must be a role.

USER: The subsequent user_name must be a user.

Precautions

The resource can be a queue, database, table, view, or column. The formats are as follows:

  • Queue format: queues.queue_name
  • Database format: databases.db_name
  • Table format: databases.db_name.tables.table_name
  • Column format: databases.db_name.tables.table_name.columns.column_name
  • View format: databases.db_name.tables.view_name

Example

Run the following statement to show permissions of user_name1 in the db1 database:

1
SHOW GRANT USER user_name1 ON databases.db1;

Run the following statement to show permissions of role_name on table tb1 in the db1 database:

1
SHOW GRANT ROLE role_name ON databases.db1.tables.tb1;