1 /*-------------------------------------------------------------------------
4 * Common header for some locking-related declarations.
7 * Copyright (c) 2014-2025, PostgreSQL Global Development Group
9 * src/include/nodes/lockoptions.h
11 *-------------------------------------------------------------------------
17 * This enum represents the different strengths of FOR UPDATE/SHARE clauses.
18 * The ordering here is important, because the highest numerical value takes
19 * precedence when a RTE is specified multiple ways. See applyLockingClause.
21 typedef enum LockClauseStrength
23 LCS_NONE
, /* no such clause - only used in PlanRowMark */
24 LCS_FORKEYSHARE
, /* FOR KEY SHARE */
25 LCS_FORSHARE
, /* FOR SHARE */
26 LCS_FORNOKEYUPDATE
, /* FOR NO KEY UPDATE */
27 LCS_FORUPDATE
, /* FOR UPDATE */
31 * This enum controls how to deal with rows being locked by FOR UPDATE/SHARE
32 * clauses (i.e., it represents the NOWAIT and SKIP LOCKED options).
33 * The ordering here is important, because the highest numerical value takes
34 * precedence when a RTE is specified multiple ways. See applyLockingClause.
36 typedef enum LockWaitPolicy
38 /* Wait for the lock to become available (default behavior) */
40 /* Skip rows that can't be locked (SKIP LOCKED) */
42 /* Raise an error if a row cannot be locked (NOWAIT) */
47 * Possible lock modes for a tuple.
49 typedef enum LockTupleMode
51 /* SELECT FOR KEY SHARE */
53 /* SELECT FOR SHARE */
55 /* SELECT FOR NO KEY UPDATE, and UPDATEs that don't modify key columns */
56 LockTupleNoKeyExclusive
,
57 /* SELECT FOR UPDATE, UPDATEs that modify key columns, and DELETE */
61 #endif /* LOCKOPTIONS_H */