Hi all,
I am doing some changes in trigger firing mechanism (as a POC first, I will share my work if people find it useful and if it works).
I am going to extend the trigger calls to child tables. So that in trigger definition I can create triggers with CASCADED TRUE | FALSE option.
This will enable me to extend certain triggers to child tables and get over the scenarios when a record gets inserted in child table and any *after insert* triggers on parent tables never get fired.
I am right now trying to change pg_trigger and CreateTrigger function. I have made changes in below files:
trigger.c:
- Added a New Variable cascadedOption (bool)
- Added a new statement in trigger.c to set the value:
values[Anum_pg_trigger_tgiscascaded - 1] = BoolGetDatum(stmt->cascadedOption);
- Added a new column in CATALOG definition of pg_trigger in pg_trigger.h
bool tgiscascaded;
- In pg_trigger.h, added a new position for values
#define Anum_pg_trigger_tgiscascaded 16
- Modified parsenode.h to add a new element in Structure for trigger statement -CreateTrigStmt
bool cascadedOption;
CreateTrigStmt is passed to CreateTrigger function as an arguement. I am struggling to understand how the values for various members of trigger are set and where [which file] calls CreateTrigStmt.
Can someone provide some help on this?