如何查看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=#
阅读(10272) | 评论(0) | 转发(0) |