PostgreSQL Source Code git master
Loading...
Searching...
No Matches
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)
 
void ExecEndSubqueryScan (SubqueryScanState *node)
 
void ExecReScanSubqueryScan (SubqueryScanState *node)
 

Function Documentation

◆ ExecEndSubqueryScan()

void ExecEndSubqueryScan ( SubqueryScanState node)
extern

Definition at line 169 of file nodeSubqueryscan.c.

170{
171 /*
172 * close down subquery
173 */
174 ExecEndNode(node->subplan);
175}
void ExecEndNode(PlanState *node)
PlanState * subplan
Definition execnodes.h:1910

References ExecEndNode(), and SubqueryScanState::subplan.

Referenced by ExecEndNode().

◆ ExecInitSubqueryScan()

SubqueryScanState * ExecInitSubqueryScan ( SubqueryScan node,
EState estate,
int  eflags 
)
extern

Definition at line 97 of file nodeSubqueryscan.c.

98{
100
101 /* check for unsupported flags */
102 Assert(!(eflags & EXEC_FLAG_MARK));
103
104 /* SubqueryScan should not have any "normal" children */
105 Assert(outerPlan(node) == NULL);
106 Assert(innerPlan(node) == NULL);
107
108 /*
109 * create state structure
110 */
112 subquerystate->ss.ps.plan = (Plan *) node;
113 subquerystate->ss.ps.state = estate;
114 subquerystate->ss.ps.ExecProcNode = ExecSubqueryScan;
115
116 /*
117 * Miscellaneous initialization
118 *
119 * create expression context for node
120 */
121 ExecAssignExprContext(estate, &subquerystate->ss.ps);
122
123 /*
124 * initialize subquery
125 */
126 subquerystate->subplan = ExecInitNode(node->subplan, estate, eflags);
127
128 /*
129 * Initialize scan slot and type (needed by ExecAssignScanProjectionInfo)
130 */
134 0);
135
136 /*
137 * The slot used as the scantuple isn't the slot above (outside of EPQ),
138 * but the one from the node below.
139 */
140 subquerystate->ss.ps.scanopsset = true;
141 subquerystate->ss.ps.scanops = ExecGetResultSlotOps(subquerystate->subplan,
142 &subquerystate->ss.ps.scanopsfixed);
143 subquerystate->ss.ps.resultopsset = true;
144 subquerystate->ss.ps.resultops = subquerystate->ss.ps.scanops;
145 subquerystate->ss.ps.resultopsfixed = subquerystate->ss.ps.scanopsfixed;
146
147 /*
148 * Initialize result type and projection.
149 */
152
153 /*
154 * initialize child expressions
155 */
156 subquerystate->ss.ps.qual =
157 ExecInitQual(node->scan.plan.qual, (PlanState *) subquerystate);
158
159 return subquerystate;
160}
#define Assert(condition)
Definition c.h:945
ExprState * ExecInitQual(List *qual, PlanState *parent)
Definition execExpr.c:250
PlanState * ExecInitNode(Plan *node, EState *estate, int eflags)
void ExecAssignScanProjectionInfo(ScanState *node)
Definition execScan.c:81
void ExecInitScanTupleSlot(EState *estate, ScanState *scanstate, TupleDesc tupledesc, const TupleTableSlotOps *tts_ops, uint16 flags)
void ExecInitResultTypeTL(PlanState *planstate)
TupleDesc ExecGetResultType(PlanState *planstate)
Definition execUtils.c:500
void ExecAssignExprContext(EState *estate, PlanState *planstate)
Definition execUtils.c:490
const TupleTableSlotOps * ExecGetResultSlotOps(PlanState *planstate, bool *isfixed)
Definition execUtils.c:509
#define EXEC_FLAG_MARK
Definition executor.h:71
static TupleTableSlot * ExecSubqueryScan(PlanState *pstate)
#define makeNode(_type_)
Definition nodes.h:161
#define innerPlan(node)
Definition plannodes.h:264
#define outerPlan(node)
Definition plannodes.h:265
static int fb(int x)
Plan * subplan
Definition plannodes.h:772

References Assert, EXEC_FLAG_MARK, ExecAssignExprContext(), ExecAssignScanProjectionInfo(), ExecGetResultSlotOps(), ExecGetResultType(), ExecInitNode(), ExecInitQual(), ExecInitResultTypeTL(), ExecInitScanTupleSlot(), ExecSubqueryScan(), fb(), innerPlan, makeNode, outerPlan, SubqueryScan::scan, and SubqueryScan::subplan.

Referenced by ExecInitNode().

◆ ExecReScanSubqueryScan()

void ExecReScanSubqueryScan ( SubqueryScanState node)
extern

Definition at line 184 of file nodeSubqueryscan.c.

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

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

Referenced by ExecReScan().