Hands-on Lab·PostgreSQL
PostgreSQL Roles and Attributes
PostgreSQL has one object where other databases have two: a role is a user when it can log in and a group when it cannot. The `LOGIN` attribute is the only difference.
Roles and Authentication Guide 16 of 47 Beginner
- OSUbuntu 26.04 LTS (resolute)
- PostgreSQL18.6-0ubuntu0.26.04.1
- Authscram-sha-256
- TimeAbout 13 min
- Reviewed27 August 2026
Written against the versions above. `CREATE USER` still exists and is exactly `CREATE ROLE ... LOGIN`. The two-word distinction in older documentation describes syntax, not two kinds of object.
| Server Name | IP Address | OS | Roles | CPU | RAM | HDD |
|---|---|---|---|---|---|---|
| db-a01 | 192.168.0.81 | Ubuntu 26.04 LTS | Primary / Source / Replica Set Member 1 | 2 Core | 4 GB | 50 GB |
Before you start
- A superuser connection -
sudo -u postgres psql.
-
List the roles and read their attributes
-
Read the same thing from the catalogue
-
Try to log in as a role that cannot