* Set up the state needed for collecting transition tuples for AFTER * triggers. */
| 2539 | * triggers. |
| 2540 | */ |
| 2541 | static void |
| 2542 | ExecSetupTransitionCaptureState(ModifyTableState *mtstate, EState *estate) |
| 2543 | { |
| 2544 | ModifyTable *plan = (ModifyTable *) mtstate->ps.plan; |
| 2545 | ResultRelInfo *targetRelInfo = mtstate->rootResultRelInfo; |
| 2546 | |
| 2547 | /* Check for transition tables on the directly targeted relation. */ |
| 2548 | mtstate->mt_transition_capture = |
| 2549 | MakeTransitionCaptureState(targetRelInfo->ri_TrigDesc, |
| 2550 | RelationGetRelid(targetRelInfo->ri_RelationDesc), |
| 2551 | mtstate->operation); |
| 2552 | if (plan->operation == CMD_INSERT && |
| 2553 | plan->onConflictAction == ONCONFLICT_UPDATE) |
| 2554 | mtstate->mt_oc_transition_capture = |
| 2555 | MakeTransitionCaptureState(targetRelInfo->ri_TrigDesc, |
| 2556 | RelationGetRelid(targetRelInfo->ri_RelationDesc), |
| 2557 | CMD_UPDATE); |
| 2558 | } |
| 2559 | |
| 2560 | /* |
| 2561 | * ExecPrepareTupleRouting --- prepare for routing one tuple |
no test coverage detected