| 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 | namespace duckdb_libpgquery { |
| 15 | |
| 16 | /* |
| 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. |
| 20 | */ |
| 21 | typedef enum PGLockClauseStrength { |
| 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 | */ |
| 35 | typedef enum PGLockWaitPolicy { |
| 36 | /* Wait for the lock to become available (default behavior) */ |
| 37 | PGLockWaitBlock, |
| 38 | /* Skip rows that can't be locked (SKIP LOCKED) */ |
| 39 | PGLockWaitSkip, |
| 40 | /* Raise an error if a row cannot be locked (NOWAIT) */ |
| 41 | LockWaitError |
| 42 | } PGLockWaitPolicy; |
| 43 | |
| 44 | } |