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

467 {
468  if (node->ss.ss_currentScanDesc)
470 
471  /*
472  * Free the exprcontext
473  */
474  ExecFreeExprContext(&node->ss.ps);
475 
476  /*
477  * clear out tuple table slots
478  */
479  if (node->ss.ps.ps_ResultTupleSlot)
482 }
void ExecFreeExprContext(PlanState *planstate)
Definition: execUtils.c:650
TupleTableSlot * ps_ResultTupleSlot
Definition: execnodes.h:1036
TupleTableSlot * ss_ScanTupleSlot
Definition: execnodes.h:1426
PlanState ps
Definition: execnodes.h:1423
struct TableScanDescData * ss_currentScanDesc
Definition: execnodes.h:1425
ScanState ss
Definition: execnodes.h:1711
static void table_endscan(TableScanDesc scan)
Definition: tableam.h:993
static TupleTableSlot * ExecClearTuple(TupleTableSlot *slot)
Definition: tuptable.h:425

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

497 {
498  TidScanState *tidstate;
499  Relation currentRelation;
500 
501  /*
502  * create state structure
503  */
504  tidstate = makeNode(TidScanState);
505  tidstate->ss.ps.plan = (Plan *) node;
506  tidstate->ss.ps.state = estate;
507  tidstate->ss.ps.ExecProcNode = ExecTidScan;
508 
509  /*
510  * Miscellaneous initialization
511  *
512  * create expression context for node
513  */
514  ExecAssignExprContext(estate, &tidstate->ss.ps);
515 
516  /*
517  * mark tid list as not computed yet
518  */
519  tidstate->tss_TidList = NULL;
520  tidstate->tss_NumTids = 0;
521  tidstate->tss_TidPtr = -1;
522 
523  /*
524  * open the scan relation
525  */
526  currentRelation = ExecOpenScanRelation(estate, node->scan.scanrelid, eflags);
527 
528  tidstate->ss.ss_currentRelation = currentRelation;
529  tidstate->ss.ss_currentScanDesc = NULL; /* no heap scan here */
530 
531  /*
532  * get the scan type from the relation descriptor.
533  */
534  ExecInitScanTupleSlot(estate, &tidstate->ss,
535  RelationGetDescr(currentRelation),
536  table_slot_callbacks(currentRelation));
537 
538  /*
539  * Initialize result type and projection.
540  */
541  ExecInitResultTypeTL(&tidstate->ss.ps);
542  ExecAssignScanProjectionInfo(&tidstate->ss);
543 
544  /*
545  * initialize child expressions
546  */
547  tidstate->ss.ps.qual =
548  ExecInitQual(node->scan.plan.qual, (PlanState *) tidstate);
549 
550  TidExprListCreate(tidstate);
551 
552  /*
553  * all done.
554  */
555  return tidstate;
556 }
ExprState * ExecInitQual(List *qual, PlanState *parent)
Definition: execExpr.c:209
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:480
Relation ExecOpenScanRelation(EState *estate, Index scanrelid, int eflags)
Definition: execUtils.c:720
static TupleTableSlot * ExecTidScan(PlanState *pstate)
Definition: nodeTidscan.c:429
static void TidExprListCreate(TidScanState *tidstate)
Definition: nodeTidscan.c:66
#define makeNode(_type_)
Definition: nodes.h:622
#define RelationGetDescr(relation)
Definition: rel.h:514
ExprState * qual
Definition: execnodes.h:1019
Plan * plan
Definition: execnodes.h:998
EState * state
Definition: execnodes.h:1000
ExecProcNodeMtd ExecProcNode
Definition: execnodes.h:1004
List * qual
Definition: plannodes.h:143
Relation ss_currentRelation
Definition: execnodes.h:1424
Plan plan
Definition: plannodes.h:371
Index scanrelid
Definition: plannodes.h:372
ItemPointerData * tss_TidList
Definition: execnodes.h:1716
Scan scan
Definition: plannodes.h:537
const TupleTableSlotOps * table_slot_callbacks(Relation relation)
Definition: tableam.c:58

References ExecAssignExprContext(), ExecAssignScanProjectionInfo(), ExecInitQual(), ExecInitResultTypeTL(), ExecInitScanTupleSlot(), ExecOpenScanRelation(), PlanState::ExecProcNode, ExecTidScan(), makeNode, PlanState::plan, Scan::plan, ScanState::ps, PlanState::qual, Plan::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 443 of file nodeTidscan.c.

444 {
445  if (node->tss_TidList)
446  pfree(node->tss_TidList);
447  node->tss_TidList = NULL;
448  node->tss_NumTids = 0;
449  node->tss_TidPtr = -1;
450 
451  /* not really necessary, but seems good form */
452  if (node->ss.ss_currentScanDesc)
453  table_rescan(node->ss.ss_currentScanDesc, NULL);
454 
455  ExecScanReScan(&node->ss);
456 }
void ExecScanReScan(ScanState *node)
Definition: execScan.c:299
void pfree(void *pointer)
Definition: mcxt.c:1175
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().