ExecEndTableFuncScan((TableFuncScanState *) node);
break;
- case T_ValuesScanState:
- ExecEndValuesScan((ValuesScanState *) node);
- break;
-
case T_CteScanState:
ExecEndCteScan((CteScanState *) node);
break;
- case T_NamedTuplestoreScanState:
- ExecEndNamedTuplestoreScan((NamedTuplestoreScanState *) node);
- break;
-
- case T_WorkTableScanState:
- ExecEndWorkTableScan((WorkTableScanState *) node);
- break;
-
case T_ForeignScanState:
ExecEndForeignScan((ForeignScanState *) node);
break;
ExecEndLimit((LimitState *) node);
break;
+ /* No clean up actions for these nodes. */
+ case T_ValuesScanState:
+ case T_NamedTuplestoreScanState:
+ case T_WorkTableScanState:
+ break;
+
default:
elog(ERROR, "unrecognized node type: %d", (int) nodeTag(node));
break;
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
if (node->hashcontext)
ReScanExprContext(node->hashcontext);
- /*
- * We don't actually free any ExprContexts here (see comment in
- * ExecFreeExprContext), just unlinking the output one from the plan node
- * suffices.
- */
- ExecFreeExprContext(&node->ss.ps);
-
- /* clean up tuple table */
- ExecClearTuple(node->ss.ss_ScanTupleSlot);
-
outerPlan = outerPlanState(node);
ExecEndNode(outerPlan);
}
*/
scanDesc = node->ss.ss_currentScanDesc;
- /*
- * Free the exprcontext
- */
- ExecFreeExprContext(&node->ss.ps);
-
- /*
- * clear out tuple table slots
- */
- if (node->ss.ps.ps_ResultTupleSlot)
- ExecClearTuple(node->ss.ps.ps_ResultTupleSlot);
- ExecClearTuple(node->ss.ss_ScanTupleSlot);
-
/*
* close down subplans
*/
indexRelationDesc = node->biss_RelationDesc;
indexScanDesc = node->biss_ScanDesc;
- /*
- * Free the exprcontext ... now dead code, see ExecFreeExprContext
- */
-#ifdef NOT_USED
- if (node->biss_RuntimeContext)
- FreeExprContext(node->biss_RuntimeContext, true);
-#endif
-
/*
* close the index relation (no-op if we didn't open it)
*/
void
ExecEndCteScan(CteScanState *node)
{
- /*
- * Free exprcontext
- */
- ExecFreeExprContext(&node->ss.ps);
-
- /*
- * clean out the tuple table
- */
- if (node->ss.ps.ps_ResultTupleSlot)
- ExecClearTuple(node->ss.ps.ps_ResultTupleSlot);
- ExecClearTuple(node->ss.ss_ScanTupleSlot);
-
/*
* If I am the leader, free the tuplestore.
*/
{
Assert(node->methods->EndCustomScan != NULL);
node->methods->EndCustomScan(node);
-
- /* Free the exprcontext */
- ExecFreeExprContext(&node->ss.ps);
-
- /* Clean out the tuple table */
- ExecClearTuple(node->ss.ps.ps_ResultTupleSlot);
- ExecClearTuple(node->ss.ss_ScanTupleSlot);
}
void
/* Shut down any outer plan. */
if (outerPlanState(node))
ExecEndNode(outerPlanState(node));
-
- /* Free the exprcontext */
- ExecFreeExprContext(&node->ss.ps);
-
- /* clean out the tuple table */
- if (node->ss.ps.ps_ResultTupleSlot)
- ExecClearTuple(node->ss.ps.ps_ResultTupleSlot);
- ExecClearTuple(node->ss.ss_ScanTupleSlot);
}
/* ----------------------------------------------------------------
{
int i;
- /*
- * Free the exprcontext
- */
- ExecFreeExprContext(&node->ss.ps);
-
- /*
- * clean out the tuple table
- */
- if (node->ss.ps.ps_ResultTupleSlot)
- ExecClearTuple(node->ss.ps.ps_ResultTupleSlot);
- ExecClearTuple(node->ss.ss_ScanTupleSlot);
-
/*
* Release slots and tuplestore resources
*/
{
FunctionScanPerFuncState *fs = &node->funcstates[i];
- if (fs->func_slot)
- ExecClearTuple(fs->func_slot);
-
if (fs->tstore != NULL)
{
tuplestore_end(node->funcstates[i].tstore);
{
ExecEndNode(outerPlanState(node)); /* let children clean up first */
ExecShutdownGather(node);
- ExecFreeExprContext(&node->ps);
- if (node->ps.ps_ResultTupleSlot)
- ExecClearTuple(node->ps.ps_ResultTupleSlot);
}
/*
{
ExecEndNode(outerPlanState(node)); /* let children clean up first */
ExecShutdownGatherMerge(node);
- ExecFreeExprContext(&node->ps);
- if (node->ps.ps_ResultTupleSlot)
- ExecClearTuple(node->ps.ps_ResultTupleSlot);
}
/* ----------------------------------------------------------------
{
PlanState *outerPlan;
- ExecFreeExprContext(&node->ss.ps);
-
- /* clean up tuple table */
- ExecClearTuple(node->ss.ss_ScanTupleSlot);
-
outerPlan = outerPlanState(node);
ExecEndNode(outerPlan);
}
{
PlanState *outerPlan;
- /*
- * free exprcontext
- */
- ExecFreeExprContext(&node->ps);
-
/*
* shut down the subplan
*/
node->hj_HashTable = NULL;
}
- /*
- * Free the exprcontext
- */
- ExecFreeExprContext(&node->js.ps);
-
- /*
- * clean out the tuple table
- */
- ExecClearTuple(node->js.ps.ps_ResultTupleSlot);
- ExecClearTuple(node->hj_OuterTupleSlot);
- ExecClearTuple(node->hj_HashTupleSlot);
-
/*
* clean up subtrees
*/
{
SO_printf("ExecEndIncrementalSort: shutting down sort node\n");
- /* clean out the scan tuple */
- ExecClearTuple(node->ss.ss_ScanTupleSlot);
- /* must drop pointer to sort result tuple */
- ExecClearTuple(node->ss.ps.ps_ResultTupleSlot);
- /* must drop standalone tuple slots from outer node */
ExecDropSingleTupleTableSlot(node->group_pivot);
ExecDropSingleTupleTableSlot(node->transfer_tuple);
node->ioss_VMBuffer = InvalidBuffer;
}
- /*
- * Free the exprcontext(s) ... now dead code, see ExecFreeExprContext
- */
-#ifdef NOT_USED
- ExecFreeExprContext(&node->ss.ps);
- if (node->ioss_RuntimeContext)
- FreeExprContext(node->ioss_RuntimeContext, true);
-#endif
-
- /*
- * clear out tuple table slots
- */
- if (node->ss.ps.ps_ResultTupleSlot)
- ExecClearTuple(node->ss.ps.ps_ResultTupleSlot);
- ExecClearTuple(node->ss.ss_ScanTupleSlot);
-
/*
* close the index relation (no-op if we didn't open it)
*/
indexRelationDesc = node->iss_RelationDesc;
indexScanDesc = node->iss_ScanDesc;
- /*
- * Free the exprcontext(s) ... now dead code, see ExecFreeExprContext
- */
-#ifdef NOT_USED
- ExecFreeExprContext(&node->ss.ps);
- if (node->iss_RuntimeContext)
- FreeExprContext(node->iss_RuntimeContext, true);
-#endif
-
- /*
- * clear out tuple table slots
- */
- if (node->ss.ps.ps_ResultTupleSlot)
- ExecClearTuple(node->ss.ps.ps_ResultTupleSlot);
- ExecClearTuple(node->ss.ss_ScanTupleSlot);
-
/*
* close the index relation (no-op if we didn't open it)
*/
void
ExecEndLimit(LimitState *node)
{
- ExecFreeExprContext(&node->ps);
ExecEndNode(outerPlanState(node));
}
void
ExecEndMaterial(MaterialState *node)
{
- /*
- * clean out the tuple table
- */
- ExecClearTuple(node->ss.ss_ScanTupleSlot);
-
/*
* Release tuplestore resources
*/
/* Remove the cache context */
MemoryContextDelete(node->tableContext);
- ExecClearTuple(node->ss.ss_ScanTupleSlot);
- /* must drop pointer to cache result tuple */
- ExecClearTuple(node->ss.ps.ps_ResultTupleSlot);
-
- /*
- * free exprcontext
- */
- ExecFreeExprContext(&node->ss.ps);
-
/*
* shut down the subplan
*/
MJ1_printf("ExecEndMergeJoin: %s\n",
"ending node processing");
- /*
- * Free the exprcontext
- */
- ExecFreeExprContext(&node->js.ps);
-
- /*
- * clean out the tuple table
- */
- ExecClearTuple(node->js.ps.ps_ResultTupleSlot);
- ExecClearTuple(node->mj_MarkedTupleSlot);
-
/*
* shut down the subplans
*/
ExecDropSingleTupleTableSlot(node->mt_root_tuple_slot);
}
- /*
- * Free the exprcontext
- */
- ExecFreeExprContext(&node->ps);
-
- /*
- * clean out the tuple table
- */
- if (node->ps.ps_ResultTupleSlot)
- ExecClearTuple(node->ps.ps_ResultTupleSlot);
-
/*
* Terminate EPQ execution if active
*/
return scanstate;
}
-/* ----------------------------------------------------------------
- * ExecEndNamedTuplestoreScan
- *
- * frees any storage allocated through C routines.
- * ----------------------------------------------------------------
- */
-void
-ExecEndNamedTuplestoreScan(NamedTuplestoreScanState *node)
-{
- /*
- * Free exprcontext
- */
- ExecFreeExprContext(&node->ss.ps);
-
- /*
- * clean out the tuple table
- */
- if (node->ss.ps.ps_ResultTupleSlot)
- ExecClearTuple(node->ss.ps.ps_ResultTupleSlot);
- ExecClearTuple(node->ss.ss_ScanTupleSlot);
-}
-
/* ----------------------------------------------------------------
* ExecReScanNamedTuplestoreScan
*
NL1_printf("ExecEndNestLoop: %s\n",
"ending node processing");
- /*
- * Free the exprcontext
- */
- ExecFreeExprContext(&node->js.ps);
-
- /*
- * clean out the tuple table
- */
- ExecClearTuple(node->js.ps.ps_ResultTupleSlot);
-
/*
* close down subplans
*/
void
ExecEndProjectSet(ProjectSetState *node)
{
- /*
- * Free the exprcontext
- */
- ExecFreeExprContext(&node->ps);
-
- /*
- * clean out the tuple table
- */
- ExecClearTuple(node->ps.ps_ResultTupleSlot);
-
/*
* shut down subplans
*/
void
ExecEndResult(ResultState *node)
{
- /*
- * Free the exprcontext
- */
- ExecFreeExprContext(&node->ps);
-
- /*
- * clean out the tuple table
- */
- ExecClearTuple(node->ps.ps_ResultTupleSlot);
-
/*
* shut down subplans
*/
if (node->tsmroutine->EndSampleScan)
node->tsmroutine->EndSampleScan(node);
- /*
- * Free the exprcontext
- */
- ExecFreeExprContext(&node->ss.ps);
-
- /*
- * clean out the tuple table
- */
- if (node->ss.ps.ps_ResultTupleSlot)
- ExecClearTuple(node->ss.ps.ps_ResultTupleSlot);
- ExecClearTuple(node->ss.ss_ScanTupleSlot);
-
/*
* close heap scan
*/
*/
scanDesc = node->ss.ss_currentScanDesc;
- /*
- * Free the exprcontext
- */
- ExecFreeExprContext(&node->ss.ps);
-
- /*
- * clean out the tuple table
- */
- if (node->ss.ps.ps_ResultTupleSlot)
- ExecClearTuple(node->ss.ps.ps_ResultTupleSlot);
- ExecClearTuple(node->ss.ss_ScanTupleSlot);
-
/*
* close heap scan
*/
void
ExecEndSetOp(SetOpState *node)
{
- /* clean up tuple table */
- ExecClearTuple(node->ps.ps_ResultTupleSlot);
-
/* free subsidiary stuff including hashtable */
if (node->tableContext)
MemoryContextDelete(node->tableContext);
- ExecFreeExprContext(&node->ps);
ExecEndNode(outerPlanState(node));
}
SO1_printf("ExecEndSort: %s\n",
"shutting down sort node");
- /*
- * clean out the tuple table
- */
- ExecClearTuple(node->ss.ss_ScanTupleSlot);
- /* must drop pointer to sort result tuple */
- ExecClearTuple(node->ss.ps.ps_ResultTupleSlot);
-
/*
* Release tuplesort resources
*/
void
ExecEndSubqueryScan(SubqueryScanState *node)
{
- /*
- * Free the exprcontext
- */
- ExecFreeExprContext(&node->ss.ps);
-
- /*
- * clean out the upper tuple table
- */
- if (node->ss.ps.ps_ResultTupleSlot)
- ExecClearTuple(node->ss.ps.ps_ResultTupleSlot);
- ExecClearTuple(node->ss.ss_ScanTupleSlot);
-
/*
* close down subquery
*/
void
ExecEndTableFuncScan(TableFuncScanState *node)
{
- /*
- * Free the exprcontext
- */
- ExecFreeExprContext(&node->ss.ps);
-
- /*
- * clean out the tuple table
- */
- if (node->ss.ps.ps_ResultTupleSlot)
- ExecClearTuple(node->ss.ps.ps_ResultTupleSlot);
- ExecClearTuple(node->ss.ss_ScanTupleSlot);
-
/*
* Release tuplestore resources
*/
if (scan != NULL)
table_endscan(scan);
-
- /*
- * Free the exprcontext
- */
- ExecFreeExprContext(&node->ss.ps);
-
- /*
- * clear out tuple table slots
- */
- if (node->ss.ps.ps_ResultTupleSlot)
- ExecClearTuple(node->ss.ps.ps_ResultTupleSlot);
- ExecClearTuple(node->ss.ss_ScanTupleSlot);
}
/* ----------------------------------------------------------------
{
if (node->ss.ss_currentScanDesc)
table_endscan(node->ss.ss_currentScanDesc);
-
- /*
- * Free the exprcontext
- */
- ExecFreeExprContext(&node->ss.ps);
-
- /*
- * clear out tuple table slots
- */
- if (node->ss.ps.ps_ResultTupleSlot)
- ExecClearTuple(node->ss.ps.ps_ResultTupleSlot);
- ExecClearTuple(node->ss.ss_ScanTupleSlot);
}
/* ----------------------------------------------------------------
void
ExecEndUnique(UniqueState *node)
{
- /* clean up tuple table */
- ExecClearTuple(node->ps.ps_ResultTupleSlot);
-
- ExecFreeExprContext(&node->ps);
-
ExecEndNode(outerPlanState(node));
}
return scanstate;
}
-/* ----------------------------------------------------------------
- * ExecEndValuesScan
- *
- * frees any storage allocated through C routines.
- * ----------------------------------------------------------------
- */
-void
-ExecEndValuesScan(ValuesScanState *node)
-{
- /*
- * Free both exprcontexts
- */
- ExecFreeExprContext(&node->ss.ps);
- node->ss.ps.ps_ExprContext = node->rowcontext;
- ExecFreeExprContext(&node->ss.ps);
-
- /*
- * clean out the tuple table
- */
- if (node->ss.ps.ps_ResultTupleSlot)
- ExecClearTuple(node->ss.ps.ps_ResultTupleSlot);
- ExecClearTuple(node->ss.ss_ScanTupleSlot);
-}
-
/* ----------------------------------------------------------------
* ExecReScanValuesScan
*
release_partition(node);
- ExecClearTuple(node->ss.ss_ScanTupleSlot);
- ExecClearTuple(node->first_part_slot);
- ExecClearTuple(node->agg_row_slot);
- ExecClearTuple(node->temp_slot_1);
- ExecClearTuple(node->temp_slot_2);
- if (node->framehead_slot)
- ExecClearTuple(node->framehead_slot);
- if (node->frametail_slot)
- ExecClearTuple(node->frametail_slot);
-
- /*
- * Free both the expr contexts.
- */
- ExecFreeExprContext(&node->ss.ps);
- node->ss.ps.ps_ExprContext = node->tmpcontext;
- ExecFreeExprContext(&node->ss.ps);
-
for (i = 0; i < node->numaggs; i++)
{
if (node->peragg[i].aggcontext != node->aggcontext)
return scanstate;
}
-/* ----------------------------------------------------------------
- * ExecEndWorkTableScan
- *
- * frees any storage allocated through C routines.
- * ----------------------------------------------------------------
- */
-void
-ExecEndWorkTableScan(WorkTableScanState *node)
-{
- /*
- * Free exprcontext
- */
- ExecFreeExprContext(&node->ss.ps);
-
- /*
- * clean out the tuple table
- */
- if (node->ss.ps.ps_ResultTupleSlot)
- ExecClearTuple(node->ss.ps.ps_ResultTupleSlot);
- ExecClearTuple(node->ss.ss_ScanTupleSlot);
-}
-
/* ----------------------------------------------------------------
* ExecReScanWorkTableScan
*
TupleDesc inputDesc);
extern void ExecConditionalAssignProjectionInfo(PlanState *planstate,
TupleDesc inputDesc, int varno);
-extern void ExecFreeExprContext(PlanState *planstate);
extern void ExecAssignScanType(ScanState *scanstate, TupleDesc tupDesc);
extern void ExecCreateScanSlotFromOuterPlan(EState *estate,
ScanState *scanstate,
#include "nodes/execnodes.h"
extern NamedTuplestoreScanState *ExecInitNamedTuplestoreScan(NamedTuplestoreScan *node, EState *estate, int eflags);
-extern void ExecEndNamedTuplestoreScan(NamedTuplestoreScanState *node);
extern void ExecReScanNamedTuplestoreScan(NamedTuplestoreScanState *node);
#endif /* NODENAMEDTUPLESTORESCAN_H */
#include "nodes/execnodes.h"
extern ValuesScanState *ExecInitValuesScan(ValuesScan *node, EState *estate, int eflags);
-extern void ExecEndValuesScan(ValuesScanState *node);
extern void ExecReScanValuesScan(ValuesScanState *node);
#endif /* NODEVALUESSCAN_H */
#include "nodes/execnodes.h"
extern WorkTableScanState *ExecInitWorkTableScan(WorkTableScan *node, EState *estate, int eflags);
-extern void ExecEndWorkTableScan(WorkTableScanState *node);
extern void ExecReScanWorkTableScan(WorkTableScanState *node);
#endif /* NODEWORKTABLESCAN_H */