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.

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:557
void ExecFreeExprContext(PlanState *planstate)
Definition: execUtils.c:658
#define outerPlanState(node)
Definition: execnodes.h:1133
TupleTableSlot * ps_ResultTupleSlot
Definition: execnodes.h:1075
PlanState ps
Definition: execnodes.h:1240
static TupleTableSlot * ExecClearTuple(TupleTableSlot *slot)
Definition: tuptable.h:433

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

Referenced by ExecEndNode().

◆ ExecInitResult()

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

Definition at line 181 of file nodeResult.c.

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);
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  */
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 }
ExprState * ExecInitQual(List *qual, PlanState *parent)
Definition: execExpr.c:213
PlanState * ExecInitNode(Plan *node, EState *estate, int eflags)
Definition: execProcnode.c:142
const TupleTableSlotOps TTSOpsVirtual
Definition: execTuples.c:83
void ExecInitResultTupleSlotTL(PlanState *planstate, const TupleTableSlotOps *tts_ops)
Definition: execTuples.c:1800
void ExecAssignExprContext(EState *estate, PlanState *planstate)
Definition: execUtils.c:488
void ExecAssignProjectionInfo(PlanState *planstate, TupleDesc inputDesc)
Definition: execUtils.c:543
#define EXEC_FLAG_BACKWARD
Definition: executor.h:68
#define EXEC_FLAG_MARK
Definition: executor.h:69
Assert(fmt[strlen(fmt) - 1] !='\n')
static TupleTableSlot * ExecResult(PlanState *pstate)
Definition: nodeResult.c:68
#define makeNode(_type_)
Definition: nodes.h:176
#define innerPlan(node)
Definition: plannodes.h:182
#define outerPlan(node)
Definition: plannodes.h:183
Definition: pg_list.h:54
ExprState * qual
Definition: execnodes.h:1058
Plan * plan
Definition: execnodes.h:1037
EState * state
Definition: execnodes.h:1039
ExecProcNodeMtd ExecProcNode
Definition: execnodes.h:1043
List * qual
Definition: plannodes.h:154
ExprState * resconstantqual
Definition: execnodes.h:1241
bool rs_done
Definition: execnodes.h:1242
bool rs_checkqual
Definition: execnodes.h:1243
Node * resconstantqual
Definition: plannodes.h:200
Plan plan
Definition: plannodes.h:199

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

Referenced by ExecInitNode().

◆ ExecReScanResult()

void ExecReScanResult ( ResultState node)

Definition at line 260 of file nodeResult.c.

261 {
263 
264  node->rs_done = false;
265  node->rs_checkqual = (node->resconstantqual != NULL);
266 
267  /*
268  * If chgParam of subnode is not null then plan will be re-scanned by
269  * first ExecProcNode.
270  */
271  if (outerPlan && outerPlan->chgParam == NULL)
273 }
void ExecReScan(PlanState *node)
Definition: execAmi.c:78

References ExecReScan(), outerPlan, outerPlanState, ResultState::resconstantqual, ResultState::rs_checkqual, and ResultState::rs_done.

Referenced by ExecReScan().

◆ ExecResultMarkPos()

void ExecResultMarkPos ( ResultState node)

Definition at line 147 of file nodeResult.c.

148 {
150 
151  if (outerPlan != NULL)
153  else
154  elog(DEBUG2, "Result nodes do not support mark/restore");
155 }
#define DEBUG2
Definition: elog.h:29
void ExecMarkPos(PlanState *node)
Definition: execAmi.c:328

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

Referenced by ExecMarkPos().

◆ ExecResultRestrPos()

void ExecResultRestrPos ( ResultState node)

Definition at line 162 of file nodeResult.c.

163 {
165 
166  if (outerPlan != NULL)
168  else
169  elog(ERROR, "Result nodes do not support mark/restore");
170 }
#define ERROR
Definition: elog.h:39
void ExecRestrPos(PlanState *node)
Definition: execAmi.c:377

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

Referenced by ExecRestrPos().