Hands-on Lab·PostgreSQL
PostgreSQL Default Privileges and Role Membership
A grant covers the tables that exist when you make it, and nothing created afterwards. `ALTER DEFAULT PRIVILEGES` fixes the future; a group role fixes the past - and you usually need both.
Roles and Authentication Guide 20 of 47 Advanced
- OSUbuntu 26.04 LTS (resolute)
- PostgreSQL18.6-0ubuntu0.26.04.1
- Authscram-sha-256
- TimeAbout 16 min
- Reviewed27 August 2026
Written against the versions above. Default privileges are recorded per granting role and per schema. A table created by a **different** role is not covered, which is the commonest reason they appear not to work.
| 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
- The
analystrole with its grants from the previous guide.
-
Create a new table and watch the grant not cover it
-
Grant for the future
-
Fix the past with a group role