Thread: lists all users under groups

lists all users under groups

From
Emi Lu
Date:
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


Re: lists all users under groups

From
Emi Lu
Date:
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


> 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