Syntax
ALTER DEFAULT PRIVILEGES features:
- Object types: TABLES, SEQUENCES, FUNCTIONS, ROUTINES, TYPES
- Table privileges: SELECT, INSERT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER
- Sequence privileges: USAGE, SELECT, UPDATE
- Function/Routine privileges: EXECUTE
- Type privileges: USAGE
- Schema scope: Privileges apply to objects created in the specified schema
- WITH GRANT OPTION: Allow grantee to grant the same privileges to others
- PUBLIC: Special grantee representing all roles
Examples
Grant default table privileges
Grant default function privileges
Grant default sequence privileges
Grant default type privileges
Alter default privileges
Add grant option to existing privileges
Revoke default privileges
Canonical Format
When generating migration SQL, pgschema produces default privileges in the following canonical format:- Privileges are sorted alphabetically (e.g.,
DELETE, INSERT, SELECT, UPDATE) - Each grantee is handled separately (no combining multiple roles)
- When changing WITH GRANT OPTION status, the privilege is revoked and re-granted
- Object types use plural form (TABLES, SEQUENCES, FUNCTIONS, TYPES)

