reltrigger.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*-------------------------------------------------------------------------
  2. *
  3. * reltrigger.h
  4. * POSTGRES relation trigger definitions.
  5. *
  6. *
  7. * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
  8. * Portions Copyright (c) 1994, Regents of the University of California
  9. *
  10. * src/include/utils/reltrigger.h
  11. *
  12. *-------------------------------------------------------------------------
  13. */
  14. #ifndef RELTRIGGER_H
  15. #define RELTRIGGER_H
  16. /*
  17. * These struct really belongs to trigger.h, but we put it separately so that
  18. * it can be cleanly included in rel.h and other places.
  19. */
  20. typedef struct Trigger
  21. {
  22. Oid tgoid; /* OID of trigger (pg_trigger row) */
  23. /* Remaining fields are copied from pg_trigger, see pg_trigger.h */
  24. char *tgname;
  25. Oid tgfoid;
  26. int16 tgtype;
  27. char tgenabled;
  28. bool tgisinternal;
  29. Oid tgconstrrelid;
  30. Oid tgconstrindid;
  31. Oid tgconstraint;
  32. bool tgdeferrable;
  33. bool tginitdeferred;
  34. int16 tgnargs;
  35. int16 tgnattr;
  36. int16 *tgattr;
  37. char **tgargs;
  38. char *tgqual;
  39. } Trigger;
  40. typedef struct TriggerDesc
  41. {
  42. Trigger *triggers; /* array of Trigger structs */
  43. int numtriggers; /* number of array entries */
  44. /*
  45. * These flags indicate whether the array contains at least one of each
  46. * type of trigger. We use these to skip searching the array if not.
  47. */
  48. bool trig_insert_before_row;
  49. bool trig_insert_after_row;
  50. bool trig_insert_instead_row;
  51. bool trig_insert_before_statement;
  52. bool trig_insert_after_statement;
  53. bool trig_update_before_row;
  54. bool trig_update_after_row;
  55. bool trig_update_instead_row;
  56. bool trig_update_before_statement;
  57. bool trig_update_after_statement;
  58. bool trig_delete_before_row;
  59. bool trig_delete_after_row;
  60. bool trig_delete_instead_row;
  61. bool trig_delete_before_statement;
  62. bool trig_delete_after_statement;
  63. /* there are no row-level truncate triggers */
  64. bool trig_truncate_before_statement;
  65. bool trig_truncate_after_statement;
  66. } TriggerDesc;
  67. #endif /* RELTRIGGER_H */