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

From wikieduonline
Jump to navigation Jump to search
Line 2: Line 2:
 
https://www.postgresql.org/docs/current/app-psql.html
 
https://www.postgresql.org/docs/current/app-psql.html
  
Lists database roles. (Since the concepts of “users” and “groups” have been unified into “[[roles]]”, this command is now equivalent to <code>[[\dg]]</code>.) 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.
+
Lists database roles. (Since the concepts of “users” and “groups” have been unified into “[[roles]]”, this command is now equivalent to <code>[[\dg]]</code>.) 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 <code>\du+</code> is used, additional information is shown about each role; currently this adds the comment for each role.
  
  

Revision as of 08:51, 10 December 2021

List users and Roles https://www.postgresql.org/docs/current/app-psql.html

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.


\du

\du+

List roles using \du command:

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


SELECT rolname FROM pg_roles;


Related terms

See also

Advertising: