The SHOW USERS statement lists the users for all databases.

Note:

Since the keywords ROLES and USERS can now be used interchangeably in SQL statements for enhanced Postgres compatibility, SHOW USERS is now an alias for SHOW ROLES.

Synopsis

SHOW USERS

Required privileges

The user must have the SELECT privilege on the system.users and system.role_members tables.

Example

copy
icon/buttons/copy
> SHOW USERS;
  username |  options   | member_of
-----------+------------+------------
  admin    | CREATEROLE | {}
  carl     | NOLOGIN    | {}
  petee    |            | {}
  root     | CREATEROLE | {admin}
(4 rows)

Alternatively, within the built-in SQL shell, you can use the \du shell command:

copy
icon/buttons/copy
> \du
  username |  options   | member_of
-----------+------------+------------
  admin    | CREATEROLE | {}
  carl     | NOLOGIN    | {}
  petee    |            | {}
  root     | CREATEROLE | {admin}
(4 rows)

See also



YesYes NoNo