PostgreSQL Source Code  git master
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

◆ ExecEndTidScan()

void ExecEndTidScan ( TidScanState node)

Definition at line 468 of file nodeTidscan.c.

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

Referenced by ExecEndNode().

469 {
470  if (node->ss.ss_currentScanDesc)
472 
473  /*
474  * Free the exprcontext
475  */
476  ExecFreeExprContext(&node->ss.ps);
477 
478  /*
479  * clear out tuple table slots
480  */
481  if (node->ss.ps.ps_ResultTupleSlot)
484 }
static TupleTableSlot * ExecClearTuple(TupleTableSlot *slot)
Definition: tuptable.h:425
struct TableScanDescData * ss_currentScanDesc
Definition: execnodes.h:1330
TupleTableSlot * ss_ScanTupleSlot
Definition: execnodes.h:1331
void ExecFreeExprContext(PlanState *planstate)
Definition: execUtils.c:649
PlanState ps
Definition: execnodes.h:1328
TupleTableSlot * ps_ResultTupleSlot
Definition: execnodes.h:977
ScanState ss
Definition: execnodes.h:1616
static void table_endscan(TableScanDesc scan)
Definition: tableam.h:863

◆ ExecInitTidScan()

TidScanState* ExecInitTidScan ( TidScan node,
EState estate,
int  eflags 
)

Definition at line 498 of file nodeTidscan.c.

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

Referenced by ExecInitNode().

499 {
500  TidScanState *tidstate;
501  Relation currentRelation;
502 
503  /*
504  * create state structure
505  */
506  tidstate = makeNode(TidScanState);
507  tidstate->ss.ps.plan = (Plan *) node;
508  tidstate->ss.ps.state = estate;
509  tidstate->ss.ps.ExecProcNode = ExecTidScan;
510 
511  /*
512  * Miscellaneous initialization
513  *
514  * create expression context for node
515  */
516  ExecAssignExprContext(estate, &tidstate->ss.ps);
517 
518  /*
519  * mark tid list as not computed yet
520  */
521  tidstate->tss_TidList = NULL;
522  tidstate->tss_NumTids = 0;
523  tidstate->tss_TidPtr = -1;
524 
525  /*
526  * open the scan relation
527  */
528  currentRelation = ExecOpenScanRelation(estate, node->scan.scanrelid, eflags);
529 
530  tidstate->ss.ss_currentRelation = currentRelation;
531  tidstate->ss.ss_currentScanDesc = NULL; /* no heap scan here */
532 
533  /*
534  * get the scan type from the relation descriptor.
535  */
536  ExecInitScanTupleSlot(estate, &tidstate->ss,
537  RelationGetDescr(currentRelation),
538  table_slot_callbacks(currentRelation));
539 
540  /*
541  * Initialize result type and projection.
542  */
543  ExecInitResultTypeTL(&tidstate->ss.ps);
544  ExecAssignScanProjectionInfo(&tidstate->ss);
545 
546  /*
547  * initialize child expressions
548  */
549  tidstate->ss.ps.qual =
550  ExecInitQual(node->scan.plan.qual, (PlanState *) tidstate);
551 
552  TidExprListCreate(tidstate);
553 
554  /*
555  * all done.
556  */
557  return tidstate;
558 }
List * qual
Definition: plannodes.h:137
Plan plan
Definition: plannodes.h:336
Index scanrelid
Definition: plannodes.h:337
#define RelationGetDescr(relation)
Definition: rel.h:482
const TupleTableSlotOps * table_slot_callbacks(Relation relation)
Definition: tableam.c:58
struct TableScanDescData * ss_currentScanDesc
Definition: execnodes.h:1330
Relation ss_currentRelation
Definition: execnodes.h:1329
EState * state
Definition: execnodes.h:941
ExprState * ExecInitQual(List *qual, PlanState *parent)
Definition: execExpr.c:209
PlanState ps
Definition: execnodes.h:1328
ScanState ss
Definition: execnodes.h:1616
void ExecAssignScanProjectionInfo(ScanState *node)
Definition: execScan.c:272
Relation ExecOpenScanRelation(EState *estate, Index scanrelid, int eflags)
Definition: execUtils.c:719
ItemPointerData * tss_TidList
Definition: execnodes.h:1621
void ExecInitScanTupleSlot(EState *estate, ScanState *scanstate, TupleDesc tupledesc, const TupleTableSlotOps *tts_ops)
Definition: execTuples.c:1781
void ExecInitResultTypeTL(PlanState *planstate)
Definition: execTuples.c:1725
static void TidExprListCreate(TidScanState *tidstate)
Definition: nodeTidscan.c:66
ExecProcNodeMtd ExecProcNode
Definition: execnodes.h:945
Plan * plan
Definition: execnodes.h:939
#define makeNode(_type_)
Definition: nodes.h:576
Scan scan
Definition: plannodes.h:484
void ExecAssignExprContext(EState *estate, PlanState *planstate)
Definition: execUtils.c:479
ExprState * qual
Definition: execnodes.h:960
static TupleTableSlot * ExecTidScan(PlanState *pstate)
Definition: nodeTidscan.c:431

◆ ExecReScanTidScan()

void ExecReScanTidScan ( TidScanState node)

Definition at line 445 of file nodeTidscan.c.

References ExecScanReScan(), pfree(), TidScanState::ss, ScanState::ss_currentScanDesc, table_rescan(), TidScanState::tss_NumTids, TidScanState::tss_TidList, and TidScanState::tss_TidPtr.

Referenced by ExecReScan().

446 {
447  if (node->tss_TidList)
448  pfree(node->tss_TidList);
449  node->tss_TidList = NULL;
450  node->tss_NumTids = 0;
451  node->tss_TidPtr = -1;
452 
453  /* not really necessary, but seems good form */
454  if (node->ss.ss_currentScanDesc)
455  table_rescan(node->ss.ss_currentScanDesc, NULL);
456 
457  ExecScanReScan(&node->ss);
458 }
struct TableScanDescData * ss_currentScanDesc
Definition: execnodes.h:1330
static void table_rescan(TableScanDesc scan, struct ScanKeyData *key)
Definition: tableam.h:872
void pfree(void *pointer)
Definition: mcxt.c:1057
ScanState ss
Definition: execnodes.h:1616
ItemPointerData * tss_TidList
Definition: execnodes.h:1621
void ExecScanReScan(ScanState *node)
Definition: execScan.c:299