PostgreSQL Source Code  git master
nodeResult.h File Reference
#include "nodes/execnodes.h"
Include dependency graph for nodeResult.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

ResultStateExecInitResult (Result *node, EState *estate, int eflags)
 
void ExecEndResult (ResultState *node)
 
void ExecResultMarkPos (ResultState *node)
 
void ExecResultRestrPos (ResultState *node)
 
void ExecReScanResult (ResultState *node)
 

Function Documentation

◆ ExecEndResult()

void ExecEndResult ( ResultState node)

Definition at line 241 of file nodeResult.c.

References ExecClearTuple(), ExecEndNode(), ExecFreeExprContext(), outerPlanState, ResultState::ps, and PlanState::ps_ResultTupleSlot.

Referenced by ExecEndNode().

242 {
243  /*
244  * Free the exprcontext
245  */
246  ExecFreeExprContext(&node->ps);
247 
248  /*
249  * clean out the tuple table
250  */
252 
253  /*
254  * shut down subplans
255  */
257 }
void ExecEndNode(PlanState *node)
Definition: execProcnode.c:539
TupleTableSlot * ExecClearTuple(TupleTableSlot *slot)
Definition: execTuples.c:475
void ExecFreeExprContext(PlanState *planstate)
Definition: execUtils.c:566
TupleTableSlot * ps_ResultTupleSlot
Definition: execnodes.h:945
#define outerPlanState(node)
Definition: execnodes.h:965
PlanState ps
Definition: execnodes.h:1006

◆ ExecInitResult()

ResultState* ExecInitResult ( Result node,
EState estate,
int  eflags 
)

Definition at line 181 of file nodeResult.c.

References Assert, EXEC_FLAG_BACKWARD, EXEC_FLAG_MARK, ExecAssignExprContext(), ExecAssignProjectionInfo(), ExecInitNode(), ExecInitQual(), ExecInitResultTupleSlotTL(), PlanState::ExecProcNode, ExecResult(), innerPlan, makeNode, outerPlan, outerPlanState, Result::plan, PlanState::plan, ResultState::ps, Plan::qual, PlanState::qual, Result::resconstantqual, ResultState::rs_checkqual, ResultState::rs_done, and PlanState::state.

Referenced by ExecInitNode().

182 {
183  ResultState *resstate;
184 
185  /* check for unsupported flags */
186  Assert(!(eflags & (EXEC_FLAG_MARK | EXEC_FLAG_BACKWARD)) ||
187  outerPlan(node) != NULL);
188 
189  /*
190  * create state structure
191  */
192  resstate = makeNode(ResultState);
193  resstate->ps.plan = (Plan *) node;
194  resstate->ps.state = estate;
195  resstate->ps.ExecProcNode = ExecResult;
196 
197  resstate->rs_done = false;
198  resstate->rs_checkqual = (node->resconstantqual == NULL) ? false : true;
199 
200  /*
201  * Miscellaneous initialization
202  *
203  * create expression context for node
204  */
205  ExecAssignExprContext(estate, &resstate->ps);
206 
207  /*
208  * initialize child nodes
209  */
210  outerPlanState(resstate) = ExecInitNode(outerPlan(node), estate, eflags);
211 
212  /*
213  * we don't use inner plan
214  */
215  Assert(innerPlan(node) == NULL);
216 
217  /*
218  * Initialize result slot, type and projection.
219  */
220  ExecInitResultTupleSlotTL(estate, &resstate->ps);
221  ExecAssignProjectionInfo(&resstate->ps, NULL);
222 
223  /*
224  * initialize child expressions
225  */
226  resstate->ps.qual =
227  ExecInitQual(node->plan.qual, (PlanState *) resstate);
228  resstate->resconstantqual =
229  ExecInitQual((List *) node->resconstantqual, (PlanState *) resstate);
230 
231  return resstate;
232 }
Plan plan
Definition: plannodes.h:192
List * qual
Definition: plannodes.h:147
bool rs_done
Definition: execnodes.h:1008
EState * state
Definition: execnodes.h:913
ExprState * ExecInitQual(List *qual, PlanState *parent)
Definition: execExpr.c:205
Node * resconstantqual
Definition: plannodes.h:193
ExprState * resconstantqual
Definition: execnodes.h:1007
#define EXEC_FLAG_BACKWARD
Definition: executor.h:60
#define outerPlanState(node)
Definition: execnodes.h:965
#define innerPlan(node)
Definition: plannodes.h:175
void ExecAssignProjectionInfo(PlanState *planstate, TupleDesc inputDesc)
Definition: execUtils.c:456
#define outerPlan(node)
Definition: plannodes.h:176
bool rs_checkqual
Definition: execnodes.h:1009
static TupleTableSlot * ExecResult(PlanState *pstate)
Definition: nodeResult.c:68
ExecProcNodeMtd ExecProcNode
Definition: execnodes.h:917
void ExecInitResultTupleSlotTL(EState *estate, PlanState *planstate)
Definition: execTuples.c:890
Plan * plan
Definition: execnodes.h:911
#define makeNode(_type_)
Definition: nodes.h:565
#define Assert(condition)
Definition: c.h:699
#define EXEC_FLAG_MARK
Definition: executor.h:61
void ExecAssignExprContext(EState *estate, PlanState *planstate)
Definition: execUtils.c:428
ExprState * qual
Definition: execnodes.h:929
PlanState * ExecInitNode(Plan *node, EState *estate, int eflags)
Definition: execProcnode.c:139
Definition: pg_list.h:45
PlanState ps
Definition: execnodes.h:1006

◆ ExecReScanResult()

void ExecReScanResult ( ResultState node)

Definition at line 260 of file nodeResult.c.

References PlanState::chgParam, ExecReScan(), PlanState::lefttree, ResultState::ps, ResultState::resconstantqual, ResultState::rs_checkqual, and ResultState::rs_done.

Referenced by ExecReScan().

261 {
262  node->rs_done = false;
263  node->rs_checkqual = (node->resconstantqual == NULL) ? false : true;
264 
265  /*
266  * If chgParam of subnode is not null then plan will be re-scanned by
267  * first ExecProcNode.
268  */
269  if (node->ps.lefttree &&
270  node->ps.lefttree->chgParam == NULL)
271  ExecReScan(node->ps.lefttree);
272 }
bool rs_done
Definition: execnodes.h:1008
void ExecReScan(PlanState *node)
Definition: execAmi.c:76
struct PlanState * lefttree
Definition: execnodes.h:930
ExprState * resconstantqual
Definition: execnodes.h:1007
Bitmapset * chgParam
Definition: execnodes.h:940
bool rs_checkqual
Definition: execnodes.h:1009
PlanState ps
Definition: execnodes.h:1006

◆ ExecResultMarkPos()

void ExecResultMarkPos ( ResultState node)

Definition at line 147 of file nodeResult.c.

References DEBUG2, elog, ExecMarkPos(), outerPlan, and outerPlanState.

Referenced by ExecMarkPos().

148 {
150 
151  if (outerPlan != NULL)
152  ExecMarkPos(outerPlan);
153  else
154  elog(DEBUG2, "Result nodes do not support mark/restore");
155 }
#define outerPlanState(node)
Definition: execnodes.h:965
#define DEBUG2
Definition: elog.h:24
#define outerPlan(node)
Definition: plannodes.h:176
void ExecMarkPos(PlanState *node)
Definition: execAmi.c:314
#define elog
Definition: elog.h:219

◆ ExecResultRestrPos()

void ExecResultRestrPos ( ResultState node)

Definition at line 162 of file nodeResult.c.

References elog, ERROR, ExecRestrPos(), outerPlan, and outerPlanState.

Referenced by ExecRestrPos().

163 {
165 
166  if (outerPlan != NULL)
167  ExecRestrPos(outerPlan);
168  else
169  elog(ERROR, "Result nodes do not support mark/restore");
170 }
void ExecRestrPos(PlanState *node)
Definition: execAmi.c:363
#define ERROR
Definition: elog.h:43
#define outerPlanState(node)
Definition: execnodes.h:965
#define outerPlan(node)
Definition: plannodes.h:176
#define elog
Definition: elog.h:219