PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
nodeSubqueryscan.h File Reference
#include "nodes/execnodes.h"
Include dependency graph for nodeSubqueryscan.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

SubqueryScanStateExecInitSubqueryScan (SubqueryScan *node, EState *estate, int eflags)
 
TupleTableSlotExecSubqueryScan (SubqueryScanState *node)
 
void ExecEndSubqueryScan (SubqueryScanState *node)
 
void ExecReScanSubqueryScan (SubqueryScanState *node)
 

Function Documentation

void ExecEndSubqueryScan ( SubqueryScanState node)

Definition at line 159 of file nodeSubqueryscan.c.

References ExecClearTuple(), ExecEndNode(), ExecFreeExprContext(), ScanState::ps, PlanState::ps_ResultTupleSlot, SubqueryScanState::ss, ScanState::ss_ScanTupleSlot, and SubqueryScanState::subplan.

Referenced by ExecEndNode().

160 {
161  /*
162  * Free the exprcontext
163  */
164  ExecFreeExprContext(&node->ss.ps);
165 
166  /*
167  * clean out the upper tuple table
168  */
171 
172  /*
173  * close down subquery
174  */
175  ExecEndNode(node->subplan);
176 }
void ExecEndNode(PlanState *node)
Definition: execProcnode.c:654
TupleTableSlot * ExecClearTuple(TupleTableSlot *slot)
Definition: execTuples.c:439
TupleTableSlot * ss_ScanTupleSlot
Definition: execnodes.h:1061
void ExecFreeExprContext(PlanState *planstate)
Definition: execUtils.c:516
PlanState ps
Definition: execnodes.h:1058
TupleTableSlot * ps_ResultTupleSlot
Definition: execnodes.h:842
PlanState * subplan
Definition: execnodes.h:1354
SubqueryScanState* ExecInitSubqueryScan ( SubqueryScan node,
EState estate,
int  eflags 
)

Definition at line 95 of file nodeSubqueryscan.c.

References Assert, EXEC_FLAG_MARK, ExecAssignExprContext(), ExecAssignResultTypeFromTL(), ExecAssignScanProjectionInfo(), ExecAssignScanType(), ExecGetResultType(), ExecInitNode(), ExecInitQual(), ExecInitResultTupleSlot(), ExecInitScanTupleSlot(), innerPlan, makeNode, NULL, outerPlan, Scan::plan, PlanState::plan, ScanState::ps, Plan::qual, PlanState::qual, SubqueryScan::scan, SubqueryScanState::ss, PlanState::state, SubqueryScan::subplan, and SubqueryScanState::subplan.

Referenced by ExecInitNode().

96 {
97  SubqueryScanState *subquerystate;
98 
99  /* check for unsupported flags */
100  Assert(!(eflags & EXEC_FLAG_MARK));
101 
102  /* SubqueryScan should not have any "normal" children */
103  Assert(outerPlan(node) == NULL);
104  Assert(innerPlan(node) == NULL);
105 
106  /*
107  * create state structure
108  */
109  subquerystate = makeNode(SubqueryScanState);
110  subquerystate->ss.ps.plan = (Plan *) node;
111  subquerystate->ss.ps.state = estate;
112 
113  /*
114  * Miscellaneous initialization
115  *
116  * create expression context for node
117  */
118  ExecAssignExprContext(estate, &subquerystate->ss.ps);
119 
120  /*
121  * initialize child expressions
122  */
123  subquerystate->ss.ps.qual =
124  ExecInitQual(node->scan.plan.qual, (PlanState *) subquerystate);
125 
126  /*
127  * tuple table initialization
128  */
129  ExecInitResultTupleSlot(estate, &subquerystate->ss.ps);
130  ExecInitScanTupleSlot(estate, &subquerystate->ss);
131 
132  /*
133  * initialize subquery
134  */
135  subquerystate->subplan = ExecInitNode(node->subplan, estate, eflags);
136 
137  /*
138  * Initialize scan tuple type (needed by ExecAssignScanProjectionInfo)
139  */
140  ExecAssignScanType(&subquerystate->ss,
141  ExecGetResultType(subquerystate->subplan));
142 
143  /*
144  * Initialize result tuple type and projection info.
145  */
146  ExecAssignResultTypeFromTL(&subquerystate->ss.ps);
147  ExecAssignScanProjectionInfo(&subquerystate->ss);
148 
149  return subquerystate;
150 }
List * qual
Definition: plannodes.h:145
Plan plan
Definition: plannodes.h:328
void ExecInitScanTupleSlot(EState *estate, ScanState *scanstate)
Definition: execTuples.c:842
EState * state
Definition: execnodes.h:815
ExprState * ExecInitQual(List *qual, PlanState *parent)
Definition: execExpr.c:160
void ExecAssignResultTypeFromTL(PlanState *planstate)
Definition: execUtils.c:440
PlanState ps
Definition: execnodes.h:1058
void ExecAssignScanProjectionInfo(ScanState *node)
Definition: execScan.c:235
void ExecInitResultTupleSlot(EState *estate, PlanState *planstate)
Definition: execTuples.c:832
#define innerPlan(node)
Definition: plannodes.h:173
PlanState * subplan
Definition: execnodes.h:1354
#define outerPlan(node)
Definition: plannodes.h:174
Plan * plan
Definition: execnodes.h:813
#define makeNode(_type_)
Definition: nodes.h:557
#define NULL
Definition: c.h:229
#define Assert(condition)
Definition: c.h:675
#define EXEC_FLAG_MARK
Definition: executor.h:61
void ExecAssignExprContext(EState *estate, PlanState *planstate)
Definition: execUtils.c:418
TupleDesc ExecGetResultType(PlanState *planstate)
Definition: execUtils.c:469
ExprState * qual
Definition: execnodes.h:827
void ExecAssignScanType(ScanState *scanstate, TupleDesc tupDesc)
Definition: execUtils.c:540
PlanState * ExecInitNode(Plan *node, EState *estate, int eflags)
Definition: execProcnode.c:140
Plan * subplan
Definition: plannodes.h:498
void ExecReScanSubqueryScan ( SubqueryScanState node)

Definition at line 185 of file nodeSubqueryscan.c.

References PlanState::chgParam, ExecReScan(), ExecScanReScan(), NULL, ScanState::ps, SubqueryScanState::ss, SubqueryScanState::subplan, and UpdateChangedParamSet().

Referenced by ExecReScan().

186 {
187  ExecScanReScan(&node->ss);
188 
189  /*
190  * ExecReScan doesn't know about my subplan, so I have to do
191  * changed-parameter signaling myself. This is just as well, because the
192  * subplan has its own memory context in which its chgParam state lives.
193  */
194  if (node->ss.ps.chgParam != NULL)
196 
197  /*
198  * if chgParam of subnode is not null then plan will be re-scanned by
199  * first ExecProcNode.
200  */
201  if (node->subplan->chgParam == NULL)
202  ExecReScan(node->subplan);
203 }
void ExecReScan(PlanState *node)
Definition: execAmi.c:75
PlanState ps
Definition: execnodes.h:1058
PlanState * subplan
Definition: execnodes.h:1354
Bitmapset * chgParam
Definition: execnodes.h:837
void UpdateChangedParamSet(PlanState *node, Bitmapset *newchg)
Definition: execUtils.c:671
#define NULL
Definition: c.h:229
void ExecScanReScan(ScanState *node)
Definition: execScan.c:327
TupleTableSlot* ExecSubqueryScan ( SubqueryScanState node)

Definition at line 83 of file nodeSubqueryscan.c.

References ExecScan(), SubqueryScanState::ss, SubqueryNext(), and SubqueryRecheck().

Referenced by ExecProcNode().

84 {
85  return ExecScan(&node->ss,
88 }
TupleTableSlot * ExecScan(ScanState *node, ExecScanAccessMtd accessMtd, ExecScanRecheckMtd recheckMtd)
Definition: execScan.c:121
static TupleTableSlot * SubqueryNext(SubqueryScanState *node)
TupleTableSlot *(* ExecScanAccessMtd)(ScanState *node)
Definition: executor.h:389
bool(* ExecScanRecheckMtd)(ScanState *node, TupleTableSlot *slot)
Definition: executor.h:390
static bool SubqueryRecheck(SubqueryScanState *node, TupleTableSlot *slot)