DBA Hub

📋Steps in this guide1/1

List users present in postgres

--- List users present in postgres:

postgresql configurationintermediate
by PostgreSQL
10 views
1

List users present in postgres

NOTE - > \du command output includes both user and roles(custom created roles only).

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
--- List users present in postgres:
postgres=#
select usename,usesuper,valuntil from pg_user;
usename         | usesuper   | valuntil
---------------+----------+---------------------------
postgres       | t           |
test_dbuser1   | f            | 2020-08-08 00:00:00+05:30
postgres#
select usename,usesuper,valuntil from pg_shadow;
usename         | usesuper   | valuntil
---------------+----------+---------------------------
postgres       | t           |
test_dbuser1   | f            | 2020-08-08 00:00:00+05:30
postgres#select usename,usesuper,valuntil from pg_shadow;
postgres=#
\du
List of roles
Role name      | Attributes                                                 | Member of
---------------+------------------------------------------------------------+-----------
postgres       | Superuser, Create role, Create DB, Replication, Bypass RLS | {}
test_dbuser1   | Password valid until 2020-08-08 00:00:00+05:30             | {}
postgres users are bydefault role, but roles are not bydefault user.

Comments (0)

Please to add comments

No comments yet. Be the first to comment!