You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `enable_expand_roles` setting controls whether the SHOW_GRANTS function expands role inheritance when displaying privileges.
26
+
27
+
-`enable_expand_roles=1` (default):
28
+
29
+
- SHOW_GRANTS recursively expands inherited privileges, meaning that if a role has been granted another role, it will display all the inherited privileges.
30
+
- Users will also see all privileges granted through their assigned roles.
31
+
32
+
-`enable_expand_roles=0`:
33
+
34
+
- SHOW_GRANTS only displays privileges that are directly assigned to the specified role or user.
35
+
- However, the result will still include GRANT ROLE statements to indicate role inheritance.
36
+
37
+
For example, role `a` has the `SELECT` privilege on `t1`, and role `b` has the `SELECT` privilege on `t2`:
38
+
39
+
```sql
40
+
SELECT grants FROM show_grants('role', 'a') ORDER BY object_id;
If you set `enable_expand_roles` to `0` and check the grants on role `a` again, the result will show the `GRANT ROLE` statement instead of listing the specific privileges inherited from role `b`:
75
+
76
+
```sql
77
+
SET enable_expand_roles=0;
78
+
```
79
+
80
+
```sql
81
+
SELECT grants FROM show_grants('role', 'a') ORDER BY object_id;
0 commit comments