04/12/2022 12:30 | Category: redshift

Tags: dbadatabasesredshiftawsuserspostgres

inspect users in a user group in redshift or postgres

To inspect information about our database/the engine itself we often will query Postgres (RedShift) specific internal tables.

Inspecting our users that belong to a specific group:

SELECT
    usename,
    pg_group.groname
FROM
    pg_user,
    pg_group
WHERE
    pg_user.usesysid = ANY(pg_group.grolist)
    AND
    pg_group.groname='your-group-name';