↑↓ select ↵ open ⌫ change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

Reference / Lock Modes / Table lock

Table lock · SRX

SHARE ROW EXCLUSIVE

Current

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.

View the full compatibility matrices

Commands acquiring this mode

SQL commandObject, phase and conditions
CREATE TRIGGERLock the table that owns the trigger. Source
LOCK TABLE … IN SHARE ROW EXCLUSIVE MODERequest this table mode explicitly. Omitting IN MODE defaults to ACCESS EXCLUSIVE. Source
ALTER TABLE … ENABLE / DISABLE TRIGGEREnable 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

Source collection date: 2026-09-27.