Function role_inheritance
Returns a table contianing the inheritance path of a given rolename.
Columns
| Column Name | Datatype | Description |
|---|---|---|
| oid | oid | The oid of the role. |
| rolename | text | The name of the role. |
| steps | integer | The order im which the inheritance is going. |
| rolo_path | text | The path of the inheritance. |
| inherit_option | boolean | True if the member automatically inherits the privileges of the granted role. Only availabe in PostgreSQL version >= 16 |
| set_option | boolean | True if the member can SET ROLE to the granted role. Only availabe in PostgreSQL version >= 16 |
Examples
-- Used as function call
SELECT role_inheritance('stefanie');
Result:
| role_inheritance |
|---|
| (17489,stefanie,0,stefanie,t) |
| (3377,pg_stat_scan_tables,1,stefanie->pg_stat_scan_tables,t) |
-- Used as table
SELECT *
FROM role_inheritance('stefanie')
;
Result:
| oid | rolename | steps | role_path | inherit_option | set_option |
|---|---|---|---|---|---|
| 17489 | stefanie | 0 | stefanie | true | |
| 3377 | pg_stat_scan_tables | 1 | stefanie->pg_stat_scan_tables | true | true |