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

Go to the source code of this file.

Functions

ValuesScanStateExecInitValuesScan (ValuesScan *node, EState *estate, int eflags)
 
TupleTableSlotExecValuesScan (ValuesScanState *node)
 
void ExecEndValuesScan (ValuesScanState *node)
 
void ExecReScanValuesScan (ValuesScanState *node)
 

Function Documentation

void ExecEndValuesScan ( ValuesScanState node)

Definition at line 290 of file nodeValuesscan.c.

References ExecClearTuple(), ExecFreeExprContext(), ScanState::ps, PlanState::ps_ExprContext, PlanState::ps_ResultTupleSlot, ValuesScanState::rowcontext, ValuesScanState::ss, and ScanState::ss_ScanTupleSlot.

Referenced by ExecEndNode().

291 {
292  /*
293  * Free both exprcontexts
294  */
295  ExecFreeExprContext(&node->ss.ps);
296  node->ss.ps.ps_ExprContext = node->rowcontext;
297  ExecFreeExprContext(&node->ss.ps);
298 
299  /*
300  * clean out the tuple table
301  */
304 }
ExprContext * ps_ExprContext
Definition: execnodes.h:1078
TupleTableSlot * ExecClearTuple(TupleTableSlot *slot)
Definition: execTuples.c:439
TupleTableSlot * ss_ScanTupleSlot
Definition: execnodes.h:1291
void ExecFreeExprContext(PlanState *planstate)
Definition: execUtils.c:685
ScanState ss
Definition: execnodes.h:1580
PlanState ps
Definition: execnodes.h:1288
TupleTableSlot * ps_ResultTupleSlot
Definition: execnodes.h:1077
ExprContext * rowcontext
Definition: execnodes.h:1581
ValuesScanState* ExecInitValuesScan ( ValuesScan node,
EState estate,
int  eflags 
)

Definition at line 201 of file nodeValuesscan.c.

References ValuesScanState::array_len, Assert, ValuesScanState::curr_idx, ExecAssignExprContext(), ExecAssignResultTypeFromTL(), ExecAssignScanProjectionInfo(), ExecAssignScanType(), ExecInitExpr(), ExecInitResultTupleSlot(), ExecInitScanTupleSlot(), ExecTypeFromExprList(), ValuesScanState::exprlists, i, innerPlan, lfirst, linitial, list_length(), makeNode, NULL, outerPlan, palloc(), Scan::plan, PlanState::plan, ScanState::ps, PlanState::ps_ExprContext, Plan::qual, PlanState::qual, ValuesScanState::rowcontext, ValuesScan::scan, ValuesScanState::ss, PlanState::state, Plan::targetlist, PlanState::targetlist, and ValuesScan::values_lists.

Referenced by ExecInitNode().

202 {
203  ValuesScanState *scanstate;
204  TupleDesc tupdesc;
205  ListCell *vtl;
206  int i;
207  PlanState *planstate;
208 
209  /*
210  * ValuesScan should not have any children.
211  */
212  Assert(outerPlan(node) == NULL);
213  Assert(innerPlan(node) == NULL);
214 
215  /*
216  * create new ScanState for node
217  */
218  scanstate = makeNode(ValuesScanState);
219  scanstate->ss.ps.plan = (Plan *) node;
220  scanstate->ss.ps.state = estate;
221 
222  /*
223  * Miscellaneous initialization
224  */
225  planstate = &scanstate->ss.ps;
226 
227  /*
228  * Create expression contexts. We need two, one for per-sublist
229  * processing and one for execScan.c to use for quals and projections. We
230  * cheat a little by using ExecAssignExprContext() to build both.
231  */
232  ExecAssignExprContext(estate, planstate);
233  scanstate->rowcontext = planstate->ps_ExprContext;
234  ExecAssignExprContext(estate, planstate);
235 
236  /*
237  * tuple table initialization
238  */
239  ExecInitResultTupleSlot(estate, &scanstate->ss.ps);
240  ExecInitScanTupleSlot(estate, &scanstate->ss);
241 
242  /*
243  * initialize child expressions
244  */
245  scanstate->ss.ps.targetlist = (List *)
247  (PlanState *) scanstate);
248  scanstate->ss.ps.qual = (List *)
249  ExecInitExpr((Expr *) node->scan.plan.qual,
250  (PlanState *) scanstate);
251 
252  /*
253  * get info about values list
254  */
255  tupdesc = ExecTypeFromExprList((List *) linitial(node->values_lists));
256 
257  ExecAssignScanType(&scanstate->ss, tupdesc);
258 
259  /*
260  * Other node-specific setup
261  */
262  scanstate->curr_idx = -1;
263  scanstate->array_len = list_length(node->values_lists);
264 
265  /* convert list of sublists into array of sublists for easy addressing */
266  scanstate->exprlists = (List **)
267  palloc(scanstate->array_len * sizeof(List *));
268  i = 0;
269  foreach(vtl, node->values_lists)
270  {
271  scanstate->exprlists[i++] = (List *) lfirst(vtl);
272  }
273 
274  /*
275  * Initialize result tuple type and projection info.
276  */
277  ExecAssignResultTypeFromTL(&scanstate->ss.ps);
278  ExecAssignScanProjectionInfo(&scanstate->ss);
279 
280  return scanstate;
281 }
List * qual
Definition: plannodes.h:130
Plan plan
Definition: plannodes.h:305
void ExecInitScanTupleSlot(EState *estate, ScanState *scanstate)
Definition: execTuples.c:842
ExprContext * ps_ExprContext
Definition: execnodes.h:1078
List * qual
Definition: execnodes.h:1062
List * targetlist
Definition: execnodes.h:1061
List * values_lists
Definition: plannodes.h:495
EState * state
Definition: execnodes.h:1049
Scan scan
Definition: plannodes.h:494
void ExecAssignResultTypeFromTL(PlanState *planstate)
Definition: execUtils.c:430
ScanState ss
Definition: execnodes.h:1580
PlanState ps
Definition: execnodes.h:1288
ExprState * ExecInitExpr(Expr *node, PlanState *parent)
Definition: execQual.c:4266
#define linitial(l)
Definition: pg_list.h:110
void ExecAssignScanProjectionInfo(ScanState *node)
Definition: execScan.c:235
void ExecInitResultTupleSlot(EState *estate, PlanState *planstate)
Definition: execTuples.c:832
#define innerPlan(node)
Definition: plannodes.h:158
#define outerPlan(node)
Definition: plannodes.h:159
ExprContext * rowcontext
Definition: execnodes.h:1581
Plan * plan
Definition: execnodes.h:1047
#define makeNode(_type_)
Definition: nodes.h:557
#define NULL
Definition: c.h:226
#define Assert(condition)
Definition: c.h:671
#define lfirst(lc)
Definition: pg_list.h:106
void ExecAssignExprContext(EState *estate, PlanState *planstate)
Definition: execUtils.c:408
static int list_length(const List *l)
Definition: pg_list.h:89
List * targetlist
Definition: plannodes.h:129
TupleDesc ExecTypeFromExprList(List *exprList)
Definition: execTuples.c:947
void * palloc(Size size)
Definition: mcxt.c:891
int i
void ExecAssignScanType(ScanState *scanstate, TupleDesc tupDesc)
Definition: execUtils.c:709
List ** exprlists
Definition: execnodes.h:1582
Definition: pg_list.h:45
void ExecReScanValuesScan ( ValuesScanState node)

Definition at line 313 of file nodeValuesscan.c.

References ValuesScanState::curr_idx, ExecClearTuple(), ExecScanReScan(), ScanState::ps, PlanState::ps_ResultTupleSlot, and ValuesScanState::ss.

Referenced by ExecReScan().

314 {
316 
317  ExecScanReScan(&node->ss);
318 
319  node->curr_idx = -1;
320 }
TupleTableSlot * ExecClearTuple(TupleTableSlot *slot)
Definition: execTuples.c:439
ScanState ss
Definition: execnodes.h:1580
PlanState ps
Definition: execnodes.h:1288
TupleTableSlot * ps_ResultTupleSlot
Definition: execnodes.h:1077
void ExecScanReScan(ScanState *node)
Definition: execScan.c:327
TupleTableSlot* ExecValuesScan ( ValuesScanState node)

Definition at line 189 of file nodeValuesscan.c.

References ExecScan(), ValuesScanState::ss, ValuesNext(), and ValuesRecheck().

Referenced by ExecProcNode().

190 {
191  return ExecScan(&node->ss,
194 }
TupleTableSlot * ExecScan(ScanState *node, ExecScanAccessMtd accessMtd, ExecScanRecheckMtd recheckMtd)
Definition: execScan.c:121
ScanState ss
Definition: execnodes.h:1580
TupleTableSlot *(* ExecScanAccessMtd)(ScanState *node)
Definition: executor.h:271
bool(* ExecScanRecheckMtd)(ScanState *node, TupleTableSlot *slot)
Definition: executor.h:272
static TupleTableSlot * ValuesNext(ValuesScanState *node)
static bool ValuesRecheck(ValuesScanState *node, TupleTableSlot *slot)