Skip to content

sys.user

A system view that returns information about the users in the system. See also sys.role.

Superusers can see all users in this view. Users and roles with CREATE ROLE, ALTER ANY ROLE, or DROP ANY ROLE privilege can also see all users in this view.

Users and roles that are not superusers and do not have (or inherit) CREATE ROLE, ALTER ANY ROLE, or DROP ANY ROLE privilege can only see their own accounts in this view.

Column NameData TypeDescription
user_idbigintThe unique ID for the user or role.
nametextName of the user or role.
search_pathtextValue of the search_path parameter for the user (a comma-delimited list of schemas).
create_rolebooleanWhether the user can create other users.
create_databasebooleanWhether the user can create databases.
superuserbooleanWhether the user has superuser privileges.
has_local_passwordbooleantrue means that the user has a local password set via ALTER USER (or CREATE USER). false means that the user does not have a local password and may depend on an LDAP password for login.
ldap_synchronizedbooleantrue means that this user exists in the database via LDAP synchronization.
default_clustertextDefault virtual compute cluster that was set for the role, if any.
memberofname[]Roles that the user is a member of.
connection_limitsmallintMax number of connections the user can have. This is reserved for future use.
is_inheritbooleanIs this user or role inherting permission? This is reserved for future use.
is_password_encryptedboolean
last_logintimestampzWhen the user was last logged in?
last_password_changetimestampzWhen did the user last changed their password?
creation_timetimestampzWhen the user was created.
login_attemptsintegerCurrent number of failed login attempts.

Example

yellowbrick_test=> select * from sys.user where name='bobr';
 user_id | name |   search_path    | create_role | create_database | superuser | has_local_password | ldap_synchronized | default_cluster |    memberof    | connection_limit | is_inherit | is_password_encrypted | last_login | last_password_change | creation_time | login attempts |
---------+------+------------------+-------------+-----------------+-----------+--------------------+-------------------+-----------------+----------------
   38165 | bobr | "public, premdb" | f           | f               | f         | f                  | f                 | default         | {clusteradmin} |           |              |            | 2024-07-19T13:22:23.484905Z |             | 2024-07-19T13:10:49.036817Z | 0 |
(1 row)