It seems there is no way to get role members using psql. \du and \dg give you "this role is a member of" information, but no information about who have been granted the role.

I would like to write a patch implementing this feature. Some questions:
  - Is this wanted?
- Should there be a new flag for this: \du[m+] where m list the role memebers. Or could this be added to the '+' flag? - Any pointers for patches implementing a similar addition to psql? That would help me a lot, as I do not know the code base. - Should the roles be fetched recursively, or should it be just the direct role members? My opinion is that direct role members is what is wanted.

The output would be something like:

 Role name |  Attributes  |       Member of        | Role members
 hot2_dba  | Cannot login | {hot2_user,common_dba} | {akaariai}

 - Anssi Kääriäinen

Sent via pgsql-hackers mailing list (
To make changes to your subscription:

Reply via email to