Difference between revisions of "List users and roles: \du"

From wikieduonline
Jump to navigation Jump to search
m (Welcome moved page \du to List users and roles: \du)
Line 39: Line 39:
 
* <code>[[show users]]</code>
 
* <code>[[show users]]</code>
 
* <code>[[rds_superuser]], [[rds_master]], [[rdsadmin]]</code>
 
* <code>[[rds_superuser]], [[rds_master]], [[rdsadmin]]</code>
* <code>[[\dt]]</code>
+
* <code>[[\dt]]</code> [[list tables]]
 
* <code>[[\ddp]]</code> lists default access privilege settings
 
* <code>[[\ddp]]</code> lists default access privilege settings
 
* <code>[[\dn]]</code>
 
* <code>[[\dn]]</code>

Revision as of 18:24, 31 August 2022

List users and Roles (Since the concepts of “users” and “groups” have been unified into “roles”, this command is now equivalent to \dg.) )

Lists database roles. (Since the concepts of “users” and “groups” have been unified into “roles”, this command is now equivalent to \dg.) By default, only user-created roles are shown; supply the S modifier to include system roles. If pattern is specified, only those roles whose names match the pattern are listed. If the form \du+ is used, additional information is shown about each role; currently this adds the comment for each role.


List roles using \du command:

Default PostgreSQL 12 in Ubuntu 20.04

postgres=# \du
                                   List of roles
 Role name |                         Attributes                         | Member of
-----------+------------------------------------------------------------+-----------
 postgres  | Superuser, Create role, Create DB, Replication, Bypass RLS | {}


postgres=# \du
                                      List of roles
   Role name    |                         Attributes                         | Member of
----------------+------------------------------------------------------------+-----------
 YOUR_USER      | Create DB                                                  | {}
 YOUR_USER2     | Cannot login                                               | {}
 YOUR_USER3     |                                                             | {}
 postgres       | Superuser, Create role, Create DB, Replication, Bypass RLS | {}


Related terms

See also

Advertising: