CertGrid CertGrid
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

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.

Every command on this page ran on db-a01.
Server NameIP AddressOSRolesCPURAMHDD
db-a01192.168.0.81Ubuntu 26.04 LTSPrimary / Source / Replica Set Member 12 Core4 GB50 GB

This guide includes

Use this when a grant stops covering new tables. This matters because a grant applies to what exists at the moment you make it and nothing created afterwards - which is the surprise that produces permission bugs weeks later.

Before you start

  1. Create a new table and watch the grant not cover it

  2. Grant for the future

  3. Fix the past with a group role

Official sources