Re: Feature proposal: list role members in psql

From: David Fetter <david(at)fetter(dot)org>
To: Anssi Kääriäinen <anssi(dot)kaariainen(at)thl(dot)fi>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Feature proposal: list role members in psql
Date: 2012-03-28 16:08:57
Message-ID: 20120328160857.GA5886@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2012-03-28 16:09:28 Re: pgsql: pg_test_timing utility, to measure clock monotonicity and timing
Previous Message Alvaro Herrera 2012-03-28 16:02:06 Re: pgsql: pg_test_timing utility, to measure clock monotonicity and timing