lists all users under groups

Started by Emi Luabout 20 years ago2 messagesgeneral
Jump to latest
#1Emi Lu
emilu@encs.concordia.ca

Greetings,

May I ask is there a simple way like \dg+ to get all users' names under
all groups please? If no, which sys tables should I use to get it?

I am expecting something like :

Group name | Users
----------------------------------
g1 | u1, u2, u3
g2 | u1
g3 | u6

Thanks a lot!
Emi

#2Emi Lu
emilu@encs.concordia.ca
In reply to: Emi Lu (#1)
Re: lists all users under groups

Hello,

By using -E to see the outputs, figure out a way by myself:

select distinct g.groname, u.usename from pg_catalog.pg_user u,
pg_catalog.pg_group g WHERE u.usesysid = ANY(g.grolist) order by
groname, usename;

Do you have a simpler way such as \d???

Thanks,
Emi

Show quoted text

Greetings,

May I ask is there a simple way like \dg+ to get all users' names
under all groups please? If no, which sys tables should I use to get it?

I am expecting something like :

Group name | Users
----------------------------------
g1 | u1, u2, u3
g2 | u1
g3 | u6

Thanks a lot!
Emi

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match