Redshift: How to list all users in a group

kee picture kee · Aug 19, 2018 · Viewed 21.3k times · Source

Getting the list of users belonging to a group in Redshift seems to be a fairly common task but I don't know how to interpret BLOB in grolist field.

I am literally getting "BLOB" in grolist field from TeamSQL. Not so sure this is specific to TeamSQL but I kind of remember thatI got a list of IDs there instead previously in other tool

Answer

Navjot Bhardwaj picture Navjot Bhardwaj · Aug 21, 2018

This worked for me:

select usename from pg_user , pg_group  where
pg_user.usesysid = ANY(pg_group.grolist) and 
pg_group.groname='<YOUR_GROUP_NAME>';