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

472 {
473  if (node->ss.ss_currentScanDesc)
475 
476  /*
477  * Free the exprcontext
478  */
479  ExecFreeExprContext(&node->ss.ps);
480 
481  /*
482  * clear out tuple table slots
483  */
484  if (node->ss.ps.ps_ResultTupleSlot)
487 }
void ExecFreeExprContext(PlanState *planstate)
Definition: execUtils.c:651
TupleTableSlot * ps_ResultTupleSlot
Definition: execnodes.h:1062
TupleTableSlot * ss_ScanTupleSlot
Definition: execnodes.h:1452
PlanState ps
Definition: execnodes.h:1449
struct TableScanDescData * ss_currentScanDesc
Definition: execnodes.h:1451
ScanState ss
Definition: execnodes.h:1737
static void table_endscan(TableScanDesc scan)
Definition: tableam.h:993
static TupleTableSlot * ExecClearTuple(TupleTableSlot *slot)
Definition: tuptable.h:433

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

Referenced by ExecEndNode().

◆ ExecInitTidScan()

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

Definition at line 501 of file nodeTidscan.c.

502 {
503  TidScanState *tidstate;
504  Relation currentRelation;
505 
506  /*
507  * create state structure
508  */
509  tidstate = makeNode(TidScanState);
510  tidstate->ss.ps.plan = (Plan *) node;
511  tidstate->ss.ps.state = estate;
512  tidstate->ss.ps.ExecProcNode = ExecTidScan;
513 
514  /*
515  * Miscellaneous initialization
516  *
517  * create expression context for node
518  */
519  ExecAssignExprContext(estate, &tidstate->ss.ps);
520 
521  /*
522  * mark tid list as not computed yet
523  */
524  tidstate->tss_TidList = NULL;
525  tidstate->tss_NumTids = 0;
526  tidstate->tss_TidPtr = -1;
527 
528  /*
529  * open the scan relation
530  */
531  currentRelation = ExecOpenScanRelation(estate, node->scan.scanrelid, eflags);
532 
533  tidstate->ss.ss_currentRelation = currentRelation;
534  tidstate->ss.ss_currentScanDesc = NULL; /* no heap scan here */
535 
536  /*
537  * get the scan type from the relation descriptor.
538  */
539  ExecInitScanTupleSlot(estate, &tidstate->ss,
540  RelationGetDescr(currentRelation),
541  table_slot_callbacks(currentRelation));
542 
543  /*
544  * Initialize result type and projection.
545  */
546  ExecInitResultTypeTL(&tidstate->ss.ps);
547  ExecAssignScanProjectionInfo(&tidstate->ss);
548 
549  /*
550  * initialize child expressions
551  */
552  tidstate->ss.ps.qual =
553  ExecInitQual(node->scan.plan.qual, (PlanState *) tidstate);
554 
555  TidExprListCreate(tidstate);
556 
557  /*
558  * all done.
559  */
560  return tidstate;
561 }
ExprState * ExecInitQual(List *qual, PlanState *parent)
Definition: execExpr.c:210
void ExecAssignScanProjectionInfo(ScanState *node)
Definition: execScan.c:272
void ExecInitScanTupleSlot(EState *estate, ScanState *scanstate, TupleDesc tupledesc, const TupleTableSlotOps *tts_ops)
Definition: execTuples.c:1811
void ExecInitResultTypeTL(PlanState *planstate)
Definition: execTuples.c:1755
void ExecAssignExprContext(EState *estate, PlanState *planstate)
Definition: execUtils.c:481
Relation ExecOpenScanRelation(EState *estate, Index scanrelid, int eflags)
Definition: execUtils.c:721
static TupleTableSlot * ExecTidScan(PlanState *pstate)
Definition: nodeTidscan.c:434
static void TidExprListCreate(TidScanState *tidstate)
Definition: nodeTidscan.c:71
#define makeNode(_type_)
Definition: nodes.h:159
#define RelationGetDescr(relation)
Definition: rel.h:527
ExprState * qual
Definition: execnodes.h:1045
Plan * plan
Definition: execnodes.h:1024
EState * state
Definition: execnodes.h:1026
ExecProcNodeMtd ExecProcNode
Definition: execnodes.h:1030
Relation ss_currentRelation
Definition: execnodes.h:1450
Index scanrelid
Definition: plannodes.h:384
ItemPointerData * tss_TidList
Definition: execnodes.h:1742
Scan scan
Definition: plannodes.h:549
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 448 of file nodeTidscan.c.

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

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

Referenced by ExecReScan().