📜  postgres 列出用户 - SQL 代码示例

📅  最后修改于: 2022-03-11 15:04:56.929000             🧑  作者: Mango

代码示例4
SELECT usename AS role_name,
       CASE
           WHEN usesuper AND usecreatedb THEN
               cast('superuser, create database' AS pg_catalog.text)
           WHEN usesuper THEN
               cast('superuser' AS pg_catalog.text)
           WHEN usecreatedb THEN
               cast('create database' AS pg_catalog.text)
           ELSE
               cast('' AS pg_catalog.text)
       END     AS role_attributes
FROM pg_catalog.pg_user
ORDER BY role_name DESC;