Thread: How to get all users under a group

How to get all users under a group

From
Emi Lu
Date:
Hello,

I know \du+ can get all group info for each user.

Could someone tell me how to get all users under each group please?

such as provide the group name, showing all users under the group.

Thanks,
Emi



Re: How to get all users under a group

From
Emi Lu
Date:
To answer my own question:

SELECT g.groname , u.usename AS "User name"
FROM pg_catalog.pg_user u
left join pg_catalog.pg_group g on(u.usesysid = ANY(g.grolist))
ORDER BY 1, 2;




> 
> I know \du+ can get all group info for each user.
> 
> Could someone tell me how to get all users under each group please?
> 
> such as provide the group name, showing all users under the group.
> 
> Thanks,
> Emi
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings