[HACKERS] Feature proposal: list role members in psql

2012-03-28 Thread Anssi Kääriäinen
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 (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Feature proposal: list role members in psql

2012-03-28 Thread David Fetter
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 da...@fetter.org http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter  XMPP: david.fet...@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

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers