lockdefs.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*-------------------------------------------------------------------------
  2. *
  3. * lockdefs.h
  4. * Frontend exposed parts of postgres' low level lock mechanism
  5. *
  6. * The split between lockdefs.h and lock.h is not very principled. This file
  7. * contains definition that have to (indirectly) be available when included by
  8. * FRONTEND code.
  9. *
  10. * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
  11. * Portions Copyright (c) 1994, Regents of the University of California
  12. *
  13. * src/include/storage/lockdefs.h
  14. *
  15. *-------------------------------------------------------------------------
  16. */
  17. #ifndef LOCKDEFS_H_
  18. #define LOCKDEFS_H_
  19. /*
  20. * LOCKMODE is an integer (1..N) indicating a lock type. LOCKMASK is a bit
  21. * mask indicating a set of held or requested lock types (the bit 1<<mode
  22. * corresponds to a particular lock mode).
  23. */
  24. typedef int LOCKMASK;
  25. typedef int LOCKMODE;
  26. /*
  27. * These are the valid values of type LOCKMODE for all the standard lock
  28. * methods (both DEFAULT and USER).
  29. */
  30. /* NoLock is not a lock mode, but a flag value meaning "don't get a lock" */
  31. #define NoLock 0
  32. #define AccessShareLock 1 /* SELECT */
  33. #define RowShareLock 2 /* SELECT FOR UPDATE/FOR SHARE */
  34. #define RowExclusiveLock 3 /* INSERT, UPDATE, DELETE */
  35. #define ShareUpdateExclusiveLock 4 /* VACUUM (non-FULL),ANALYZE, CREATE
  36. * INDEX CONCURRENTLY */
  37. #define ShareLock 5 /* CREATE INDEX (WITHOUT CONCURRENTLY) */
  38. #define ShareRowExclusiveLock 6 /* like EXCLUSIVE MODE, but allows ROW
  39. * SHARE */
  40. #define ExclusiveLock 7 /* blocks ROW SHARE/SELECT...FOR
  41. * UPDATE */
  42. #define AccessExclusiveLock 8 /* ALTER TABLE, DROP TABLE, VACUUM
  43. * FULL, and unqualified LOCK TABLE */
  44. typedef struct xl_standby_lock
  45. {
  46. TransactionId xid; /* xid of holder of AccessExclusiveLock */
  47. Oid dbOid;
  48. Oid relOid;
  49. } xl_standby_lock;
  50. #endif /* LOCKDEF_H_ */