1/*-------------------------------------------------------------------------
2 *
3 * lockoptions.h
4 * Common header for some locking-related declarations.
5 *
6 *
7 * Copyright (c) 2014-2017, PostgreSQL Global Development PGGroup
8 *
9 * src/include/nodes/lockoptions.h
10 *
11 *-------------------------------------------------------------------------
12 */
13#pragma once
14
15/*
16 * This enum represents the different strengths of FOR UPDATE/SHARE clauses.
17 * The ordering here is important, because the highest numerical value takes
18 * precedence when a RTE is specified multiple ways. See applyLockingClause.
19 */
20typedef enum PGLockClauseStrength
21{
22 PG_LCS_NONE, /* no such clause - only used in PGPlanRowMark */
23 PG_LCS_FORKEYSHARE, /* FOR KEY SHARE */
24 PG_LCS_FORSHARE, /* FOR SHARE */
25 PG_LCS_FORNOKEYUPDATE, /* FOR NO KEY UPDATE */
26 LCS_FORUPDATE /* FOR UPDATE */
27} PGLockClauseStrength;
28
29/*
30 * This enum controls how to deal with rows being locked by FOR UPDATE/SHARE
31 * clauses (i.e., it represents the NOWAIT and SKIP LOCKED options).
32 * The ordering here is important, because the highest numerical value takes
33 * precedence when a RTE is specified multiple ways. See applyLockingClause.
34 */
35typedef enum PGLockWaitPolicy
36{
37 /* Wait for the lock to become available (default behavior) */
38 PGLockWaitBlock,
39 /* Skip rows that can't be locked (SKIP LOCKED) */
40 PGLockWaitSkip,
41 /* Raise an error if a row cannot be locked (NOWAIT) */
42 LockWaitError
43} PGLockWaitPolicy;
44
45