To list users of PostgreSQL, open psql shell and run the list users command \du
.
The command returns a table of rows with columns Role name, List of roles Attributes and Member of.
Role name
Role name is the user name with which the user logs in to the database.
List of roles Attributes
These are the roles corresponding to each user.
In the above screenshot, postgres
user has attributes: Superuser, Create role, Create DB, Replication, Bypass RLS. This means that postgres
is the super user and the user can create roles, create databases, can setup replication and bypass RLS.
Member of
You can create groups where each group can contain multiple users. Each group can be assigned roles and here they become useful for the super user to control the attributes of users present in a group.