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 470 of file nodeTidscan.c.

471 {
472  if (node->ss.ss_currentScanDesc)
474 }
struct TableScanDescData * ss_currentScanDesc
Definition: execnodes.h:1567
ScanState ss
Definition: execnodes.h:1843
static void table_endscan(TableScanDesc scan)
Definition: tableam.h:1029

References TidScanState::ss, ScanState::ss_currentScanDesc, and table_endscan().

Referenced by ExecEndNode().

◆ ExecInitTidScan()

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

Definition at line 488 of file nodeTidscan.c.

489 {
490  TidScanState *tidstate;
491  Relation currentRelation;
492 
493  /*
494  * create state structure
495  */
496  tidstate = makeNode(TidScanState);
497  tidstate->ss.ps.plan = (Plan *) node;
498  tidstate->ss.ps.state = estate;
499  tidstate->ss.ps.ExecProcNode = ExecTidScan;
500 
501  /*
502  * Miscellaneous initialization
503  *
504  * create expression context for node
505  */
506  ExecAssignExprContext(estate, &tidstate->ss.ps);
507 
508  /*
509  * mark tid list as not computed yet
510  */
511  tidstate->tss_TidList = NULL;
512  tidstate->tss_NumTids = 0;
513  tidstate->tss_TidPtr = -1;
514 
515  /*
516  * open the scan relation
517  */
518  currentRelation = ExecOpenScanRelation(estate, node->scan.scanrelid, eflags);
519 
520  tidstate->ss.ss_currentRelation = currentRelation;
521  tidstate->ss.ss_currentScanDesc = NULL; /* no heap scan here */
522 
523  /*
524  * get the scan type from the relation descriptor.
525  */
526  ExecInitScanTupleSlot(estate, &tidstate->ss,
527  RelationGetDescr(currentRelation),
528  table_slot_callbacks(currentRelation));
529 
530  /*
531  * Initialize result type and projection.
532  */
533  ExecInitResultTypeTL(&tidstate->ss.ps);
534  ExecAssignScanProjectionInfo(&tidstate->ss);
535 
536  /*
537  * initialize child expressions
538  */
539  tidstate->ss.ps.qual =
540  ExecInitQual(node->scan.plan.qual, (PlanState *) tidstate);
541 
542  TidExprListCreate(tidstate);
543 
544  /*
545  * all done.
546  */
547  return tidstate;
548 }
ExprState * ExecInitQual(List *qual, PlanState *parent)
Definition: execExpr.c:220
void ExecAssignScanProjectionInfo(ScanState *node)
Definition: execScan.c:270
void ExecInitScanTupleSlot(EState *estate, ScanState *scanstate, TupleDesc tupledesc, const TupleTableSlotOps *tts_ops)
Definition: execTuples.c:1898
void ExecInitResultTypeTL(PlanState *planstate)
Definition: execTuples.c:1842
void ExecAssignExprContext(EState *estate, PlanState *planstate)
Definition: execUtils.c:483
Relation ExecOpenScanRelation(EState *estate, Index scanrelid, int eflags)
Definition: execUtils.c:697
static TupleTableSlot * ExecTidScan(PlanState *pstate)
Definition: nodeTidscan.c:433
static void TidExprListCreate(TidScanState *tidstate)
Definition: nodeTidscan.c:70
#define makeNode(_type_)
Definition: nodes.h:155
#define RelationGetDescr(relation)
Definition: rel.h:531
ExprState * qual
Definition: execnodes.h:1139
Plan * plan
Definition: execnodes.h:1118
EState * state
Definition: execnodes.h:1120
ExecProcNodeMtd ExecProcNode
Definition: execnodes.h:1124
Relation ss_currentRelation
Definition: execnodes.h:1566
PlanState ps
Definition: execnodes.h:1565
Index scanrelid
Definition: plannodes.h:389
ItemPointerData * tss_TidList
Definition: execnodes.h:1848
Scan scan
Definition: plannodes.h:554
const TupleTableSlotOps * table_slot_callbacks(Relation relation)
Definition: tableam.c:58

References ExecAssignExprContext(), ExecAssignScanProjectionInfo(), ExecInitQual(), ExecInitResultTypeTL(), ExecInitScanTupleSlot(), ExecOpenScanRelation(), PlanState::ExecProcNode, ExecTidScan(), makeNode, PlanState::plan, ScanState::ps, 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().

◆ ExecReScanTidScan()

void ExecReScanTidScan ( TidScanState node)

Definition at line 447 of file nodeTidscan.c.

448 {
449  if (node->tss_TidList)
450  pfree(node->tss_TidList);
451  node->tss_TidList = NULL;
452  node->tss_NumTids = 0;
453  node->tss_TidPtr = -1;
454 
455  /* not really necessary, but seems good form */
456  if (node->ss.ss_currentScanDesc)
457  table_rescan(node->ss.ss_currentScanDesc, NULL);
458 
459  ExecScanReScan(&node->ss);
460 }
void ExecScanReScan(ScanState *node)
Definition: execScan.c:297
void pfree(void *pointer)
Definition: mcxt.c:1520
static void table_rescan(TableScanDesc scan, struct ScanKeyData *key)
Definition: tableam.h:1038

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

Referenced by ExecReScan().