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 476 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().

477 {
478  if (node->ss.ss_currentScanDesc)
480 
481  /*
482  * Free the exprcontext
483  */
484  ExecFreeExprContext(&node->ss.ps);
485 
486  /*
487  * clear out tuple table slots
488  */
489  if (node->ss.ps.ps_ResultTupleSlot)
492 }
static TupleTableSlot * ExecClearTuple(TupleTableSlot *slot)
Definition: tuptable.h:426
struct TableScanDescData * ss_currentScanDesc
Definition: execnodes.h:1333
TupleTableSlot * ss_ScanTupleSlot
Definition: execnodes.h:1334
void ExecFreeExprContext(PlanState *planstate)
Definition: execUtils.c:614
PlanState ps
Definition: execnodes.h:1331
TupleTableSlot * ps_ResultTupleSlot
Definition: execnodes.h:978
ScanState ss
Definition: execnodes.h:1619
static void table_endscan(TableScanDesc scan)
Definition: tableam.h:831

◆ ExecInitTidScan()

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

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

507 {
508  TidScanState *tidstate;
509  Relation currentRelation;
510 
511  /*
512  * create state structure
513  */
514  tidstate = makeNode(TidScanState);
515  tidstate->ss.ps.plan = (Plan *) node;
516  tidstate->ss.ps.state = estate;
517  tidstate->ss.ps.ExecProcNode = ExecTidScan;
518 
519  /*
520  * Miscellaneous initialization
521  *
522  * create expression context for node
523  */
524  ExecAssignExprContext(estate, &tidstate->ss.ps);
525 
526  /*
527  * mark tid list as not computed yet
528  */
529  tidstate->tss_TidList = NULL;
530  tidstate->tss_NumTids = 0;
531  tidstate->tss_TidPtr = -1;
532 
533  /*
534  * open the scan relation
535  */
536  currentRelation = ExecOpenScanRelation(estate, node->scan.scanrelid, eflags);
537 
538  tidstate->ss.ss_currentRelation = currentRelation;
539  tidstate->ss.ss_currentScanDesc = NULL; /* no heap scan here */
540 
541  /*
542  * get the scan type from the relation descriptor.
543  */
544  ExecInitScanTupleSlot(estate, &tidstate->ss,
545  RelationGetDescr(currentRelation),
546  table_slot_callbacks(currentRelation));
547 
548  /*
549  * Initialize result type and projection.
550  */
551  ExecInitResultTypeTL(&tidstate->ss.ps);
552  ExecAssignScanProjectionInfo(&tidstate->ss);
553 
554  /*
555  * initialize child expressions
556  */
557  tidstate->ss.ps.qual =
558  ExecInitQual(node->scan.plan.qual, (PlanState *) tidstate);
559 
560  TidExprListCreate(tidstate);
561 
562  /*
563  * all done.
564  */
565  return tidstate;
566 }
List * qual
Definition: plannodes.h:141
Plan plan
Definition: plannodes.h:340
Index scanrelid
Definition: plannodes.h:341
#define RelationGetDescr(relation)
Definition: rel.h:445
const TupleTableSlotOps * table_slot_callbacks(Relation relation)
Definition: tableam.c:44
struct TableScanDescData * ss_currentScanDesc
Definition: execnodes.h:1333
Relation ss_currentRelation
Definition: execnodes.h:1332
EState * state
Definition: execnodes.h:942
ExprState * ExecInitQual(List *qual, PlanState *parent)
Definition: execExpr.c:207
PlanState ps
Definition: execnodes.h:1331
ScanState ss
Definition: execnodes.h:1619
void ExecAssignScanProjectionInfo(ScanState *node)
Definition: execScan.c:272
Relation ExecOpenScanRelation(EState *estate, Index scanrelid, int eflags)
Definition: execUtils.c:693
ItemPointerData * tss_TidList
Definition: execnodes.h:1624
void ExecInitScanTupleSlot(EState *estate, ScanState *scanstate, TupleDesc tupledesc, const TupleTableSlotOps *tts_ops)
Definition: execTuples.c:1776
void ExecInitResultTypeTL(PlanState *planstate)
Definition: execTuples.c:1720
static void TidExprListCreate(TidScanState *tidstate)
Definition: nodeTidscan.c:65
ExecProcNodeMtd ExecProcNode
Definition: execnodes.h:946
Plan * plan
Definition: execnodes.h:940
#define makeNode(_type_)
Definition: nodes.h:573
Scan scan
Definition: plannodes.h:488
void ExecAssignExprContext(EState *estate, PlanState *planstate)
Definition: execUtils.c:444
ExprState * qual
Definition: execnodes.h:961
static TupleTableSlot * ExecTidScan(PlanState *pstate)
Definition: nodeTidscan.c:439

◆ ExecReScanTidScan()

void ExecReScanTidScan ( TidScanState node)

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

454 {
455  if (node->tss_TidList)
456  pfree(node->tss_TidList);
457  node->tss_TidList = NULL;
458  node->tss_NumTids = 0;
459  node->tss_TidPtr = -1;
460 
461  /* not really necessary, but seems good form */
462  if (node->ss.ss_currentScanDesc)
463  table_rescan(node->ss.ss_currentScanDesc, NULL);
464 
465  ExecScanReScan(&node->ss);
466 }
struct TableScanDescData * ss_currentScanDesc
Definition: execnodes.h:1333
static void table_rescan(TableScanDesc scan, struct ScanKeyData *key)
Definition: tableam.h:840
void pfree(void *pointer)
Definition: mcxt.c:1056
ScanState ss
Definition: execnodes.h:1619
ItemPointerData * tss_TidList
Definition: execnodes.h:1624
void ExecScanReScan(ScanState *node)
Definition: execScan.c:299