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

Go to the source code of this file.

Functions

TidScanStateExecInitTidScan (TidScan *node, EState *estate, int eflags)
 
TupleTableSlotExecTidScan (TidScanState *node)
 
void ExecEndTidScan (TidScanState *node)
 
void ExecReScanTidScan (TidScanState *node)
 

Function Documentation

void ExecEndTidScan ( TidScanState node)

Definition at line 420 of file nodeTidscan.c.

References ExecClearTuple(), ExecCloseScanRelation(), ExecFreeExprContext(), ScanState::ps, PlanState::ps_ResultTupleSlot, TidScanState::ss, ScanState::ss_currentRelation, and ScanState::ss_ScanTupleSlot.

Referenced by ExecEndNode().

421 {
422  /*
423  * Free the exprcontext
424  */
425  ExecFreeExprContext(&node->ss.ps);
426 
427  /*
428  * clear out tuple table slots
429  */
432 
433  /*
434  * close the heap relation.
435  */
437 }
TupleTableSlot * ExecClearTuple(TupleTableSlot *slot)
Definition: execTuples.c:439
TupleTableSlot * ss_ScanTupleSlot
Definition: execnodes.h:1291
Relation ss_currentRelation
Definition: execnodes.h:1289
void ExecFreeExprContext(PlanState *planstate)
Definition: execUtils.c:685
PlanState ps
Definition: execnodes.h:1288
TupleTableSlot * ps_ResultTupleSlot
Definition: execnodes.h:1077
ScanState ss
Definition: execnodes.h:1508
void ExecCloseScanRelation(Relation scanrel)
Definition: execUtils.c:830
TidScanState* ExecInitTidScan ( TidScan node,
EState estate,
int  eflags 
)

Definition at line 451 of file nodeTidscan.c.

References ExecAssignExprContext(), ExecAssignResultTypeFromTL(), ExecAssignScanProjectionInfo(), ExecAssignScanType(), ExecInitExpr(), ExecInitResultTupleSlot(), ExecInitScanTupleSlot(), ExecOpenScanRelation(), makeNode, NULL, Scan::plan, PlanState::plan, ScanState::ps, Plan::qual, PlanState::qual, RelationGetDescr, TidScan::scan, Scan::scanrelid, TidScanState::ss, ScanState::ss_currentRelation, ScanState::ss_currentScanDesc, PlanState::state, Plan::targetlist, PlanState::targetlist, TidScan::tidquals, TidScanState::tss_NumTids, TidScanState::tss_TidList, TidScanState::tss_TidPtr, and TidScanState::tss_tidquals.

Referenced by ExecInitNode().

452 {
453  TidScanState *tidstate;
454  Relation currentRelation;
455 
456  /*
457  * create state structure
458  */
459  tidstate = makeNode(TidScanState);
460  tidstate->ss.ps.plan = (Plan *) node;
461  tidstate->ss.ps.state = estate;
462 
463  /*
464  * Miscellaneous initialization
465  *
466  * create expression context for node
467  */
468  ExecAssignExprContext(estate, &tidstate->ss.ps);
469 
470  /*
471  * initialize child expressions
472  */
473  tidstate->ss.ps.targetlist = (List *)
475  (PlanState *) tidstate);
476  tidstate->ss.ps.qual = (List *)
477  ExecInitExpr((Expr *) node->scan.plan.qual,
478  (PlanState *) tidstate);
479 
480  tidstate->tss_tidquals = (List *)
481  ExecInitExpr((Expr *) node->tidquals,
482  (PlanState *) tidstate);
483 
484  /*
485  * tuple table initialization
486  */
487  ExecInitResultTupleSlot(estate, &tidstate->ss.ps);
488  ExecInitScanTupleSlot(estate, &tidstate->ss);
489 
490  /*
491  * mark tid list as not computed yet
492  */
493  tidstate->tss_TidList = NULL;
494  tidstate->tss_NumTids = 0;
495  tidstate->tss_TidPtr = -1;
496 
497  /*
498  * open the base relation and acquire appropriate lock on it.
499  */
500  currentRelation = ExecOpenScanRelation(estate, node->scan.scanrelid, eflags);
501 
502  tidstate->ss.ss_currentRelation = currentRelation;
503  tidstate->ss.ss_currentScanDesc = NULL; /* no heap scan here */
504 
505  /*
506  * get the scan type from the relation descriptor.
507  */
508  ExecAssignScanType(&tidstate->ss, RelationGetDescr(currentRelation));
509 
510  /*
511  * Initialize result tuple type and projection info.
512  */
513  ExecAssignResultTypeFromTL(&tidstate->ss.ps);
514  ExecAssignScanProjectionInfo(&tidstate->ss);
515 
516  /*
517  * all done.
518  */
519  return tidstate;
520 }
List * qual
Definition: plannodes.h:130
Plan plan
Definition: plannodes.h:305
void ExecInitScanTupleSlot(EState *estate, ScanState *scanstate)
Definition: execTuples.c:842
Index scanrelid
Definition: plannodes.h:306
#define RelationGetDescr(relation)
Definition: rel.h:425
List * tss_tidquals
Definition: execnodes.h:1509
List * tidquals
Definition: plannodes.h:452
List * qual
Definition: execnodes.h:1062
List * targetlist
Definition: execnodes.h:1061
Relation ss_currentRelation
Definition: execnodes.h:1289
EState * state
Definition: execnodes.h:1049
void ExecAssignResultTypeFromTL(PlanState *planstate)
Definition: execUtils.c:430
PlanState ps
Definition: execnodes.h:1288
ExprState * ExecInitExpr(Expr *node, PlanState *parent)
Definition: execQual.c:4266
ScanState ss
Definition: execnodes.h:1508
void ExecAssignScanProjectionInfo(ScanState *node)
Definition: execScan.c:235
void ExecInitResultTupleSlot(EState *estate, PlanState *planstate)
Definition: execTuples.c:832
Relation ExecOpenScanRelation(EState *estate, Index scanrelid, int eflags)
Definition: execUtils.c:772
ItemPointerData * tss_TidList
Definition: execnodes.h:1513
Plan * plan
Definition: execnodes.h:1047
#define makeNode(_type_)
Definition: nodes.h:556
#define NULL
Definition: c.h:226
Scan scan
Definition: plannodes.h:451
void ExecAssignExprContext(EState *estate, PlanState *planstate)
Definition: execUtils.c:408
List * targetlist
Definition: plannodes.h:129
HeapScanDesc ss_currentScanDesc
Definition: execnodes.h:1290
void ExecAssignScanType(ScanState *scanstate, TupleDesc tupDesc)
Definition: execUtils.c:709
Definition: pg_list.h:45
void ExecReScanTidScan ( TidScanState node)

Definition at line 401 of file nodeTidscan.c.

References ExecScanReScan(), NULL, pfree(), TidScanState::ss, TidScanState::tss_NumTids, TidScanState::tss_TidList, and TidScanState::tss_TidPtr.

Referenced by ExecReScan().

402 {
403  if (node->tss_TidList)
404  pfree(node->tss_TidList);
405  node->tss_TidList = NULL;
406  node->tss_NumTids = 0;
407  node->tss_TidPtr = -1;
408 
409  ExecScanReScan(&node->ss);
410 }
void pfree(void *pointer)
Definition: mcxt.c:992
ScanState ss
Definition: execnodes.h:1508
ItemPointerData * tss_TidList
Definition: execnodes.h:1513
#define NULL
Definition: c.h:226
void ExecScanReScan(ScanState *node)
Definition: execScan.c:327
TupleTableSlot* ExecTidScan ( TidScanState node)

Definition at line 389 of file nodeTidscan.c.

References ExecScan(), TidScanState::ss, TidNext(), and TidRecheck().

Referenced by ExecProcNode().

390 {
391  return ExecScan(&node->ss,
394 }
static TupleTableSlot * TidNext(TidScanState *node)
Definition: nodeTidscan.c:249
TupleTableSlot * ExecScan(ScanState *node, ExecScanAccessMtd accessMtd, ExecScanRecheckMtd recheckMtd)
Definition: execScan.c:121
static bool TidRecheck(TidScanState *node, TupleTableSlot *slot)
Definition: nodeTidscan.c:359
TupleTableSlot *(* ExecScanAccessMtd)(ScanState *node)
Definition: executor.h:271
bool(* ExecScanRecheckMtd)(ScanState *node, TupleTableSlot *slot)
Definition: executor.h:272
ScanState ss
Definition: execnodes.h:1508