ROW SHARE
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).
Reading PG 18·Select a recorded version
Compatibility
Compare different transactions holding locks on the same Table lock.
× 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 |
Other lock modes
- conflicts
- exclusive, access-exclusive
- summary
- Conflicts with the EXCLUSIVE and ACCESS EXCLUSIVE lock modes.
Definition PG 18
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).
Compare versions
Complete source facts
commands
map[label:SELECT FOR KEY SHARE note:Lock the named table, in addition to the corresponding locks on selected rows. slug:select source:map[kind:documentation path:doc/src/sgml/mvcc.sgml revision:753057e340da8f22e57c9a409ea7a235fd6a46bd sha256:4b7bf77ee0af4b86052330ff2421d567df3604b75fe7d4f522bec84fdea87340 url:https://raw.githubusercontent.com/postgres/postgres/753057e340da8f22e57c9a409ea7a235fd6a46bd/doc/src/sgml/mvcc.sgml] source_url:https://www.postgresql.org/docs/18/explicit-locking.html variant:0ecc8fb9e712], map[label:SELECT FOR SHARE note:Lock the named table, in addition to the corresponding locks on selected rows. slug:select source:map[kind:documentation path:doc/src/sgml/mvcc.sgml revision:753057e340da8f22e57c9a409ea7a235fd6a46bd sha256:4b7bf77ee0af4b86052330ff2421d567df3604b75fe7d4f522bec84fdea87340 url:https://raw.githubusercontent.com/postgres/postgres/753057e340da8f22e57c9a409ea7a235fd6a46bd/doc/src/sgml/mvcc.sgml] source_url:https://www.postgresql.org/docs/18/explicit-locking.html variant:8b3c78ad3c64], map[label:SELECT FOR NO KEY UPDATE note:Lock the named table, in addition to the corresponding locks on selected rows. slug:select source:map[kind:documentation path:doc/src/sgml/mvcc.sgml revision:753057e340da8f22e57c9a409ea7a235fd6a46bd sha256:4b7bf77ee0af4b86052330ff2421d567df3604b75fe7d4f522bec84fdea87340 url:https://raw.githubusercontent.com/postgres/postgres/753057e340da8f22e57c9a409ea7a235fd6a46bd/doc/src/sgml/mvcc.sgml] source_url:https://www.postgresql.org/docs/18/explicit-locking.html variant:dc13a30028da], map[label:SELECT FOR UPDATE note:Lock the named table, in addition to the corresponding locks on selected rows. slug:select source:map[kind:documentation path:doc/src/sgml/mvcc.sgml revision:753057e340da8f22e57c9a409ea7a235fd6a46bd sha256:4b7bf77ee0af4b86052330ff2421d567df3604b75fe7d4f522bec84fdea87340 url:https://raw.githubusercontent.com/postgres/postgres/753057e340da8f22e57c9a409ea7a235fd6a46bd/doc/src/sgml/mvcc.sgml] source_url:https://www.postgresql.org/docs/18/explicit-locking.html variant:9c457e2f8f3c], map[label:INSERT (foreign-key check) note:The foreign-key check runs SELECT FOR KEY SHARE on the referenced table, taking ROW SHARE there. The writing target separately holds ROW EXCLUSIVE. slug:insert source:map[kind:source path:src/backend/utils/adt/ri_triggers.c revision:753057e340da8f22e57c9a409ea7a235fd6a46bd sha256:a3fed49fbda88fe0fe5bcf35eb019fced28596ae4046233f2acb2eb9f90ab1da url:https://raw.githubusercontent.com/postgres/postgres/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/utils/adt/ri_triggers.c] source_url:https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/utils/adt/ri_triggers.c variant:ffddc0fc16b6], map[label:UPDATE (foreign-key check) note:The foreign-key check runs SELECT FOR KEY SHARE on the referenced table, taking ROW SHARE there. The writing target separately holds ROW EXCLUSIVE. slug:update source:map[kind:source path:src/backend/utils/adt/ri_triggers.c revision:753057e340da8f22e57c9a409ea7a235fd6a46bd sha256:a3fed49fbda88fe0fe5bcf35eb019fced28596ae4046233f2acb2eb9f90ab1da url:https://raw.githubusercontent.com/postgres/postgres/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/utils/adt/ri_triggers.c] source_url:https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/utils/adt/ri_triggers.c variant:65d8638ef74c], map[label:COPY … FROM (foreign-key check) note:The foreign-key check runs SELECT FOR KEY SHARE on the referenced table, taking ROW SHARE there. The writing target separately holds ROW EXCLUSIVE. slug:copy source:map[kind:source path:src/backend/utils/adt/ri_triggers.c revision:753057e340da8f22e57c9a409ea7a235fd6a46bd sha256:a3fed49fbda88fe0fe5bcf35eb019fced28596ae4046233f2acb2eb9f90ab1da url:https://raw.githubusercontent.com/postgres/postgres/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/utils/adt/ri_triggers.c] source_url:https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/utils/adt/ri_triggers.c variant:b85f269c1b8e], map[label:MERGE (foreign-key check) note:The foreign-key check runs SELECT FOR KEY SHARE on the referenced table, taking ROW SHARE there. The writing target separately holds ROW EXCLUSIVE. slug:merge source:map[kind:source path:src/backend/utils/adt/ri_triggers.c revision:753057e340da8f22e57c9a409ea7a235fd6a46bd sha256:a3fed49fbda88fe0fe5bcf35eb019fced28596ae4046233f2acb2eb9f90ab1da url:https://raw.githubusercontent.com/postgres/postgres/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/utils/adt/ri_triggers.c] source_url:https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/utils/adt/ri_triggers.c variant:e00dfdc184d6], map[label:LOCK TABLE … IN ROW SHARE MODE note:Request this table mode explicitly. Omitting IN MODE defaults to ACCESS EXCLUSIVE. slug:lock source:map[kind:documentation path:doc/src/sgml/mvcc.sgml revision:753057e340da8f22e57c9a409ea7a235fd6a46bd sha256:4b7bf77ee0af4b86052330ff2421d567df3604b75fe7d4f522bec84fdea87340 url:https://raw.githubusercontent.com/postgres/postgres/753057e340da8f22e57c9a409ea7a235fd6a46bd/doc/src/sgml/mvcc.sgml] source_url:https://www.postgresql.org/docs/18/explicit-locking.html variant:137512efd0b5], map[label:ALTER TABLE … VALIDATE CONSTRAINT (referenced table) note:Foreign-key validation takes ROW SHARE on the referenced table and SHARE UPDATE EXCLUSIVE on the table being validated. slug:alter-table source:map[kind:command-documentation path:doc/src/sgml/ref/alter_table.sgml revision:753057e340da8f22e57c9a409ea7a235fd6a46bd sha256:10436673fa2f093bdf51986a06d22dd748a9bb003bcd5517db2a65fba569a3c9 url:https://raw.githubusercontent.com/postgres/postgres/753057e340da8f22e57c9a409ea7a235fd6a46bd/doc/src/sgml/ref/alter_table.sgml] source_url:https://www.postgresql.org/docs/18/sql-altertable.html variant:f3ebdc754838]
provenance
{"doc_slug":"18","fetched_at":"2026-09-27T09:39:42+00:00","label":"18","major":"18","official_url":"https://www.postgresql.org/docs/18/explicit-locking.html","ref":"REL_18_STABLE","revision":"753057e340da8f22e57c9a409ea7a235fd6a46bd","sources":[{"kind":"command-documentation","path":"doc/src/sgml/ref/alter_index.sgml","revision":"753057e340da8f22e57c9a409ea7a235fd6a46bd","sha256":"746cd43287186dfbfa6acf77fd5c6713e66919653fb00af5476a0baa65988e7a","url":"https://raw.githubusercontent.com/postgres/postgres/753057e340da8f22e57c9a409ea7a235fd6a46bd/doc/src/sgml/ref/alter_index.sgml"},{"kind":"command-documentation","path":"doc/src/sgml/ref/alter_table.sgml","revision":"753057e340da8f22e57c9a409ea7a235fd6a46bd","sha256":"10436673fa2f093bdf51986a06d22dd748a9bb003bcd5517db2a65fba569a3c9","url":"https://raw.githubusercontent.com/postgres/postgres/753057e340da8f22e57c9a409ea7a235fd6a46bd/doc/src/sgml/ref/alter_table.sgml"},{"kind":"command-documentation","path":"doc/src/sgml/ref/comment.sgml","revision":"753057e340da8f22e57c9a409ea7a235fd6a46bd","sha256":"d0048329d237192696d7ccb9471aba4137d943556fdb770e2ffb3cf6c511c18f","url":"https://raw.githubusercontent.com/postgres/postgres/753057e340da8f22e57c9a409ea7a235fd6a46bd/doc/src/sgml/ref/comment.sgml"},{"kind":"source","path":"src/backend/commands/copy.c","revision":"753057e340da8f22e57c9a409ea7a235fd6a46bd","sha256":"f50ecc1531109fc172d841d461e209cef611f3d017ef4184034c39e128deabbe","url":"https://raw.githubusercontent.com/postgres/postgres/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/commands/copy.c"},{"kind":"command-documentation","path":"doc/src/sgml/ref/create_index.sgml","revision":"753057e340da8f22e57c9a409ea7a235fd6a46bd","sha256":"3698f11c6f447d127e4624a1a845dee4d5146b8337ddc6d895a7962e676717f8","url":"https://raw.githubusercontent.com/postgres/postgres/753057e340da8f22e57c9a409ea7a235fd6a46bd/doc/src/sgml/ref/create_index.sgml"},{"kind":"source","path":"src/backend/access/heap/heapam.c","revision":"753057e340da8f22e57c9a409ea7a235fd6a46bd","sha256":"bca2ca0746a1862016bdb416b8482441a7b16360f71afe5e4abf6dbae0fa0c72","url":"https://raw.githubusercontent.com/postgres/postgres/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/access/heap/heapam.c"},{"kind":"source","path":"src/backend/catalog/index.c","revision":"753057e340da8f22e57c9a409ea7a235fd6a46bd","sha256":"98a4156a5c21ae856a3b583b633cdeb578a5b69910386c9f166d69fcb04ba2d0","url":"https://raw.githubusercontent.com/postgres/postgres/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/catalog/index.c"},{"kind":"command-documentation","path":"doc/src/sgml/ref/insert.sgml","revision":"753057e340da8f22e57c9a409ea7a235fd6a46bd","sha256":"f93403779fb1d980cd5995a1e2741bbdae8404584407610f9aba33ec4724a39f","url":"https://raw.githubusercontent.com/postgres/postgres/753057e340da8f22e57c9a409ea7a235fd6a46bd/doc/src/sgml/ref/insert.sgml"},{"kind":"source","path":"src/backend/storage/lmgr/lock.c","revision":"753057e340da8f22e57c9a409ea7a235fd6a46bd","sha256":"e7f43560bf6a8417ff46991238084b6edeb44a995b87670ed1f7fa6f1515276b","url":"https://raw.githubusercontent.com/postgres/postgres/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/storage/lmgr/lock.c"},{"kind":"documentation","path":"doc/src/sgml/mvcc.sgml","revision":"753057e340da8f22e57c9a409ea7a235fd6a46bd","sha256":"4b7bf77ee0af4b86052330ff2421d567df3604b75fe7d4f522bec84fdea87340","url":"https://raw.githubusercontent.com/postgres/postgres/753057e340da8f22e57c9a409ea7a235fd6a46bd/doc/src/sgml/mvcc.sgml"},{"kind":"command-documentation","path":"doc/src/sgml/ref/reindex.sgml","revision":"753057e340da8f22e57c9a409ea7a235fd6a46bd","sha256":"5e889d6e1d9b09d5f9cd3f7086ca13f540da0fe8262cdd8a9037ce9aa6f1dfdf","url":"https://raw.githubusercontent.com/postgres/postgres/753057e340da8f22e57c9a409ea7a235fd6a46bd/doc/src/sgml/ref/reindex.sgml"},{"kind":"source","path":"src/backend/utils/adt/ri_triggers.c","revision":"753057e340da8f22e57c9a409ea7a235fd6a46bd","sha256":"a3fed49fbda88fe0fe5bcf35eb019fced28596ae4046233f2acb2eb9f90ab1da","url":"https://raw.githubusercontent.com/postgres/postgres/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/utils/adt/ri_triggers.c"},{"kind":"source","path":"src/backend/commands/tablecmds.c","revision":"753057e340da8f22e57c9a409ea7a235fd6a46bd","sha256":"df8817816f893e73d5648fea169e222ba33320e5b24bf755b424b29098f4e7da","url":"https://raw.githubusercontent.com/postgres/postgres/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/commands/tablecmds.c"},{"kind":"command-documentation","path":"doc/src/sgml/ref/vacuum.sgml","revision":"753057e340da8f22e57c9a409ea7a235fd6a46bd","sha256":"80ca5592cda7b74938385f84f09faac33574374c1a05d605a2d55982e4cf1bbf","url":"https://raw.githubusercontent.com/postgres/postgres/753057e340da8f22e57c9a409ea7a235fd6a46bd/doc/src/sgml/ref/vacuum.sgml"},{"kind":"source","path":"src/backend/access/heap/vacuumlazy.c","revision":"753057e340da8f22e57c9a409ea7a235fd6a46bd","sha256":"90932e3b1a7b57dda8f740807def59aedb57fbd0e2173e3af3309f145192c7c2","url":"https://raw.githubusercontent.com/postgres/postgres/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/access/heap/vacuumlazy.c"}],"status":"stable"}Source references
- https://raw.githubusercontent.com/postgres/postgres/753057e340da8f22e57c9a409ea7a235fd6a46bd/doc/src/sgml/mvcc.sgml
- https://raw.githubusercontent.com/postgres/postgres/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/storage/lmgr/lock.c
- https://raw.githubusercontent.com/postgres/postgres/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/access/heap/heapam.c
Full definition and evidence JSON
Definition sources
center · PostgreSQL 18 · wiki-repair-20261023:a91e3c2bd28d268ef25854b8d26f645043631fb2b2cc51aa63e627406065d4e3
Text language: en · wiki-repair-20261023:a91e3c2bd28d268ef25854b8d26f645043631fb2b2cc51aa63e627406065d4e3