Created
February 1, 2024 17:23
-
-
Save shadyrudy/26e6223ff9970e4c95b58504bd307b58 to your computer and use it in GitHub Desktop.
PostgreSQL \du+ in query form
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- The following script emulates the PostgreSQL commmand | |
-- \du+ using SQL instead of the command | |
SELECT r.rolname | |
,r.rolsuper | |
,r.rolinherit | |
,r.rolcreaterole | |
,r.rolcreatedb | |
,r.rolcanlogin | |
,r.rolreplication | |
,r.rolconnlimit | |
,r.rolvaliduntil | |
, ARRAY(SELECT b.rolname | |
FROM pg_catalog.pg_auth_members m | |
JOIN pg_catalog.pg_roles b ON (m.roleid = b.oid) WHERE m.member = r.oid) AS memberof | |
,r.rolconfig | |
FROM pg_catalog.pg_roles r | |
ORDER BY 1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment