2
0

reltrigger.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*-------------------------------------------------------------------------
  2. *
  3. * reltrigger.h
  4. * POSTGRES relation trigger definitions.
  5. *
  6. *
  7. * Portions Copyright (c) 1996-2022, 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. bool tgisclone;
  30. Oid tgconstrrelid;
  31. Oid tgconstrindid;
  32. Oid tgconstraint;
  33. bool tgdeferrable;
  34. bool tginitdeferred;
  35. int16 tgnargs;
  36. int16 tgnattr;
  37. int16 *tgattr;
  38. char **tgargs;
  39. char *tgqual;
  40. char *tgoldtable;
  41. char *tgnewtable;
  42. } Trigger;
  43. typedef struct TriggerDesc
  44. {
  45. Trigger *triggers; /* array of Trigger structs */
  46. int numtriggers; /* number of array entries */
  47. /*
  48. * These flags indicate whether the array contains at least one of each
  49. * type of trigger. We use these to skip searching the array if not.
  50. */
  51. bool trig_insert_before_row;
  52. bool trig_insert_after_row;
  53. bool trig_insert_instead_row;
  54. bool trig_insert_before_statement;
  55. bool trig_insert_after_statement;
  56. bool trig_update_before_row;
  57. bool trig_update_after_row;
  58. bool trig_update_instead_row;
  59. bool trig_update_before_statement;
  60. bool trig_update_after_statement;
  61. bool trig_delete_before_row;
  62. bool trig_delete_after_row;
  63. bool trig_delete_instead_row;
  64. bool trig_delete_before_statement;
  65. bool trig_delete_after_statement;
  66. /* there are no row-level truncate triggers */
  67. bool trig_truncate_before_statement;
  68. bool trig_truncate_after_statement;
  69. /* Is there at least one trigger specifying each transition relation? */
  70. bool trig_insert_new_table;
  71. bool trig_update_old_table;
  72. bool trig_update_new_table;
  73. bool trig_delete_old_table;
  74. } TriggerDesc;
  75. #endif /* RELTRIGGER_H */