Peter Eisentraut wrote:
Btw., it would be really nice if some limited form of this could get done,
so I could finish the information schema views pertaining to group
privileges.  I'd just need a way to find out what users are in what
groups.  If unnest() would work for locally constant arguments, I think it
could be done like

SELECT g.groname
FROM pg_user u, pg_group g
WHERE u.usesysid IN (SELECT * FROM UNNEST((SELECT grolist FROM pg_group WHERE grosysid 
= g.grosysid)))
      AND u.usename = current_user;

Or is there some other way to do this now?


It isn't in CVS yet, but hopefully before Monday evening you'll be able to do this:


regression=# create user u1;
CREATE USER
regression=# create user u2;
CREATE USER
regression=# create user u3;
CREATE USER
regression=# create group g1 with user u1,u2;
CREATE GROUP
regression=# create group g2 with user u1,u2,u3;
CREATE GROUP
regression=# \c - u1
You are now connected as new user u1.
regression=> SELECT g.groname FROM pg_group g, pg_user u WHERE u.usename = current_user AND u.usesysid = ANY (g.grolist);
groname
---------
g1
g2
(2 rows)



Joe



---------------------------(end of broadcast)--------------------------- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])

Reply via email to