mirror of
https://github.com/postgres/postgres.git
synced 2025-06-27 23:21:58 +03:00
Fix transition tables for wCTEs.
The original coding didn't handle this case properly; each separate DML substatement needs its own set of transitions. Patch by Thomas Munro Discussion: https://postgr.es/m/CAL9smLCDQ%3D2o024rBgtD4WihzX8B3C6u_oSQ2K3%2BR5grJrV0bg%40mail.gmail.com
This commit is contained in:
@ -1442,14 +1442,18 @@ fireASTriggers(ModifyTableState *node)
|
||||
case CMD_INSERT:
|
||||
if (node->mt_onconflict == ONCONFLICT_UPDATE)
|
||||
ExecASUpdateTriggers(node->ps.state,
|
||||
resultRelInfo);
|
||||
ExecASInsertTriggers(node->ps.state, resultRelInfo);
|
||||
resultRelInfo,
|
||||
node->mt_transition_capture);
|
||||
ExecASInsertTriggers(node->ps.state, resultRelInfo,
|
||||
node->mt_transition_capture);
|
||||
break;
|
||||
case CMD_UPDATE:
|
||||
ExecASUpdateTriggers(node->ps.state, resultRelInfo);
|
||||
ExecASUpdateTriggers(node->ps.state, resultRelInfo,
|
||||
node->mt_transition_capture);
|
||||
break;
|
||||
case CMD_DELETE:
|
||||
ExecASDeleteTriggers(node->ps.state, resultRelInfo);
|
||||
ExecASDeleteTriggers(node->ps.state, resultRelInfo,
|
||||
node->mt_transition_capture);
|
||||
break;
|
||||
default:
|
||||
elog(ERROR, "unknown operation");
|
||||
@ -2304,6 +2308,10 @@ ExecEndModifyTable(ModifyTableState *node)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* Free transition tables */
|
||||
if (node->mt_transition_capture != NULL)
|
||||
DestroyTransitionCaptureState(node->mt_transition_capture);
|
||||
|
||||
/*
|
||||
* Allow any FDWs to shut down
|
||||
*/
|
||||
|
Reference in New Issue
Block a user