Re: Feature proposal: list role members in psql - Mailing list pgsql-hackers

From David Fetter
Subject Re: Feature proposal: list role members in psql
Date
Msg-id 20120328160857.GA5886@fetter.org
Whole thread Raw
In response to Feature proposal: list role members in psql  (Anssi Kääriäinen <anssi.kaariainen@thl.fi>)
List pgsql-hackers
On Wed, Mar 28, 2012 at 01:55:06PM +0300, Anssi Kääriäinen wrote:
> 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?

It is by at least by one person :)

>   - Should there be a new flag for this: \du[m+] where m list the
> role memebers. Or could this be added to the '+' flag?

See below.

>   - Any pointers for patches implementing a similar addition to
> psql? That would help me a lot, as I do not know the code base.

It's a pretty standard catalog lookup.  Lemme see about a patch...

>   - 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

I'd say add first-level "Role members" to \du, all the way up the DAG (or
tree, if you're structured like that) for \du+

Cheers,
David.
--
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david.fetter@gmail.com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Finer Extension dependencies
Next
From: Dimitri Fontaine
Date:
Subject: Re: Finer Extension dependencies