Get granted roles with psql
With psql
, there is an easy way to check which roles are granted to a role: \du
henk=> CREATE ROLE accounting;
CREATE ROLE
henk=> CREATE ROLE alex;
CREATE ROLE
henk=> GRANT accounting TO alex;
GRANT ROLE
henk=> \du accounting
List of roles
Role name | Attributes | Member of
------------+--------------+-----------
accounting | Cannot login | {}
henk=> \du alex
List of roles
Role name | Attributes | Member of
-----------+--------------+--------------
alex | | {accounting}