mirror of
https://github.com/postgres/postgres.git
synced 2025-07-05 07:21:24 +03:00
Fix thinko in ExecCleanupTupleRouting().
Commit 3f2393edef
changed ExecCleanupTupleRouting() so that it skipped
cleaning up subplan resultrels before calling EndForeignInsert(), but
that would cause an issue: when those resultrels were foreign tables,
the FDWs would fail to shut down. Repair by skipping it after calling
EndForeignInsert() as before.
Author: Etsuro Fujita
Reviewed-by: David Rowley and Amit Langote
Discussion: https://postgr.es/m/5CAF3B8F.2090905@lab.ntt.co.jp
This commit is contained in:
@ -1126,6 +1126,12 @@ ExecCleanupTupleRouting(ModifyTableState *mtstate,
|
|||||||
{
|
{
|
||||||
ResultRelInfo *resultRelInfo = proute->partitions[i];
|
ResultRelInfo *resultRelInfo = proute->partitions[i];
|
||||||
|
|
||||||
|
/* Allow any FDWs to shut down */
|
||||||
|
if (resultRelInfo->ri_FdwRoutine != NULL &&
|
||||||
|
resultRelInfo->ri_FdwRoutine->EndForeignInsert != NULL)
|
||||||
|
resultRelInfo->ri_FdwRoutine->EndForeignInsert(mtstate->ps.state,
|
||||||
|
resultRelInfo);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check if this result rel is one belonging to the node's subplans,
|
* Check if this result rel is one belonging to the node's subplans,
|
||||||
* if so, let ExecEndPlan() clean it up.
|
* if so, let ExecEndPlan() clean it up.
|
||||||
@ -1142,12 +1148,6 @@ ExecCleanupTupleRouting(ModifyTableState *mtstate,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allow any FDWs to shut down if they've been exercised */
|
|
||||||
if (resultRelInfo->ri_FdwRoutine != NULL &&
|
|
||||||
resultRelInfo->ri_FdwRoutine->EndForeignInsert != NULL)
|
|
||||||
resultRelInfo->ri_FdwRoutine->EndForeignInsert(mtstate->ps.state,
|
|
||||||
resultRelInfo);
|
|
||||||
|
|
||||||
ExecCloseIndices(resultRelInfo);
|
ExecCloseIndices(resultRelInfo);
|
||||||
table_close(resultRelInfo->ri_RelationDesc, NoLock);
|
table_close(resultRelInfo->ri_RelationDesc, NoLock);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user