PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
execProcnode.c File Reference
#include "postgres.h"
#include "executor/executor.h"
#include "executor/nodeAgg.h"
#include "executor/nodeAppend.h"
#include "executor/nodeBitmapAnd.h"
#include "executor/nodeBitmapHeapscan.h"
#include "executor/nodeBitmapIndexscan.h"
#include "executor/nodeBitmapOr.h"
#include "executor/nodeCtescan.h"
#include "executor/nodeCustom.h"
#include "executor/nodeForeignscan.h"
#include "executor/nodeFunctionscan.h"
#include "executor/nodeGather.h"
#include "executor/nodeGatherMerge.h"
#include "executor/nodeGroup.h"
#include "executor/nodeHash.h"
#include "executor/nodeHashjoin.h"
#include "executor/nodeIndexonlyscan.h"
#include "executor/nodeIndexscan.h"
#include "executor/nodeLimit.h"
#include "executor/nodeLockRows.h"
#include "executor/nodeMaterial.h"
#include "executor/nodeMergeAppend.h"
#include "executor/nodeMergejoin.h"
#include "executor/nodeModifyTable.h"
#include "executor/nodeNamedtuplestorescan.h"
#include "executor/nodeNestloop.h"
#include "executor/nodeProjectSet.h"
#include "executor/nodeRecursiveunion.h"
#include "executor/nodeResult.h"
#include "executor/nodeSamplescan.h"
#include "executor/nodeSeqscan.h"
#include "executor/nodeSetOp.h"
#include "executor/nodeSort.h"
#include "executor/nodeSubplan.h"
#include "executor/nodeSubqueryscan.h"
#include "executor/nodeTableFuncscan.h"
#include "executor/nodeTidscan.h"
#include "executor/nodeUnique.h"
#include "executor/nodeValuesscan.h"
#include "executor/nodeWindowAgg.h"
#include "executor/nodeWorktablescan.h"
#include "nodes/nodeFuncs.h"
#include "miscadmin.h"
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 654 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(), ExecEndNamedTuplestoreScan(), 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_NamedTuplestoreScanState, 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().

655 {
656  /*
657  * do nothing when we get to the end of a leaf on tree.
658  */
659  if (node == NULL)
660  return;
661 
662  if (node->chgParam != NULL)
663  {
664  bms_free(node->chgParam);
665  node->chgParam = NULL;
666  }
667 
668  switch (nodeTag(node))
669  {
670  /*
671  * control nodes
672  */
673  case T_ResultState:
674  ExecEndResult((ResultState *) node);
675  break;
676 
677  case T_ProjectSetState:
679  break;
680 
681  case T_ModifyTableState:
683  break;
684 
685  case T_AppendState:
686  ExecEndAppend((AppendState *) node);
687  break;
688 
689  case T_MergeAppendState:
691  break;
692 
695  break;
696 
697  case T_BitmapAndState:
699  break;
700 
701  case T_BitmapOrState:
702  ExecEndBitmapOr((BitmapOrState *) node);
703  break;
704 
705  /*
706  * scan nodes
707  */
708  case T_SeqScanState:
709  ExecEndSeqScan((SeqScanState *) node);
710  break;
711 
712  case T_SampleScanState:
714  break;
715 
716  case T_GatherState:
717  ExecEndGather((GatherState *) node);
718  break;
719 
720  case T_GatherMergeState:
722  break;
723 
724  case T_IndexScanState:
726  break;
727 
730  break;
731 
734  break;
735 
738  break;
739 
740  case T_TidScanState:
741  ExecEndTidScan((TidScanState *) node);
742  break;
743 
744  case T_SubqueryScanState:
746  break;
747 
748  case T_FunctionScanState:
750  break;
751 
754  break;
755 
756  case T_ValuesScanState:
758  break;
759 
760  case T_CteScanState:
761  ExecEndCteScan((CteScanState *) node);
762  break;
763 
766  break;
767 
770  break;
771 
772  case T_ForeignScanState:
774  break;
775 
776  case T_CustomScanState:
778  break;
779 
780  /*
781  * join nodes
782  */
783  case T_NestLoopState:
784  ExecEndNestLoop((NestLoopState *) node);
785  break;
786 
787  case T_MergeJoinState:
789  break;
790 
791  case T_HashJoinState:
792  ExecEndHashJoin((HashJoinState *) node);
793  break;
794 
795  /*
796  * materialization nodes
797  */
798  case T_MaterialState:
799  ExecEndMaterial((MaterialState *) node);
800  break;
801 
802  case T_SortState:
803  ExecEndSort((SortState *) node);
804  break;
805 
806  case T_GroupState:
807  ExecEndGroup((GroupState *) node);
808  break;
809 
810  case T_AggState:
811  ExecEndAgg((AggState *) node);
812  break;
813 
814  case T_WindowAggState:
816  break;
817 
818  case T_UniqueState:
819  ExecEndUnique((UniqueState *) node);
820  break;
821 
822  case T_HashState:
823  ExecEndHash((HashState *) node);
824  break;
825 
826  case T_SetOpState:
827  ExecEndSetOp((SetOpState *) node);
828  break;
829 
830  case T_LockRowsState:
831  ExecEndLockRows((LockRowsState *) node);
832  break;
833 
834  case T_LimitState:
835  ExecEndLimit((LimitState *) node);
836  break;
837 
838  default:
839  elog(ERROR, "unrecognized node type: %d", (int) nodeTag(node));
840  break;
841  }
842 }
void ExecEndGroup(GroupState *node)
Definition: nodeGroup.c:226
void ExecEndSetOp(SetOpState *node)
Definition: nodeSetOp.c:575
void ExecEndFunctionScan(FunctionScanState *node)
void ExecEndNestLoop(NestLoopState *node)
Definition: nodeNestloop.c:361
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 ExecEndNamedTuplestoreScan(NamedTuplestoreScanState *node)
void ExecEndBitmapAnd(BitmapAndState *node)
void ExecEndRecursiveUnion(RecursiveUnionState *node)
void ExecEndSubqueryScan(SubqueryScanState *node)
void ExecEndHashJoin(HashJoinState *node)
Definition: nodeHashjoin.c:548
void ExecEndTableFuncScan(TableFuncScanState *node)
void ExecEndResult(ResultState *node)
Definition: nodeResult.c:241
#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:224
void ExecEndBitmapIndexScan(BitmapIndexScanState *node)
void ExecEndValuesScan(ValuesScanState *node)
void ExecEndMergeJoin(MergeJoinState *node)
void ExecEndSeqScan(SeqScanState *node)
Definition: nodeSeqscan.c:221
void ExecEndIndexOnlyScan(IndexOnlyScanState *node)
void ExecEndTidScan(TidScanState *node)
Definition: nodeTidscan.c:477
Bitmapset * chgParam
Definition: execnodes.h:837
void ExecEndCteScan(CteScanState *node)
Definition: nodeCtescan.c:277
void ExecEndCustomScan(CustomScanState *node)
Definition: nodeCustom.c:112
void ExecEndBitmapOr(BitmapOrState *node)
Definition: nodeBitmapOr.c:182
void ExecEndSampleScan(SampleScanState *node)
void bms_free(Bitmapset *a)
Definition: bitmapset.c:201
void ExecEndWindowAgg(WindowAggState *node)
#define NULL
Definition: c.h:229
void ExecEndMergeAppend(MergeAppendState *node)
#define nodeTag(nodeptr)
Definition: nodes.h:514
void ExecEndHash(HashState *node)
Definition: nodeHash.c:218
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:3837
void ExecEndModifyTable(ModifyTableState *node)
void ExecEndGather(GatherState *node)
Definition: nodeGather.c:226
PlanState* ExecInitNode ( Plan node,
EState estate,
int  eflags 
)

Definition at line 140 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(), ExecInitNamedTuplestoreScan(), 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, result, 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_NamedTuplestoreScan, 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().

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

Definition at line 398 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(), ExecNamedTuplestoreScan(), ExecNestLoop(), ExecProjectSet(), ExecRecursiveUnion(), ExecReScan(), ExecResult(), ExecSampleScan(), ExecSeqScan(), ExecSetOp(), ExecSort(), ExecSubqueryScan(), ExecTableFuncScan(), ExecTidScan(), ExecUnique(), ExecValuesScan(), ExecWindowAgg(), ExecWorkTableScan(), InstrStartNode(), InstrStopNode(), PlanState::instrument, nodeTag, NULL, result, 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_NamedTuplestoreScanState, 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().

399 {
401 
403 
404  if (node->chgParam != NULL) /* something changed */
405  ExecReScan(node); /* let ReScan handle this */
406 
407  if (node->instrument)
408  InstrStartNode(node->instrument);
409 
410  switch (nodeTag(node))
411  {
412  /*
413  * control nodes
414  */
415  case T_ResultState:
416  result = ExecResult((ResultState *) node);
417  break;
418 
419  case T_ProjectSetState:
420  result = ExecProjectSet((ProjectSetState *) node);
421  break;
422 
423  case T_ModifyTableState:
424  result = ExecModifyTable((ModifyTableState *) node);
425  break;
426 
427  case T_AppendState:
428  result = ExecAppend((AppendState *) node);
429  break;
430 
431  case T_MergeAppendState:
432  result = ExecMergeAppend((MergeAppendState *) node);
433  break;
434 
436  result = ExecRecursiveUnion((RecursiveUnionState *) node);
437  break;
438 
439  /* BitmapAndState does not yield tuples */
440 
441  /* BitmapOrState does not yield tuples */
442 
443  /*
444  * scan nodes
445  */
446  case T_SeqScanState:
447  result = ExecSeqScan((SeqScanState *) node);
448  break;
449 
450  case T_SampleScanState:
451  result = ExecSampleScan((SampleScanState *) node);
452  break;
453 
454  case T_IndexScanState:
455  result = ExecIndexScan((IndexScanState *) node);
456  break;
457 
459  result = ExecIndexOnlyScan((IndexOnlyScanState *) node);
460  break;
461 
462  /* BitmapIndexScanState does not yield tuples */
463 
465  result = ExecBitmapHeapScan((BitmapHeapScanState *) node);
466  break;
467 
468  case T_TidScanState:
469  result = ExecTidScan((TidScanState *) node);
470  break;
471 
472  case T_SubqueryScanState:
473  result = ExecSubqueryScan((SubqueryScanState *) node);
474  break;
475 
476  case T_FunctionScanState:
477  result = ExecFunctionScan((FunctionScanState *) node);
478  break;
479 
481  result = ExecTableFuncScan((TableFuncScanState *) node);
482  break;
483 
484  case T_ValuesScanState:
485  result = ExecValuesScan((ValuesScanState *) node);
486  break;
487 
488  case T_CteScanState:
489  result = ExecCteScan((CteScanState *) node);
490  break;
491 
494  break;
495 
497  result = ExecWorkTableScan((WorkTableScanState *) node);
498  break;
499 
500  case T_ForeignScanState:
501  result = ExecForeignScan((ForeignScanState *) node);
502  break;
503 
504  case T_CustomScanState:
505  result = ExecCustomScan((CustomScanState *) node);
506  break;
507 
508  /*
509  * join nodes
510  */
511  case T_NestLoopState:
512  result = ExecNestLoop((NestLoopState *) node);
513  break;
514 
515  case T_MergeJoinState:
516  result = ExecMergeJoin((MergeJoinState *) node);
517  break;
518 
519  case T_HashJoinState:
520  result = ExecHashJoin((HashJoinState *) node);
521  break;
522 
523  /*
524  * materialization nodes
525  */
526  case T_MaterialState:
527  result = ExecMaterial((MaterialState *) node);
528  break;
529 
530  case T_SortState:
531  result = ExecSort((SortState *) node);
532  break;
533 
534  case T_GroupState:
535  result = ExecGroup((GroupState *) node);
536  break;
537 
538  case T_AggState:
539  result = ExecAgg((AggState *) node);
540  break;
541 
542  case T_WindowAggState:
543  result = ExecWindowAgg((WindowAggState *) node);
544  break;
545 
546  case T_UniqueState:
547  result = ExecUnique((UniqueState *) node);
548  break;
549 
550  case T_GatherState:
551  result = ExecGather((GatherState *) node);
552  break;
553 
554  case T_GatherMergeState:
555  result = ExecGatherMerge((GatherMergeState *) node);
556  break;
557 
558  case T_HashState:
559  result = ExecHash((HashState *) node);
560  break;
561 
562  case T_SetOpState:
563  result = ExecSetOp((SetOpState *) node);
564  break;
565 
566  case T_LockRowsState:
567  result = ExecLockRows((LockRowsState *) node);
568  break;
569 
570  case T_LimitState:
571  result = ExecLimit((LimitState *) node);
572  break;
573 
574  default:
575  elog(ERROR, "unrecognized node type: %d", (int) nodeTag(node));
576  result = NULL;
577  break;
578  }
579 
580  if (node->instrument)
581  InstrStopNode(node->instrument, TupIsNull(result) ? 0.0 : 1.0);
582 
583  return result;
584 }
void InstrStopNode(Instrumentation *instr, double nTuples)
Definition: instrument.c:80
TupleTableSlot * ExecModifyTable(ModifyTableState *node)
TupleTableSlot * ExecTidScan(TidScanState *node)
Definition: nodeTidscan.c:446
TupleTableSlot * ExecTableFuncScan(TableFuncScanState *node)
TupleTableSlot * ExecSampleScan(SampleScanState *node)
TupleTableSlot * ExecValuesScan(ValuesScanState *node)
TupleTableSlot * ExecNamedTuplestoreScan(NamedTuplestoreScanState *node)
Instrumentation * instrument
Definition: execnodes.h:819
TupleTableSlot * ExecGroup(GroupState *node)
Definition: nodeGroup.c:35
TupleTableSlot * ExecAgg(AggState *node)
Definition: nodeAgg.c:2099
void ExecReScan(PlanState *node)
Definition: execAmi.c:75
TupleTableSlot * ExecRecursiveUnion(RecursiveUnionState *node)
TupleTableSlot * ExecFunctionScan(FunctionScanState *node)
TupleTableSlot * ExecResult(ResultState *node)
Definition: nodeResult.c:67
return result
Definition: formatting.c:1632
TupleTableSlot * ExecGatherMerge(GatherMergeState *node)
TupleTableSlot * ExecIndexOnlyScan(IndexOnlyScanState *node)
TupleTableSlot * ExecCustomScan(CustomScanState *node)
Definition: nodeCustom.c:105
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:837
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:514
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:124
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 855 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().

856 {
857  if (node == NULL)
858  return false;
859 
861 
862  switch (nodeTag(node))
863  {
864  case T_GatherState:
866  break;
867  case T_ForeignScanState:
869  break;
870  case T_CustomScanState:
872  break;
873  case T_GatherMergeState:
875  break;
876  default:
877  break;
878  }
879 
880  return false;
881 }
bool ExecShutdownNode(PlanState *node)
Definition: execProcnode.c:855
void ExecShutdownCustomScan(CustomScanState *node)
Definition: nodeCustom.c:203
void ExecShutdownGather(GatherState *node)
Definition: nodeGather.c:400
void ExecShutdownGatherMerge(GatherMergeState *node)
#define NULL
Definition: c.h:229
#define nodeTag(nodeptr)
Definition: nodes.h:514
void ExecShutdownForeignScan(ForeignScanState *node)
bool planstate_tree_walker(PlanState *planstate, bool(*walker)(), void *context)
Definition: nodeFuncs.c:3719
Node* MultiExecProcNode ( PlanState node)

Definition at line 601 of file execProcnode.c.

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

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

602 {
603  Node *result;
604 
606 
607  if (node->chgParam != NULL) /* something changed */
608  ExecReScan(node); /* let ReScan handle this */
609 
610  switch (nodeTag(node))
611  {
612  /*
613  * Only node types that actually support multiexec will be listed
614  */
615 
616  case T_HashState:
617  result = MultiExecHash((HashState *) node);
618  break;
619 
622  break;
623 
624  case T_BitmapAndState:
625  result = MultiExecBitmapAnd((BitmapAndState *) node);
626  break;
627 
628  case T_BitmapOrState:
629  result = MultiExecBitmapOr((BitmapOrState *) node);
630  break;
631 
632  default:
633  elog(ERROR, "unrecognized node type: %d", (int) nodeTag(node));
634  result = NULL;
635  break;
636  }
637 
638  return result;
639 }
void ExecReScan(PlanState *node)
Definition: execAmi.c:75
Definition: nodes.h:509
Node * MultiExecHash(HashState *node)
Definition: nodeHash.c:74
return result
Definition: formatting.c:1632
#define ERROR
Definition: elog.h:43
Node * MultiExecBitmapIndexScan(BitmapIndexScanState *node)
Bitmapset * chgParam
Definition: execnodes.h:837
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:514
#define CHECK_FOR_INTERRUPTS()
Definition: miscadmin.h:97
#define elog
Definition: elog.h:219