Skip to content

Commit 7e02654

Browse files
authored
chore: add doc about show grants of <role_name> (#2209)
1 parent dd8b2b4 commit 7e02654

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

docs/en/sql-reference/10-sql-commands/00-ddl/02-user/22-show-grants.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ SHOW GRANTS FOR ROLE <role_name> [ LIKE '<pattern>' | WHERE <expr> | LIMIT <limi
2525

2626
-- List privileges granted on an object
2727
SHOW GRANTS ON { STAGE | TABLE | DATABASE | UDF } <object_name> [ LIKE '<pattern>' | WHERE <expr> | LIMIT <limit> ]
28+
29+
-- Lists all users and roles that have been directly granted role_name.
30+
SHOW GRANTS OF ROLE <role_name>
31+
2832
```
2933

3034
## Examples
@@ -71,4 +75,18 @@ SHOW GRANTS ON DATABASE my_db;
7175
│ privileges │ object_name │ object_id │ grant_to │ name │ grants ├────────────┼─────────────┼──────────────────┼──────────┼─────────┼──────────────────┤
7276
│ OWNERSHIP │ my_db │ 16 │ ROLE │ analyst │ │
7377
└─────────────────────────────────────────────────────────────────────────────────────┘
78+
79+
-- Lists all users and roles that have been directly granted role_name.
80+
-- This command displays only the direct grantees of role_name.
81+
-- This means it lists users and roles that have explicitly received the role through a GRANT ROLE role_name TO <user_or_role> statement.
82+
-- It does not show users or roles that acquire role_name indirectly via role hierarchies or inheritance.
83+
SHOW GRANTS OF ROLE analyst
84+
85+
╭─────────────────────────────────────╮
86+
│ role │ granted_to │ grantee_name │
87+
│ String │ String │ String │
88+
├─────────┼────────────┼──────────────┤
89+
│ analyst │ USER │ user1 │
90+
╰─────────────────────────────────────╯
91+
7492
```

0 commit comments

Comments
 (0)