postgresql/src/include/utils/lockwaitpolicy.h
Alvaro Herrera df630b0dd5 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
2014-10-07 17:23:34 -03:00

31 lines
950 B
C

/*-------------------------------------------------------------------------
* lockwaitpolicy.h
* Header file for LockWaitPolicy enum.
*
* Copyright (c) 2014, PostgreSQL Global Development Group
*
* src/include/utils/lockwaitpolicy.h
*-------------------------------------------------------------------------
*/
#ifndef LOCKWAITPOLICY_H
#define LOCKWAITPOLICY_H
/*
* This enum controls how to deal with rows being locked by FOR UPDATE/SHARE
* clauses (i.e., NOWAIT and SKIP LOCKED clauses). The ordering here is
* important, because the highest numerical value takes precedence when a
* RTE is specified multiple ways. See applyLockingClause.
*/
typedef enum
{
/* Wait for the lock to become available (default behavior) */
LockWaitBlock,
/* Skip rows that can't be locked (SKIP LOCKED) */
LockWaitSkip,
/* Raise an error if a row cannot be locked (NOWAIT) */
LockWaitError
} LockWaitPolicy;
#endif /* LOCKWAITPOLICY_H */