Skip to main content
The SHOW USERS statement lists the users for all databases.
Since the keywords ROLES and USERS can now be used interchangeably in SQL statements for enhanced PostgreSQL compatibility, SHOW USERS is now an alias for SHOW ROLES.

Synopsis

show_users syntax diagram

Parameters

Required privileges

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

Examples

Show all users

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

Filter users by provisioning source

To find all users provisioned by a specific source, such as an LDAP server:
The SOURCE filter matches against the PROVISIONSRC role option, which is set automatically for users provisioned through LDAP, OIDC, or JWT authentication.

Filter users by last login time

To find users who have not logged in since a specific date:
Users who have never logged in (NULL estimated_last_login_time) are excluded from LAST LOGIN BEFORE results.

Combine filters with a limit

You can combine multiple WITH options (comma-separated) and add a LIMIT clause:

Limit results

The LIMIT clause can also be used without WITH options:

See also