PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
execProcnode.c File Reference
Include dependency graph for execProcnode.c:

Go to the source code of this file.

Functions

PlanStateExecInitNode (Plan *node, EState *estate, int eflags)
 
TupleTableSlotExecProcNode (PlanState *node)
 
NodeMultiExecProcNode (PlanState *node)
 
void ExecEndNode (PlanState *node)
 
bool ExecShutdownNode (PlanState *node)
 

Function Documentation

void ExecEndNode ( PlanState node)

Definition at line 644 of file execProcnode.c.

References bms_free(), PlanState::chgParam, elog, ERROR, ExecEndAgg(), ExecEndAppend(), ExecEndBitmapAnd(), ExecEndBitmapHeapScan(), ExecEndBitmapIndexScan(), ExecEndBitmapOr(), ExecEndCteScan(), ExecEndCustomScan(), ExecEndForeignScan(), ExecEndFunctionScan(), ExecEndGather(), ExecEndGatherMerge(), ExecEndGroup(), ExecEndHash(), ExecEndHashJoin(), ExecEndIndexOnlyScan(), ExecEndIndexScan(), ExecEndLimit(), ExecEndLockRows(), ExecEndMaterial(), ExecEndMergeAppend(), ExecEndMergeJoin(), ExecEndModifyTable(), ExecEndNestLoop(), ExecEndProjectSet(), ExecEndRecursiveUnion(), ExecEndResult(), ExecEndSampleScan(), ExecEndSeqScan(), ExecEndSetOp(), ExecEndSort(), ExecEndSubqueryScan(), ExecEndTableFuncScan(), ExecEndTidScan(), ExecEndUnique(), ExecEndValuesScan(), ExecEndWindowAgg(), ExecEndWorkTableScan(), nodeTag, NULL, T_AggState, T_AppendState, T_BitmapAndState, T_BitmapHeapScanState, T_BitmapIndexScanState, T_BitmapOrState, T_CteScanState, T_CustomScanState, T_ForeignScanState, T_FunctionScanState, T_GatherMergeState, T_GatherState, T_GroupState, T_HashJoinState, T_HashState, T_IndexOnlyScanState, T_IndexScanState, T_LimitState, T_LockRowsState, T_MaterialState, T_MergeAppendState, T_MergeJoinState, T_ModifyTableState, T_NestLoopState, T_ProjectSetState, T_RecursiveUnionState, T_ResultState, T_SampleScanState, T_SeqScanState, T_SetOpState, T_SortState, T_SubqueryScanState, T_TableFuncScanState, T_TidScanState, T_UniqueState, T_ValuesScanState, T_WindowAggState, and T_WorkTableScanState.

Referenced by EvalPlanQualEnd(), ExecEndAgg(), ExecEndAppend(), ExecEndBitmapAnd(), ExecEndBitmapHeapScan(), ExecEndBitmapOr(), ExecEndForeignScan(), ExecEndGather(), ExecEndGatherMerge(), ExecEndGroup(), ExecEndHash(), ExecEndHashJoin(), ExecEndLimit(), ExecEndLockRows(), ExecEndMaterial(), ExecEndMergeAppend(), ExecEndMergeJoin(), ExecEndModifyTable(), ExecEndNestLoop(), ExecEndPlan(), ExecEndProjectSet(), ExecEndRecursiveUnion(), ExecEndResult(), ExecEndSetOp(), ExecEndSort(), ExecEndSubqueryScan(), ExecEndUnique(), and ExecEndWindowAgg().

645 {
646  /*
647  * do nothing when we get to the end of a leaf on tree.
648  */
649  if (node == NULL)
650  return;
651 
652  if (node->chgParam != NULL)
653  {
654  bms_free(node->chgParam);
655  node->chgParam = NULL;
656  }
657 
658  switch (nodeTag(node))
659  {
660  /*
661  * control nodes
662  */
663  case T_ResultState:
664  ExecEndResult((ResultState *) node);
665  break;
666 
667  case T_ProjectSetState:
669  break;
670 
671  case T_ModifyTableState:
673  break;
674 
675  case T_AppendState:
676  ExecEndAppend((AppendState *) node);
677  break;
678 
679  case T_MergeAppendState:
681  break;
682 
685  break;
686 
687  case T_BitmapAndState:
689  break;
690 
691  case T_BitmapOrState:
692  ExecEndBitmapOr((BitmapOrState *) node);
693  break;
694 
695  /*
696  * scan nodes
697  */
698  case T_SeqScanState:
699  ExecEndSeqScan((SeqScanState *) node);
700  break;
701 
702  case T_SampleScanState:
704  break;
705 
706  case T_GatherState:
707  ExecEndGather((GatherState *) node);
708  break;
709 
710  case T_GatherMergeState:
712  break;
713 
714  case T_IndexScanState:
716  break;
717 
720  break;
721 
724  break;
725 
728  break;
729 
730  case T_TidScanState:
731  ExecEndTidScan((TidScanState *) node);
732  break;
733 
734  case T_SubqueryScanState:
736  break;
737 
738  case T_FunctionScanState:
740  break;
741 
744  break;
745 
746  case T_ValuesScanState:
748  break;
749 
750  case T_CteScanState:
751  ExecEndCteScan((CteScanState *) node);
752  break;
753 
756  break;
757 
758  case T_ForeignScanState:
760  break;
761 
762  case T_CustomScanState:
764  break;
765 
766  /*
767  * join nodes
768  */
769  case T_NestLoopState:
770  ExecEndNestLoop((NestLoopState *) node);
771  break;
772 
773  case T_MergeJoinState:
775  break;
776 
777  case T_HashJoinState:
778  ExecEndHashJoin((HashJoinState *) node);
779  break;
780 
781  /*
782  * materialization nodes
783  */
784  case T_MaterialState:
785  ExecEndMaterial((MaterialState *) node);
786  break;
787 
788  case T_SortState:
789  ExecEndSort((SortState *) node);
790  break;
791 
792  case T_GroupState:
793  ExecEndGroup((GroupState *) node);
794  break;
795 
796  case T_AggState:
797  ExecEndAgg((AggState *) node);
798  break;
799 
800  case T_WindowAggState:
802  break;
803 
804  case T_UniqueState:
805  ExecEndUnique((UniqueState *) node);
806  break;
807 
808  case T_HashState:
809  ExecEndHash((HashState *) node);
810  break;
811 
812  case T_SetOpState:
813  ExecEndSetOp((SetOpState *) node);
814  break;
815 
816  case T_LockRowsState:
817  ExecEndLockRows((LockRowsState *) node);
818  break;
819 
820  case T_LimitState:
821  ExecEndLimit((LimitState *) node);
822  break;
823 
824  default:
825  elog(ERROR, "unrecognized node type: %d", (int) nodeTag(node));
826  break;
827  }
828 }
void ExecEndGroup(GroupState *node)
Definition: nodeGroup.c:230
void ExecEndSetOp(SetOpState *node)
Definition: nodeSetOp.c:575
void ExecEndFunctionScan(FunctionScanState *node)
void ExecEndNestLoop(NestLoopState *node)
Definition: nodeNestloop.c:358
void ExecEndIndexScan(IndexScanState *node)
void ExecEndLimit(LimitState *node)
Definition: nodeLimit.c:426
void ExecEndUnique(UniqueState *node)
Definition: nodeUnique.c:173
void ExecEndGatherMerge(GatherMergeState *node)
void ExecEndWorkTableScan(WorkTableScanState *node)
void ExecEndLockRows(LockRowsState *node)
Definition: nodeLockRows.c:446
void ExecEndBitmapAnd(BitmapAndState *node)
void ExecEndRecursiveUnion(RecursiveUnionState *node)
void ExecEndSubqueryScan(SubqueryScanState *node)
void ExecEndHashJoin(HashJoinState *node)
Definition: nodeHashjoin.c:549
void ExecEndTableFuncScan(TableFuncScanState *node)
void ExecEndResult(ResultState *node)
Definition: nodeResult.c:247
#define ERROR
Definition: elog.h:43
void ExecEndAppend(AppendState *node)
Definition: nodeAppend.c:252
void ExecEndForeignScan(ForeignScanState *node)
void ExecEndSort(SortState *node)
Definition: nodeSort.c:223
void ExecEndBitmapIndexScan(BitmapIndexScanState *node)
void ExecEndValuesScan(ValuesScanState *node)
void ExecEndMergeJoin(MergeJoinState *node)
void ExecEndSeqScan(SeqScanState *node)
Definition: nodeSeqscan.c:225
void ExecEndIndexOnlyScan(IndexOnlyScanState *node)
void ExecEndTidScan(TidScanState *node)
Definition: nodeTidscan.c:420
Bitmapset * chgParam
Definition: execnodes.h:1074
void ExecEndCteScan(CteScanState *node)
Definition: nodeCtescan.c:281
void ExecEndCustomScan(CustomScanState *node)
Definition: nodeCustom.c:116
void ExecEndBitmapOr(BitmapOrState *node)
Definition: nodeBitmapOr.c:182
void ExecEndSampleScan(SampleScanState *node)
void bms_free(Bitmapset *a)
Definition: bitmapset.c:200
void ExecEndWindowAgg(WindowAggState *node)
#define NULL
Definition: c.h:229
void ExecEndMergeAppend(MergeAppendState *node)
#define nodeTag(nodeptr)
Definition: nodes.h:523
void ExecEndHash(HashState *node)
Definition: nodeHash.c:222
void ExecEndProjectSet(ProjectSetState *node)
void ExecEndMaterial(MaterialState *node)
Definition: nodeMaterial.c:240
#define elog
Definition: elog.h:219
void ExecEndBitmapHeapScan(BitmapHeapScanState *node)
void ExecEndAgg(AggState *node)
Definition: nodeAgg.c:3487
void ExecEndModifyTable(ModifyTableState *node)
void ExecEndGather(GatherState *node)
Definition: nodeGather.c:230
PlanState* ExecInitNode ( Plan node,
EState estate,
int  eflags 
)

Definition at line 139 of file execProcnode.c.

References Assert, elog, ERROR, EState::es_instrument, ExecInitAgg(), ExecInitAppend(), ExecInitBitmapAnd(), ExecInitBitmapHeapScan(), ExecInitBitmapIndexScan(), ExecInitBitmapOr(), ExecInitCteScan(), ExecInitCustomScan(), ExecInitForeignScan(), ExecInitFunctionScan(), ExecInitGather(), ExecInitGatherMerge(), ExecInitGroup(), ExecInitHash(), ExecInitHashJoin(), ExecInitIndexOnlyScan(), ExecInitIndexScan(), ExecInitLimit(), ExecInitLockRows(), ExecInitMaterial(), ExecInitMergeAppend(), ExecInitMergeJoin(), ExecInitModifyTable(), ExecInitNestLoop(), ExecInitProjectSet(), ExecInitRecursiveUnion(), ExecInitResult(), ExecInitSampleScan(), ExecInitSeqScan(), ExecInitSetOp(), ExecInitSort(), ExecInitSubPlan(), ExecInitSubqueryScan(), ExecInitTableFuncScan(), ExecInitTidScan(), ExecInitUnique(), ExecInitValuesScan(), ExecInitWindowAgg(), ExecInitWorkTableScan(), Plan::initPlan, PlanState::initPlan, InstrAlloc(), PlanState::instrument, IsA, lappend(), lfirst, NIL, nodeTag, NULL, T_Agg, T_Append, T_BitmapAnd, T_BitmapHeapScan, T_BitmapIndexScan, T_BitmapOr, T_CteScan, T_CustomScan, T_ForeignScan, T_FunctionScan, T_Gather, T_GatherMerge, T_Group, T_Hash, T_HashJoin, T_IndexOnlyScan, T_IndexScan, T_Limit, T_LockRows, T_Material, T_MergeAppend, T_MergeJoin, T_ModifyTable, T_NestLoop, T_ProjectSet, T_RecursiveUnion, T_Result, T_SampleScan, T_SeqScan, T_SetOp, T_Sort, T_SubqueryScan, T_TableFuncScan, T_TidScan, T_Unique, T_ValuesScan, T_WindowAgg, and T_WorkTableScan.

Referenced by EvalPlanQualStart(), ExecInitAgg(), ExecInitAppend(), ExecInitBitmapAnd(), ExecInitBitmapHeapScan(), ExecInitBitmapOr(), ExecInitForeignScan(), ExecInitGather(), ExecInitGatherMerge(), ExecInitGroup(), ExecInitHash(), ExecInitHashJoin(), ExecInitLimit(), ExecInitLockRows(), ExecInitMaterial(), ExecInitMergeAppend(), ExecInitMergeJoin(), ExecInitModifyTable(), ExecInitNestLoop(), ExecInitProjectSet(), ExecInitRecursiveUnion(), ExecInitResult(), ExecInitSetOp(), ExecInitSort(), ExecInitSubqueryScan(), ExecInitUnique(), ExecInitWindowAgg(), and InitPlan().

140 {
141  PlanState *result;
142  List *subps;
143  ListCell *l;
144 
145  /*
146  * do nothing when we get to the end of a leaf on tree.
147  */
148  if (node == NULL)
149  return NULL;
150 
151  switch (nodeTag(node))
152  {
153  /*
154  * control nodes
155  */
156  case T_Result:
157  result = (PlanState *) ExecInitResult((Result *) node,
158  estate, eflags);
159  break;
160 
161  case T_ProjectSet:
162  result = (PlanState *) ExecInitProjectSet((ProjectSet *) node,
163  estate, eflags);
164  break;
165 
166  case T_ModifyTable:
167  result = (PlanState *) ExecInitModifyTable((ModifyTable *) node,
168  estate, eflags);
169  break;
170 
171  case T_Append:
172  result = (PlanState *) ExecInitAppend((Append *) node,
173  estate, eflags);
174  break;
175 
176  case T_MergeAppend:
177  result = (PlanState *) ExecInitMergeAppend((MergeAppend *) node,
178  estate, eflags);
179  break;
180 
181  case T_RecursiveUnion:
182  result = (PlanState *) ExecInitRecursiveUnion((RecursiveUnion *) node,
183  estate, eflags);
184  break;
185 
186  case T_BitmapAnd:
187  result = (PlanState *) ExecInitBitmapAnd((BitmapAnd *) node,
188  estate, eflags);
189  break;
190 
191  case T_BitmapOr:
192  result = (PlanState *) ExecInitBitmapOr((BitmapOr *) node,
193  estate, eflags);
194  break;
195 
196  /*
197  * scan nodes
198  */
199  case T_SeqScan:
200  result = (PlanState *) ExecInitSeqScan((SeqScan *) node,
201  estate, eflags);
202  break;
203 
204  case T_SampleScan:
205  result = (PlanState *) ExecInitSampleScan((SampleScan *) node,
206  estate, eflags);
207  break;
208 
209  case T_IndexScan:
210  result = (PlanState *) ExecInitIndexScan((IndexScan *) node,
211  estate, eflags);
212  break;
213 
214  case T_IndexOnlyScan:
215  result = (PlanState *) ExecInitIndexOnlyScan((IndexOnlyScan *) node,
216  estate, eflags);
217  break;
218 
219  case T_BitmapIndexScan:
220  result = (PlanState *) ExecInitBitmapIndexScan((BitmapIndexScan *) node,
221  estate, eflags);
222  break;
223 
224  case T_BitmapHeapScan:
225  result = (PlanState *) ExecInitBitmapHeapScan((BitmapHeapScan *) node,
226  estate, eflags);
227  break;
228 
229  case T_TidScan:
230  result = (PlanState *) ExecInitTidScan((TidScan *) node,
231  estate, eflags);
232  break;
233 
234  case T_SubqueryScan:
235  result = (PlanState *) ExecInitSubqueryScan((SubqueryScan *) node,
236  estate, eflags);
237  break;
238 
239  case T_FunctionScan:
240  result = (PlanState *) ExecInitFunctionScan((FunctionScan *) node,
241  estate, eflags);
242  break;
243 
244  case T_TableFuncScan:
245  result = (PlanState *) ExecInitTableFuncScan((TableFuncScan *) node,
246  estate, eflags);
247  break;
248 
249  case T_ValuesScan:
250  result = (PlanState *) ExecInitValuesScan((ValuesScan *) node,
251  estate, eflags);
252  break;
253 
254  case T_CteScan:
255  result = (PlanState *) ExecInitCteScan((CteScan *) node,
256  estate, eflags);
257  break;
258 
259  case T_WorkTableScan:
260  result = (PlanState *) ExecInitWorkTableScan((WorkTableScan *) node,
261  estate, eflags);
262  break;
263 
264  case T_ForeignScan:
265  result = (PlanState *) ExecInitForeignScan((ForeignScan *) node,
266  estate, eflags);
267  break;
268 
269  case T_CustomScan:
270  result = (PlanState *) ExecInitCustomScan((CustomScan *) node,
271  estate, eflags);
272  break;
273 
274  /*
275  * join nodes
276  */
277  case T_NestLoop:
278  result = (PlanState *) ExecInitNestLoop((NestLoop *) node,
279  estate, eflags);
280  break;
281 
282  case T_MergeJoin:
283  result = (PlanState *) ExecInitMergeJoin((MergeJoin *) node,
284  estate, eflags);
285  break;
286 
287  case T_HashJoin:
288  result = (PlanState *) ExecInitHashJoin((HashJoin *) node,
289  estate, eflags);
290  break;
291 
292  /*
293  * materialization nodes
294  */
295  case T_Material:
296  result = (PlanState *) ExecInitMaterial((Material *) node,
297  estate, eflags);
298  break;
299 
300  case T_Sort:
301  result = (PlanState *) ExecInitSort((Sort *) node,
302  estate, eflags);
303  break;
304 
305  case T_Group:
306  result = (PlanState *) ExecInitGroup((Group *) node,
307  estate, eflags);
308  break;
309 
310  case T_Agg:
311  result = (PlanState *) ExecInitAgg((Agg *) node,
312  estate, eflags);
313  break;
314 
315  case T_WindowAgg:
316  result = (PlanState *) ExecInitWindowAgg((WindowAgg *) node,
317  estate, eflags);
318  break;
319 
320  case T_Unique:
321  result = (PlanState *) ExecInitUnique((Unique *) node,
322  estate, eflags);
323  break;
324 
325  case T_Gather:
326  result = (PlanState *) ExecInitGather((Gather *) node,
327  estate, eflags);
328  break;
329 
330  case T_GatherMerge:
331  result = (PlanState *) ExecInitGatherMerge((GatherMerge *) node,
332  estate, eflags);
333  break;
334 
335  case T_Hash:
336  result = (PlanState *) ExecInitHash((Hash *) node,
337  estate, eflags);
338  break;
339 
340  case T_SetOp:
341  result = (PlanState *) ExecInitSetOp((SetOp *) node,
342  estate, eflags);
343  break;
344 
345  case T_LockRows:
346  result = (PlanState *) ExecInitLockRows((LockRows *) node,
347  estate, eflags);
348  break;
349 
350  case T_Limit:
351  result = (PlanState *) ExecInitLimit((Limit *) node,
352  estate, eflags);
353  break;
354 
355  default:
356  elog(ERROR, "unrecognized node type: %d", (int) nodeTag(node));
357  result = NULL; /* keep compiler quiet */
358  break;
359  }
360 
361  /*
362  * Initialize any initPlans present in this node. The planner put them in
363  * a separate list for us.
364  */
365  subps = NIL;
366  foreach(l, node->initPlan)
367  {
368  SubPlan *subplan = (SubPlan *) lfirst(l);
369  SubPlanState *sstate;
370 
371  Assert(IsA(subplan, SubPlan));
372  sstate = ExecInitSubPlan(subplan, result);
373  subps = lappend(subps, sstate);
374  }
375  result->initPlan = subps;
376 
377  /* Set up instrumentation for this node if requested */
378  if (estate->es_instrument)
379  result->instrument = InstrAlloc(1, estate->es_instrument);
380 
381  return result;
382 }
MergeJoinState * ExecInitMergeJoin(MergeJoin *node, EState *estate, int eflags)
#define NIL
Definition: pg_list.h:69
Definition: nodes.h:76
SortState * ExecInitSort(Sort *node, EState *estate, int eflags)
Definition: nodeSort.c:152
#define IsA(nodeptr, _type_)
Definition: nodes.h:569
BitmapHeapScanState * ExecInitBitmapHeapScan(BitmapHeapScan *node, EState *estate, int eflags)
Definition: nodes.h:78
Instrumentation * instrument
Definition: execnodes.h:1055
GroupState * ExecInitGroup(Group *node, EState *estate, int eflags)
Definition: nodeGroup.c:162
MergeAppendState * ExecInitMergeAppend(MergeAppend *node, EState *estate, int eflags)
GatherMergeState * ExecInitGatherMerge(GatherMerge *node, EState *estate, int eflags)
List * initPlan
Definition: execnodes.h:1067
RecursiveUnionState * ExecInitRecursiveUnion(RecursiveUnion *node, EState *estate, int eflags)
NestLoopState * ExecInitNestLoop(NestLoop *node, EState *estate, int eflags)
Definition: nodeNestloop.c:258
LockRowsState * ExecInitLockRows(LockRows *node, EState *estate, int eflags)
Definition: nodeLockRows.c:348
HashState * ExecInitHash(Hash *node, EState *estate, int eflags)
Definition: nodeHash.c:162
CteScanState * ExecInitCteScan(CteScan *node, EState *estate, int eflags)
Definition: nodeCtescan.c:166
Definition: nodes.h:48
Instrumentation * InstrAlloc(int n, int instrument_options)
Definition: instrument.c:30
AppendState * ExecInitAppend(Append *node, EState *estate, int eflags)
Definition: nodeAppend.c:120
Definition: nodes.h:74
GatherState * ExecInitGather(Gather *node, EState *estate, int eflags)
Definition: nodeGather.c:56
SubPlanState * ExecInitSubPlan(SubPlan *subplan, PlanState *parent)
Definition: nodeSubplan.c:692
AggState * ExecInitAgg(Agg *node, EState *estate, int eflags)
Definition: nodeAgg.c:2395
TidScanState * ExecInitTidScan(TidScan *node, EState *estate, int eflags)
Definition: nodeTidscan.c:451
Definition: nodes.h:45
#define ERROR
Definition: elog.h:43
IndexScanState * ExecInitIndexScan(IndexScan *node, EState *estate, int eflags)
CustomScanState * ExecInitCustomScan(CustomScan *cscan, EState *estate, int eflags)
Definition: nodeCustom.c:24
BitmapIndexScanState * ExecInitBitmapIndexScan(BitmapIndexScan *node, EState *estate, int eflags)
Definition: nodes.h:75
SampleScanState * ExecInitSampleScan(SampleScan *node, EState *estate, int eflags)
ModifyTableState * ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags)
SubqueryScanState * ExecInitSubqueryScan(SubqueryScan *node, EState *estate, int eflags)
SetOpState * ExecInitSetOp(SetOp *node, EState *estate, int eflags)
Definition: nodeSetOp.c:470
FunctionScanState * ExecInitFunctionScan(FunctionScan *node, EState *estate, int eflags)
List * lappend(List *list, void *datum)
Definition: list.c:128
ValuesScanState * ExecInitValuesScan(ValuesScan *node, EState *estate, int eflags)
BitmapAndState * ExecInitBitmapAnd(BitmapAnd *node, EState *estate, int eflags)
Definition: nodeBitmapAnd.c:42
HashJoinState * ExecInitHashJoin(HashJoin *node, EState *estate, int eflags)
Definition: nodeHashjoin.c:384
UniqueState * ExecInitUnique(Unique *node, EState *estate, int eflags)
Definition: nodeUnique.c:112
Definition: nodes.h:81
BitmapOrState * ExecInitBitmapOr(BitmapOr *node, EState *estate, int eflags)
Definition: nodeBitmapOr.c:43
#define NULL
Definition: c.h:229
IndexOnlyScanState * ExecInitIndexOnlyScan(IndexOnlyScan *node, EState *estate, int eflags)
#define Assert(condition)
Definition: c.h:675
#define lfirst(lc)
Definition: pg_list.h:106
ResultState * ExecInitResult(Result *node, EState *estate, int eflags)
Definition: nodeResult.c:179
WindowAggState * ExecInitWindowAgg(WindowAgg *node, EState *estate, int eflags)
ProjectSetState * ExecInitProjectSet(ProjectSet *node, EState *estate, int eflags)
#define nodeTag(nodeptr)
Definition: nodes.h:523
Definition: nodes.h:82
TableFuncScanState * ExecInitTableFuncScan(TableFuncScan *node, EState *estate, int eflags)
ForeignScanState * ExecInitForeignScan(ForeignScan *node, EState *estate, int eflags)
SeqScanState * ExecInitSeqScan(SeqScan *node, EState *estate, int eflags)
Definition: nodeSeqscan.c:163
List * initPlan
Definition: plannodes.h:136
Definition: nodes.h:79
LimitState * ExecInitLimit(Limit *node, EState *estate, int eflags)
Definition: nodeLimit.c:364
WorkTableScanState * ExecInitWorkTableScan(WorkTableScan *node, EState *estate, int eflags)
Definition: plannodes.h:751
#define elog
Definition: elog.h:219
Definition: pg_list.h:45
MaterialState * ExecInitMaterial(Material *node, EState *estate, int eflags)
Definition: nodeMaterial.c:163
Definition: nodes.h:84
TupleTableSlot* ExecProcNode ( PlanState node)

Definition at line 392 of file execProcnode.c.

References CHECK_FOR_INTERRUPTS, PlanState::chgParam, elog, ERROR, ExecAgg(), ExecAppend(), ExecBitmapHeapScan(), ExecCteScan(), ExecCustomScan(), ExecForeignScan(), ExecFunctionScan(), ExecGather(), ExecGatherMerge(), ExecGroup(), ExecHash(), ExecHashJoin(), ExecIndexOnlyScan(), ExecIndexScan(), ExecLimit(), ExecLockRows(), ExecMaterial(), ExecMergeAppend(), ExecMergeJoin(), ExecModifyTable(), ExecNestLoop(), ExecProjectSet(), ExecRecursiveUnion(), ExecReScan(), ExecResult(), ExecSampleScan(), ExecSeqScan(), ExecSetOp(), ExecSort(), ExecSubqueryScan(), ExecTableFuncScan(), ExecTidScan(), ExecUnique(), ExecValuesScan(), ExecWindowAgg(), ExecWorkTableScan(), InstrStartNode(), InstrStopNode(), PlanState::instrument, nodeTag, NULL, T_AggState, T_AppendState, T_BitmapHeapScanState, T_CteScanState, T_CustomScanState, T_ForeignScanState, T_FunctionScanState, T_GatherMergeState, T_GatherState, T_GroupState, T_HashJoinState, T_HashState, T_IndexOnlyScanState, T_IndexScanState, T_LimitState, T_LockRowsState, T_MaterialState, T_MergeAppendState, T_MergeJoinState, T_ModifyTableState, T_NestLoopState, T_ProjectSetState, T_RecursiveUnionState, T_ResultState, T_SampleScanState, T_SeqScanState, T_SetOpState, T_SortState, T_SubqueryScanState, T_TableFuncScanState, T_TidScanState, T_UniqueState, T_ValuesScanState, T_WindowAggState, T_WorkTableScanState, and TupIsNull.

Referenced by begin_partition(), buildSubPlanHash(), CteScanNext(), EvalPlanQualNext(), ExecAppend(), ExecGroup(), ExecHashJoin(), ExecHashJoinOuterGetTuple(), ExecLimit(), ExecLockRows(), ExecMaterial(), ExecMergeAppend(), ExecMergeJoin(), ExecModifyTable(), ExecNestLoop(), ExecPostprocessPlan(), ExecProjectSet(), ExecRecursiveUnion(), ExecResult(), ExecScanSubPlan(), ExecSetParamPlan(), ExecSort(), ExecUnique(), ExecutePlan(), fetch_input_tuple(), gather_getnext(), gather_merge_readnext(), MultiExecHash(), postgresRecheckForeignScan(), setop_fill_hash_table(), setop_retrieve_direct(), spool_tuples(), and SubqueryNext().

393 {
394  TupleTableSlot *result;
395 
397 
398  if (node->chgParam != NULL) /* something changed */
399  ExecReScan(node); /* let ReScan handle this */
400 
401  if (node->instrument)
402  InstrStartNode(node->instrument);
403 
404  switch (nodeTag(node))
405  {
406  /*
407  * control nodes
408  */
409  case T_ResultState:
410  result = ExecResult((ResultState *) node);
411  break;
412 
413  case T_ProjectSetState:
414  result = ExecProjectSet((ProjectSetState *) node);
415  break;
416 
417  case T_ModifyTableState:
418  result = ExecModifyTable((ModifyTableState *) node);
419  break;
420 
421  case T_AppendState:
422  result = ExecAppend((AppendState *) node);
423  break;
424 
425  case T_MergeAppendState:
426  result = ExecMergeAppend((MergeAppendState *) node);
427  break;
428 
430  result = ExecRecursiveUnion((RecursiveUnionState *) node);
431  break;
432 
433  /* BitmapAndState does not yield tuples */
434 
435  /* BitmapOrState does not yield tuples */
436 
437  /*
438  * scan nodes
439  */
440  case T_SeqScanState:
441  result = ExecSeqScan((SeqScanState *) node);
442  break;
443 
444  case T_SampleScanState:
445  result = ExecSampleScan((SampleScanState *) node);
446  break;
447 
448  case T_IndexScanState:
449  result = ExecIndexScan((IndexScanState *) node);
450  break;
451 
453  result = ExecIndexOnlyScan((IndexOnlyScanState *) node);
454  break;
455 
456  /* BitmapIndexScanState does not yield tuples */
457 
459  result = ExecBitmapHeapScan((BitmapHeapScanState *) node);
460  break;
461 
462  case T_TidScanState:
463  result = ExecTidScan((TidScanState *) node);
464  break;
465 
466  case T_SubqueryScanState:
467  result = ExecSubqueryScan((SubqueryScanState *) node);
468  break;
469 
470  case T_FunctionScanState:
471  result = ExecFunctionScan((FunctionScanState *) node);
472  break;
473 
475  result = ExecTableFuncScan((TableFuncScanState *) node);
476  break;
477 
478  case T_ValuesScanState:
479  result = ExecValuesScan((ValuesScanState *) node);
480  break;
481 
482  case T_CteScanState:
483  result = ExecCteScan((CteScanState *) node);
484  break;
485 
487  result = ExecWorkTableScan((WorkTableScanState *) node);
488  break;
489 
490  case T_ForeignScanState:
491  result = ExecForeignScan((ForeignScanState *) node);
492  break;
493 
494  case T_CustomScanState:
495  result = ExecCustomScan((CustomScanState *) node);
496  break;
497 
498  /*
499  * join nodes
500  */
501  case T_NestLoopState:
502  result = ExecNestLoop((NestLoopState *) node);
503  break;
504 
505  case T_MergeJoinState:
506  result = ExecMergeJoin((MergeJoinState *) node);
507  break;
508 
509  case T_HashJoinState:
510  result = ExecHashJoin((HashJoinState *) node);
511  break;
512 
513  /*
514  * materialization nodes
515  */
516  case T_MaterialState:
517  result = ExecMaterial((MaterialState *) node);
518  break;
519 
520  case T_SortState:
521  result = ExecSort((SortState *) node);
522  break;
523 
524  case T_GroupState:
525  result = ExecGroup((GroupState *) node);
526  break;
527 
528  case T_AggState:
529  result = ExecAgg((AggState *) node);
530  break;
531 
532  case T_WindowAggState:
533  result = ExecWindowAgg((WindowAggState *) node);
534  break;
535 
536  case T_UniqueState:
537  result = ExecUnique((UniqueState *) node);
538  break;
539 
540  case T_GatherState:
541  result = ExecGather((GatherState *) node);
542  break;
543 
544  case T_GatherMergeState:
545  result = ExecGatherMerge((GatherMergeState *) node);
546  break;
547 
548  case T_HashState:
549  result = ExecHash((HashState *) node);
550  break;
551 
552  case T_SetOpState:
553  result = ExecSetOp((SetOpState *) node);
554  break;
555 
556  case T_LockRowsState:
557  result = ExecLockRows((LockRowsState *) node);
558  break;
559 
560  case T_LimitState:
561  result = ExecLimit((LimitState *) node);
562  break;
563 
564  default:
565  elog(ERROR, "unrecognized node type: %d", (int) nodeTag(node));
566  result = NULL;
567  break;
568  }
569 
570  if (node->instrument)
571  InstrStopNode(node->instrument, TupIsNull(result) ? 0.0 : 1.0);
572 
573  return result;
574 }
void InstrStopNode(Instrumentation *instr, double nTuples)
Definition: instrument.c:80
TupleTableSlot * ExecModifyTable(ModifyTableState *node)
TupleTableSlot * ExecTidScan(TidScanState *node)
Definition: nodeTidscan.c:389
TupleTableSlot * ExecTableFuncScan(TableFuncScanState *node)
TupleTableSlot * ExecSampleScan(SampleScanState *node)
TupleTableSlot * ExecValuesScan(ValuesScanState *node)
Instrumentation * instrument
Definition: execnodes.h:1055
TupleTableSlot * ExecGroup(GroupState *node)
Definition: nodeGroup.c:35
TupleTableSlot * ExecAgg(AggState *node)
Definition: nodeAgg.c:1899
void ExecReScan(PlanState *node)
Definition: execAmi.c:74
TupleTableSlot * ExecRecursiveUnion(RecursiveUnionState *node)
TupleTableSlot * ExecFunctionScan(FunctionScanState *node)
TupleTableSlot * ExecResult(ResultState *node)
Definition: nodeResult.c:67
TupleTableSlot * ExecGatherMerge(GatherMergeState *node)
TupleTableSlot * ExecIndexOnlyScan(IndexOnlyScanState *node)
TupleTableSlot * ExecCustomScan(CustomScanState *node)
Definition: nodeCustom.c:109
TupleTableSlot * ExecMaterial(MaterialState *node)
Definition: nodeMaterial.c:39
TupleTableSlot * ExecIndexScan(IndexScanState *node)
TupleTableSlot * ExecWindowAgg(WindowAggState *winstate)
#define ERROR
Definition: elog.h:43
TupleTableSlot * ExecForeignScan(ForeignScanState *node)
void InstrStartNode(Instrumentation *instr)
Definition: instrument.c:63
TupleTableSlot * ExecMergeAppend(MergeAppendState *node)
TupleTableSlot * ExecSubqueryScan(SubqueryScanState *node)
TupleTableSlot * ExecLockRows(LockRowsState *node)
Definition: nodeLockRows.c:39
#define TupIsNull(slot)
Definition: tuptable.h:138
TupleTableSlot * ExecNestLoop(NestLoopState *node)
Definition: nodeNestloop.c:60
TupleTableSlot * ExecProjectSet(ProjectSetState *node)
Bitmapset * chgParam
Definition: execnodes.h:1074
TupleTableSlot * ExecWorkTableScan(WorkTableScanState *node)
TupleTableSlot * ExecLimit(LimitState *node)
Definition: nodeLimit.c:40
#define NULL
Definition: c.h:229
TupleTableSlot * ExecMergeJoin(MergeJoinState *node)
TupleTableSlot * ExecBitmapHeapScan(BitmapHeapScanState *node)
#define nodeTag(nodeptr)
Definition: nodes.h:523
TupleTableSlot * ExecUnique(UniqueState *node)
Definition: nodeUnique.c:46
TupleTableSlot * ExecSeqScan(SeqScanState *node)
Definition: nodeSeqscan.c:125
TupleTableSlot * ExecHashJoin(HashJoinState *node)
Definition: nodeHashjoin.c:62
TupleTableSlot * ExecGather(GatherState *node)
Definition: nodeGather.c:128
TupleTableSlot * ExecSetOp(SetOpState *node)
Definition: nodeSetOp.c:183
TupleTableSlot * ExecCteScan(CteScanState *node)
Definition: nodeCtescan.c:153
TupleTableSlot * ExecSort(SortState *node)
Definition: nodeSort.c:39
#define CHECK_FOR_INTERRUPTS()
Definition: miscadmin.h:97
#define elog
Definition: elog.h:219
TupleTableSlot * ExecHash(HashState *node)
Definition: nodeHash.c:60
TupleTableSlot * ExecAppend(AppendState *node)
Definition: nodeAppend.c:200
bool ExecShutdownNode ( PlanState node)

Definition at line 841 of file execProcnode.c.

References ExecShutdownCustomScan(), ExecShutdownForeignScan(), ExecShutdownGather(), ExecShutdownGatherMerge(), ExecShutdownNode(), nodeTag, NULL, planstate_tree_walker(), T_CustomScanState, T_ForeignScanState, T_GatherMergeState, and T_GatherState.

Referenced by ExecShutdownNode(), and ExecutePlan().

842 {
843  if (node == NULL)
844  return false;
845 
847 
848  switch (nodeTag(node))
849  {
850  case T_GatherState:
852  break;
853  case T_ForeignScanState:
855  break;
856  case T_CustomScanState:
858  break;
859  case T_GatherMergeState:
861  break;
862  default:
863  break;
864  }
865 
866  return false;
867 }
bool ExecShutdownNode(PlanState *node)
Definition: execProcnode.c:841
void ExecShutdownCustomScan(CustomScanState *node)
Definition: nodeCustom.c:207
void ExecShutdownGather(GatherState *node)
Definition: nodeGather.c:404
void ExecShutdownGatherMerge(GatherMergeState *node)
#define NULL
Definition: c.h:229
#define nodeTag(nodeptr)
Definition: nodes.h:523
void ExecShutdownForeignScan(ForeignScanState *node)
bool planstate_tree_walker(PlanState *planstate, bool(*walker)(), void *context)
Definition: nodeFuncs.c:3705
Node* MultiExecProcNode ( PlanState node)

Definition at line 591 of file execProcnode.c.

References CHECK_FOR_INTERRUPTS, PlanState::chgParam, elog, ERROR, ExecReScan(), MultiExecBitmapAnd(), MultiExecBitmapIndexScan(), MultiExecBitmapOr(), MultiExecHash(), nodeTag, NULL, T_BitmapAndState, T_BitmapIndexScanState, T_BitmapOrState, and T_HashState.

Referenced by BitmapHeapNext(), ExecHashJoin(), MultiExecBitmapAnd(), and MultiExecBitmapOr().

592 {
593  Node *result;
594 
596 
597  if (node->chgParam != NULL) /* something changed */
598  ExecReScan(node); /* let ReScan handle this */
599 
600  switch (nodeTag(node))
601  {
602  /*
603  * Only node types that actually support multiexec will be listed
604  */
605 
606  case T_HashState:
607  result = MultiExecHash((HashState *) node);
608  break;
609 
612  break;
613 
614  case T_BitmapAndState:
615  result = MultiExecBitmapAnd((BitmapAndState *) node);
616  break;
617 
618  case T_BitmapOrState:
619  result = MultiExecBitmapOr((BitmapOrState *) node);
620  break;
621 
622  default:
623  elog(ERROR, "unrecognized node type: %d", (int) nodeTag(node));
624  result = NULL;
625  break;
626  }
627 
628  return result;
629 }
void ExecReScan(PlanState *node)
Definition: execAmi.c:74
Definition: nodes.h:518
Node * MultiExecHash(HashState *node)
Definition: nodeHash.c:74
#define ERROR
Definition: elog.h:43
Node * MultiExecBitmapIndexScan(BitmapIndexScanState *node)
Bitmapset * chgParam
Definition: execnodes.h:1074
Node * MultiExecBitmapAnd(BitmapAndState *node)
Definition: nodeBitmapAnd.c:96
Node * MultiExecBitmapOr(BitmapOrState *node)
Definition: nodeBitmapOr.c:97
#define NULL
Definition: c.h:229
#define nodeTag(nodeptr)
Definition: nodes.h:523
#define CHECK_FOR_INTERRUPTS()
Definition: miscadmin.h:97
#define elog
Definition: elog.h:219