This is a simplified version of Craig Ringer's answerCraig Ringer's answer that a non superuser can use directly:
SELECT oid, rolname FROM pg_roles WHERE
pg_has_role( 'maxwell', oid, 'member');
pg_roles
is essentially a view on pg_authid
accessible to public, as it doesn't reveal passwords, contrary to pg_authid
. The base oid
is even exported into the view. When not needing passwords, there's no point in creating the dedicated superuser-owned function.