lockoptions.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*-------------------------------------------------------------------------
  2. *
  3. * lockoptions.h
  4. * Common header for some locking-related declarations.
  5. *
  6. *
  7. * Copyright (c) 2014-2016, PostgreSQL Global Development Group
  8. *
  9. * src/include/nodes/lockoptions.h
  10. *
  11. *-------------------------------------------------------------------------
  12. */
  13. #ifndef LOCKOPTIONS_H
  14. #define LOCKOPTIONS_H
  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. */
  20. typedef enum LockClauseStrength
  21. {
  22. LCS_NONE, /* no such clause - only used in PlanRowMark */
  23. LCS_FORKEYSHARE, /* FOR KEY SHARE */
  24. LCS_FORSHARE, /* FOR SHARE */
  25. LCS_FORNOKEYUPDATE, /* FOR NO KEY UPDATE */
  26. LCS_FORUPDATE /* FOR UPDATE */
  27. } LockClauseStrength;
  28. /*
  29. * This enum controls how to deal with rows being locked by FOR UPDATE/SHARE
  30. * clauses (i.e., it represents the NOWAIT and SKIP LOCKED options).
  31. * The ordering here is important, because the highest numerical value takes
  32. * precedence when a RTE is specified multiple ways. See applyLockingClause.
  33. */
  34. typedef enum LockWaitPolicy
  35. {
  36. /* Wait for the lock to become available (default behavior) */
  37. LockWaitBlock,
  38. /* Skip rows that can't be locked (SKIP LOCKED) */
  39. LockWaitSkip,
  40. /* Raise an error if a row cannot be locked (NOWAIT) */
  41. LockWaitError
  42. } LockWaitPolicy;
  43. #endif /* LOCKOPTIONS_H */