From d060e921ea5aa47b6265174c32e1128cebdbc3df Mon Sep 17 00:00:00 2001 From: Amit Langote Date: Thu, 28 Sep 2023 09:44:39 +0900 Subject: Remove obsolete executor cleanup code This commit removes unnecessary ExecExprFreeContext() calls in ExecEnd* routines because the actual cleanup is managed by FreeExecutorState(). With no callers remaining for ExecExprFreeContext(), this commit also removes the function. This commit also drops redundant ExecClearTuple() calls, because ExecResetTupleTable() in ExecEndPlan() already takes care of resetting and dropping all TupleTableSlots initialized with ExecInitScanTupleSlot() and ExecInitExtraTupleSlot(). After these modifications, the ExecEnd*() routines for ValuesScan, NamedTuplestoreScan, and WorkTableScan became redundant. So, this commit removes them. Reviewed-by: Robert Haas Discussion: https://postgr.es/m/CA+HiwqFGkMSge6TgC9KQzde0ohpAycLQuV7ooitEEpbKB0O_mg@mail.gmail.com --- src/backend/executor/execUtils.c | 26 -------------------------- 1 file changed, 26 deletions(-) (limited to 'src/backend/executor/execUtils.c') diff --git a/src/backend/executor/execUtils.c b/src/backend/executor/execUtils.c index c06b2288583..16704c0c2f1 100644 --- a/src/backend/executor/execUtils.c +++ b/src/backend/executor/execUtils.c @@ -638,32 +638,6 @@ tlist_matches_tupdesc(PlanState *ps, List *tlist, int varno, TupleDesc tupdesc) return true; } -/* ---------------- - * ExecFreeExprContext - * - * A plan node's ExprContext should be freed explicitly during executor - * shutdown because there may be shutdown callbacks to call. (Other resources - * made by the above routines, such as projection info, don't need to be freed - * explicitly because they're just memory in the per-query memory context.) - * - * However ... there is no particular need to do it during ExecEndNode, - * because FreeExecutorState will free any remaining ExprContexts within - * the EState. Letting FreeExecutorState do it allows the ExprContexts to - * be freed in reverse order of creation, rather than order of creation as - * will happen if we delete them here, which saves O(N^2) work in the list - * cleanup inside FreeExprContext. - * ---------------- - */ -void -ExecFreeExprContext(PlanState *planstate) -{ - /* - * Per above discussion, don't actually delete the ExprContext. We do - * unlink it from the plan node, though. - */ - planstate->ps_ExprContext = NULL; -} - /* ---------------------------------------------------------------- * Scan node support -- cgit v1.2.3