]> granicus.if.org Git - postgresql/commit
Implement SKIP LOCKED for row-level locks
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Tue, 7 Oct 2014 20:23:34 +0000 (17:23 -0300)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Tue, 7 Oct 2014 20:23:34 +0000 (17:23 -0300)
commitdf630b0dd5ea2de52972d456f5978a012436115e
treebe0007351a856caa48230155f5c5bcfe5a31f86d
parentc421efd21330f2e5bed253b4a53d7ea5e084edf6
Implement SKIP LOCKED for row-level locks

This clause changes the behavior of SELECT locking clauses in the
presence of locked rows: instead of causing a process to block waiting
for the locks held by other processes (or raise an error, with NOWAIT),
SKIP LOCKED makes the new reader skip over such rows.  While this is not
appropriate behavior for general purposes, there are some cases in which
it is useful, such as queue-like tables.

Catalog version bumped because this patch changes the representation of
stored rules.

Reviewed by Craig Ringer (based on a previous attempt at an
implementation by Simon Riggs, who also provided input on the syntax
used in the current patch), David Rowley, and Álvaro Herrera.

Author: Thomas Munro
38 files changed:
doc/src/sgml/ref/select.sgml
doc/src/sgml/sql.sgml
src/backend/access/heap/heapam.c
src/backend/commands/trigger.c
src/backend/executor/execMain.c
src/backend/executor/nodeLockRows.c
src/backend/nodes/copyfuncs.c
src/backend/nodes/equalfuncs.c
src/backend/nodes/outfuncs.c
src/backend/nodes/readfuncs.c
src/backend/optimizer/plan/planner.c
src/backend/optimizer/prep/prepsecurity.c
src/backend/optimizer/prep/prepunion.c
src/backend/parser/analyze.c
src/backend/parser/gram.y
src/backend/rewrite/rewriteHandler.c
src/backend/utils/adt/ruleutils.c
src/include/access/heapam.h
src/include/catalog/catversion.h
src/include/executor/executor.h
src/include/nodes/execnodes.h
src/include/nodes/parsenodes.h
src/include/nodes/plannodes.h
src/include/parser/analyze.h
src/include/parser/kwlist.h
src/include/utils/lockwaitpolicy.h [new file with mode: 0644]
src/include/utils/snapshot.h
src/test/isolation/expected/skip-locked-2.out [new file with mode: 0644]
src/test/isolation/expected/skip-locked-3.out [new file with mode: 0644]
src/test/isolation/expected/skip-locked-4.out [new file with mode: 0644]
src/test/isolation/expected/skip-locked-4_1.out [new file with mode: 0644]
src/test/isolation/expected/skip-locked.out [new file with mode: 0644]
src/test/isolation/isolation_schedule
src/test/isolation/specs/nowait-4.spec
src/test/isolation/specs/skip-locked-2.spec [new file with mode: 0644]
src/test/isolation/specs/skip-locked-3.spec [new file with mode: 0644]
src/test/isolation/specs/skip-locked-4.spec [new file with mode: 0644]
src/test/isolation/specs/skip-locked.spec [new file with mode: 0644]