| 1 | /*------------------------------------------------------------------------- |
| 2 | * |
| 3 | * reltrigger.h |
| 4 | * POSTGRES relation trigger definitions. |
| 5 | * |
| 6 | * |
| 7 | * Portions Copyright (c) 1996-2019, 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 | |
| 18 | /* |
| 19 | * These struct really belongs to trigger.h, but we put it separately so that |
| 20 | * it can be cleanly included in rel.h and other places. |
| 21 | */ |
| 22 | |
| 23 | typedef struct Trigger |
| 24 | { |
| 25 | Oid tgoid; /* OID of trigger (pg_trigger row) */ |
| 26 | /* Remaining fields are copied from pg_trigger, see pg_trigger.h */ |
| 27 | char *tgname; |
| 28 | Oid tgfoid; |
| 29 | int16 tgtype; |
| 30 | char tgenabled; |
| 31 | bool tgisinternal; |
| 32 | Oid tgconstrrelid; |
| 33 | Oid tgconstrindid; |
| 34 | Oid tgconstraint; |
| 35 | bool tgdeferrable; |
| 36 | bool tginitdeferred; |
| 37 | int16 tgnargs; |
| 38 | int16 tgnattr; |
| 39 | int16 *tgattr; |
| 40 | char **tgargs; |
| 41 | char *tgqual; |
| 42 | char *tgoldtable; |
| 43 | char *tgnewtable; |
| 44 | } Trigger; |
| 45 | |
| 46 | typedef struct TriggerDesc |
| 47 | { |
| 48 | Trigger *triggers; /* array of Trigger structs */ |
| 49 | int numtriggers; /* number of array entries */ |
| 50 | |
| 51 | /* |
| 52 | * These flags indicate whether the array contains at least one of each |
| 53 | * type of trigger. We use these to skip searching the array if not. |
| 54 | */ |
| 55 | bool trig_insert_before_row; |
| 56 | bool trig_insert_after_row; |
| 57 | bool trig_insert_instead_row; |
| 58 | bool trig_insert_before_statement; |
| 59 | bool trig_insert_after_statement; |
| 60 | bool trig_update_before_row; |
| 61 | bool trig_update_after_row; |
| 62 | bool trig_update_instead_row; |
| 63 | bool trig_update_before_statement; |
| 64 | bool trig_update_after_statement; |
| 65 | bool trig_delete_before_row; |
| 66 | bool trig_delete_after_row; |
| 67 | bool trig_delete_instead_row; |
| 68 | bool trig_delete_before_statement; |
| 69 | bool trig_delete_after_statement; |
| 70 | /* there are no row-level truncate triggers */ |
| 71 | bool trig_truncate_before_statement; |
| 72 | bool trig_truncate_after_statement; |
| 73 | /* Is there at least one trigger specifying each transition relation? */ |
| 74 | bool trig_insert_new_table; |
| 75 | bool trig_update_old_table; |
| 76 | bool trig_update_new_table; |
| 77 | bool trig_delete_old_table; |
| 78 | } TriggerDesc; |
| 79 | |
| 80 | #endif /* RELTRIGGER_H */ |
| 81 | |