如何查看postgresql数据库用户?

postgres=# \du

                             List of roles

 Role name |                   Attributes                   | Member of 

———–+————————————————+———–

 mqis      | Password valid until infinity                  | {}

 mqis_app  | Password valid until infinity                  | {}

 postgres  | Superuser, Create role, Create DB, Replication | {}

postgres=# SELECT u.usename AS “User name”,

  u.usesysid AS “User ID”,

  CASE WHEN u.usesuper AND u.usecreatedb THEN CAST(‘superuser, create

database’ AS pg_catalog.text)

       WHEN u.usesuper THEN CAST(‘superuser’ AS pg_catalog.text)

       WHEN u.usecreatedb THEN CAST(‘create database’ AS

pg_catalog.text)

       ELSE CAST(” AS pg_catalog.text)

  END AS “Attributes”

FROM pg_catalog.pg_user u

ORDER BY 1;

————————————————-

 User name | User ID |    Attributes     

———–+———+——————-

 mqis      |   16393 | 

 mqis_app  |   16397 | 

 postgres  |      10 | superuser, create+

           |         | database

(3 rows)

postgres=# 

    原文作者:塨先生
    原文地址: https://blog.csdn.net/qq_36221405/article/details/54580253
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞