Reference / Lock Modes / Table lock
Table lock · RS
ROW SHARE
Definition
Conflicts with the EXCLUSIVE and ACCESS EXCLUSIVE lock modes.
The SELECT command acquires a lock of this mode on all tables on which one of the FOR UPDATE, FOR NO KEY UPDATE, FOR SHARE, or FOR KEY SHARE options is specified (in addition to ACCESS SHARE locks on any other tables that are referenced without any explicit FOR ... locking option).
Compatibility
Compare different transactions holding locks on the same table.
× Conflicting modes
Commands acquiring this mode
| SQL command | Object, phase and conditions |
|---|---|
| SELECT FOR KEY SHARE | Lock the named table, in addition to the corresponding locks on selected rows. Source |
| SELECT FOR SHARE | Lock the named table, in addition to the corresponding locks on selected rows. Source |
| SELECT FOR NO KEY UPDATE | Lock the named table, in addition to the corresponding locks on selected rows. Source |
| SELECT FOR UPDATE | Lock the named table, in addition to the corresponding locks on selected rows. Source |
| INSERT (foreign-key check) | The foreign-key check runs SELECT FOR KEY SHARE on the referenced table, taking ROW SHARE there. The writing target separately holds ROW EXCLUSIVE. Source |
| UPDATE (foreign-key check) | The foreign-key check runs SELECT FOR KEY SHARE on the referenced table, taking ROW SHARE there. The writing target separately holds ROW EXCLUSIVE. Source |
| COPY … FROM (foreign-key check) | The foreign-key check runs SELECT FOR KEY SHARE on the referenced table, taking ROW SHARE there. The writing target separately holds ROW EXCLUSIVE. Source |
| MERGE (foreign-key check) | The foreign-key check runs SELECT FOR KEY SHARE on the referenced table, taking ROW SHARE there. The writing target separately holds ROW EXCLUSIVE. Source |
| LOCK TABLE … IN ROW SHARE MODE | Request this table mode explicitly. Omitting IN MODE defaults to ACCESS EXCLUSIVE. Source |
| ALTER TABLE … VALIDATE CONSTRAINT (referenced table) | Foreign-key validation takes ROW SHARE on the referenced table and SHARE UPDATE EXCLUSIVE on the table being validated. 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.