This article is half-done without your Comment! *** Please share your thoughts via Comment ***
In this post, I am sharing a script to find which group roles granted to the user in PostgreSQL.
As a DBA, when you are managing some database users and connections, it is very important to find a list of assigned roles for the different user.
Using this single script, you can easily find a list of users and its assigned roles:
pg_get_userbyid(roleid) AS GroupRoleName
,pg_get_userbyid(member) AS GrantedUserName
,pg_get_userbyid(grantor) AS GrantorUserName
,admin_option AS HasAdminOption
WHERE pg_get_userbyid(roleid) = 'User_Name';