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)
 
void ExecEndTidScan (TidScanState *node)
 
void ExecReScanTidScan (TidScanState *node)
 

Function Documentation

void ExecEndTidScan ( TidScanState node)

Definition at line 482 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().

483 {
484  /*
485  * Free the exprcontext
486  */
487  ExecFreeExprContext(&node->ss.ps);
488 
489  /*
490  * clear out tuple table slots
491  */
494 
495  /*
496  * close the heap relation.
497  */
499 }
TupleTableSlot * ExecClearTuple(TupleTableSlot *slot)
Definition: execTuples.c:439
TupleTableSlot * ss_ScanTupleSlot
Definition: execnodes.h:1101
Relation ss_currentRelation
Definition: execnodes.h:1099
void ExecFreeExprContext(PlanState *planstate)
Definition: execUtils.c:521
PlanState ps
Definition: execnodes.h:1098
TupleTableSlot * ps_ResultTupleSlot
Definition: execnodes.h:880
ScanState ss
Definition: execnodes.h:1375
void ExecCloseScanRelation(Relation scanrel)
Definition: execUtils.c:666
TidScanState* ExecInitTidScan ( TidScan node,
EState estate,
int  eflags 
)

Definition at line 513 of file nodeTidscan.c.

References ExecAssignExprContext(), ExecAssignResultTypeFromTL(), ExecAssignScanProjectionInfo(), ExecAssignScanType(), ExecInitQual(), ExecInitResultTupleSlot(), ExecInitScanTupleSlot(), ExecOpenScanRelation(), PlanState::ExecProcNode, ExecTidScan(), 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, TidExprListCreate(), TidScanState::tss_NumTids, TidScanState::tss_TidList, and TidScanState::tss_TidPtr.

Referenced by ExecInitNode().

514 {
515  TidScanState *tidstate;
516  Relation currentRelation;
517 
518  /*
519  * create state structure
520  */
521  tidstate = makeNode(TidScanState);
522  tidstate->ss.ps.plan = (Plan *) node;
523  tidstate->ss.ps.state = estate;
524  tidstate->ss.ps.ExecProcNode = ExecTidScan;
525 
526  /*
527  * Miscellaneous initialization
528  *
529  * create expression context for node
530  */
531  ExecAssignExprContext(estate, &tidstate->ss.ps);
532 
533  /*
534  * initialize child expressions
535  */
536  tidstate->ss.ps.qual =
537  ExecInitQual(node->scan.plan.qual, (PlanState *) tidstate);
538 
539  TidExprListCreate(tidstate);
540 
541  /*
542  * tuple table initialization
543  */
544  ExecInitResultTupleSlot(estate, &tidstate->ss.ps);
545  ExecInitScanTupleSlot(estate, &tidstate->ss);
546 
547  /*
548  * mark tid list as not computed yet
549  */
550  tidstate->tss_TidList = NULL;
551  tidstate->tss_NumTids = 0;
552  tidstate->tss_TidPtr = -1;
553 
554  /*
555  * open the base relation and acquire appropriate lock on it.
556  */
557  currentRelation = ExecOpenScanRelation(estate, node->scan.scanrelid, eflags);
558 
559  tidstate->ss.ss_currentRelation = currentRelation;
560  tidstate->ss.ss_currentScanDesc = NULL; /* no heap scan here */
561 
562  /*
563  * get the scan type from the relation descriptor.
564  */
565  ExecAssignScanType(&tidstate->ss, RelationGetDescr(currentRelation));
566 
567  /*
568  * Initialize result tuple type and projection info.
569  */
570  ExecAssignResultTypeFromTL(&tidstate->ss.ps);
571  ExecAssignScanProjectionInfo(&tidstate->ss);
572 
573  /*
574  * all done.
575  */
576  return tidstate;
577 }
List * qual
Definition: plannodes.h:145
Plan plan
Definition: plannodes.h:328
void ExecInitScanTupleSlot(EState *estate, ScanState *scanstate)
Definition: execTuples.c:842
Index scanrelid
Definition: plannodes.h:329
#define RelationGetDescr(relation)
Definition: rel.h:428
Relation ss_currentRelation
Definition: execnodes.h:1099
EState * state
Definition: execnodes.h:849
ExprState * ExecInitQual(List *qual, PlanState *parent)
Definition: execExpr.c:160
void ExecAssignResultTypeFromTL(PlanState *planstate)
Definition: execUtils.c:445
PlanState ps
Definition: execnodes.h:1098
ScanState ss
Definition: execnodes.h:1375
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:608
ItemPointerData * tss_TidList
Definition: execnodes.h:1380
static void TidExprListCreate(TidScanState *tidstate)
Definition: nodeTidscan.c:64
ExecProcNodeMtd ExecProcNode
Definition: execnodes.h:853
Plan * plan
Definition: execnodes.h:847
#define makeNode(_type_)
Definition: nodes.h:557
#define NULL
Definition: c.h:229
Scan scan
Definition: plannodes.h:475
void ExecAssignExprContext(EState *estate, PlanState *planstate)
Definition: execUtils.c:423
ExprState * qual
Definition: execnodes.h:865
HeapScanDesc ss_currentScanDesc
Definition: execnodes.h:1100
static TupleTableSlot * ExecTidScan(PlanState *pstate)
Definition: nodeTidscan.c:449
void ExecAssignScanType(ScanState *scanstate, TupleDesc tupDesc)
Definition: execUtils.c:545
void ExecReScanTidScan ( TidScanState node)

Definition at line 463 of file nodeTidscan.c.

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

Referenced by ExecReScan().

464 {
465  if (node->tss_TidList)
466  pfree(node->tss_TidList);
467  node->tss_TidList = NULL;
468  node->tss_NumTids = 0;
469  node->tss_TidPtr = -1;
470 
471  ExecScanReScan(&node->ss);
472 }
void pfree(void *pointer)
Definition: mcxt.c:950
ScanState ss
Definition: execnodes.h:1375
ItemPointerData * tss_TidList
Definition: execnodes.h:1380
#define NULL
Definition: c.h:229
void ExecScanReScan(ScanState *node)
Definition: execScan.c:327