Reference / Lock Modes / Table lock
Table lock · SRX
SHARE ROW EXCLUSIVE
Definition
Conflicts with the ROW EXCLUSIVE, SHARE UPDATE EXCLUSIVE, SHARE, SHARE ROW EXCLUSIVE, EXCLUSIVE, and ACCESS EXCLUSIVE lock modes. This mode protects a table against concurrent data changes, and is self-exclusive so that only one session can hold it at a time.
Acquired by CREATE TRIGGER and some forms of ALTER TABLE.
Compatibility
Compare different transactions holding locks on the same table.
× Conflicting modes
· Compatible modes
Commands acquiring this mode
| SQL command | Object, phase and conditions |
|---|---|
| CREATE TRIGGER | Lock the table that owns the trigger. Source |
| LOCK TABLE … IN SHARE ROW EXCLUSIVE MODE | Request this table mode explicitly. Omitting IN MODE defaults to ACCESS EXCLUSIVE. Source |
| ALTER TABLE … ENABLE / DISABLE TRIGGER | Enable or disable triggers, including the applicable USER, ALL, REPLICA and ALWAYS forms. Source |
| ALTER TABLE … ADD FOREIGN KEY [NOT VALID] (referencing table) | Both referencing and referenced tables take SHARE ROW EXCLUSIVE. NOT VALID skips the initial data check, not this lock. Source |
| ALTER TABLE … ADD FOREIGN KEY [NOT VALID] (referenced table) | The referenced table also takes SHARE ROW EXCLUSIVE, not merely ACCESS SHARE. Source |
Commands may acquire additional locks. See all command associations.
Other lock modes
Sources
PostgreSQL 18 · Sampled build REL_18_STABLE · 753057e340da. Conflicts, definitions and command associations refer to this fixed source build. SQL links retain the selected version.
Local English manual · Online manual
Pinned source files
- Manual source: explicit locking 753057e340da
- Table lock conflict definitions 753057e340da
- Row lock mode definitions 753057e340da
Source collection date: 2026-09-27.