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 246 of file nodeResult.c.

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

Referenced by ExecEndNode().

247 {
248  /*
249  * Free the exprcontext
250  */
251  ExecFreeExprContext(&node->ps);
252 
253  /*
254  * clean out the tuple table
255  */
257 
258  /*
259  * shut down subplans
260  */
262 }
void ExecEndNode(PlanState *node)
Definition: execProcnode.c:523
TupleTableSlot * ExecClearTuple(TupleTableSlot *slot)
Definition: execTuples.c:439
void ExecFreeExprContext(PlanState *planstate)
Definition: execUtils.c:523
TupleTableSlot * ps_ResultTupleSlot
Definition: execnodes.h:882
#define outerPlanState(node)
Definition: execnodes.h:895
PlanState ps
Definition: execnodes.h:931

◆ 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(), ExecAssignResultTypeFromTL(), ExecInitNode(), ExecInitQual(), ExecInitResultTupleSlot(), 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  * tuple table initialization
209  */
210  ExecInitResultTupleSlot(estate, &resstate->ps);
211 
212  /*
213  * initialize child expressions
214  */
215  resstate->ps.qual =
216  ExecInitQual(node->plan.qual, (PlanState *) resstate);
217  resstate->resconstantqual =
218  ExecInitQual((List *) node->resconstantqual, (PlanState *) resstate);
219 
220  /*
221  * initialize child nodes
222  */
223  outerPlanState(resstate) = ExecInitNode(outerPlan(node), estate, eflags);
224 
225  /*
226  * we don't use inner plan
227  */
228  Assert(innerPlan(node) == NULL);
229 
230  /*
231  * initialize tuple type and projection info
232  */
233  ExecAssignResultTypeFromTL(&resstate->ps);
234  ExecAssignProjectionInfo(&resstate->ps, NULL);
235 
236  return resstate;
237 }
Plan plan
Definition: plannodes.h:190
List * qual
Definition: plannodes.h:145
bool rs_done
Definition: execnodes.h:933
EState * state
Definition: execnodes.h:851
ExprState * ExecInitQual(List *qual, PlanState *parent)
Definition: execExpr.c:160
void ExecAssignResultTypeFromTL(PlanState *planstate)
Definition: execUtils.c:447
Node * resconstantqual
Definition: plannodes.h:191
void ExecInitResultTupleSlot(EState *estate, PlanState *planstate)
Definition: execTuples.c:832
ExprState * resconstantqual
Definition: execnodes.h:932
#define EXEC_FLAG_BACKWARD
Definition: executor.h:60
#define outerPlanState(node)
Definition: execnodes.h:895
#define innerPlan(node)
Definition: plannodes.h:173
void ExecAssignProjectionInfo(PlanState *planstate, TupleDesc inputDesc)
Definition: execUtils.c:494
#define outerPlan(node)
Definition: plannodes.h:174
bool rs_checkqual
Definition: execnodes.h:934
static TupleTableSlot * ExecResult(PlanState *pstate)
Definition: nodeResult.c:68
ExecProcNodeMtd ExecProcNode
Definition: execnodes.h:855
Plan * plan
Definition: execnodes.h:849
#define makeNode(_type_)
Definition: nodes.h:559
#define Assert(condition)
Definition: c.h:670
#define EXEC_FLAG_MARK
Definition: executor.h:61
void ExecAssignExprContext(EState *estate, PlanState *planstate)
Definition: execUtils.c:425
ExprState * qual
Definition: execnodes.h:867
PlanState * ExecInitNode(Plan *node, EState *estate, int eflags)
Definition: execProcnode.c:139
Definition: pg_list.h:45
PlanState ps
Definition: execnodes.h:931

◆ ExecReScanResult()

void ExecReScanResult ( ResultState node)

Definition at line 265 of file nodeResult.c.

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

Referenced by ExecReScan().

266 {
267  node->rs_done = false;
268  node->rs_checkqual = (node->resconstantqual == NULL) ? false : true;
269 
270  /*
271  * If chgParam of subnode is not null then plan will be re-scanned by
272  * first ExecProcNode.
273  */
274  if (node->ps.lefttree &&
275  node->ps.lefttree->chgParam == NULL)
276  ExecReScan(node->ps.lefttree);
277 }
bool rs_done
Definition: execnodes.h:933
void ExecReScan(PlanState *node)
Definition: execAmi.c:76
struct PlanState * lefttree
Definition: execnodes.h:868
ExprState * resconstantqual
Definition: execnodes.h:932
Bitmapset * chgParam
Definition: execnodes.h:877
bool rs_checkqual
Definition: execnodes.h:934
PlanState ps
Definition: execnodes.h:931

◆ 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:895
#define DEBUG2
Definition: elog.h:24
#define outerPlan(node)
Definition: plannodes.h:174
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:895
#define outerPlan(node)
Definition: plannodes.h:174
#define elog
Definition: elog.h:219