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

470 {
471  if (node->ss.ss_currentScanDesc)
473 
474  /*
475  * Free the exprcontext
476  */
477  ExecFreeExprContext(&node->ss.ps);
478 
479  /*
480  * clear out tuple table slots
481  */
482  if (node->ss.ps.ps_ResultTupleSlot)
485 }
static TupleTableSlot * ExecClearTuple(TupleTableSlot *slot)
Definition: tuptable.h:425
struct TableScanDescData * ss_currentScanDesc
Definition: execnodes.h:1332
TupleTableSlot * ss_ScanTupleSlot
Definition: execnodes.h:1333
void ExecFreeExprContext(PlanState *planstate)
Definition: execUtils.c:614
PlanState ps
Definition: execnodes.h:1330
TupleTableSlot * ps_ResultTupleSlot
Definition: execnodes.h:977
ScanState ss
Definition: execnodes.h:1618
static void table_endscan(TableScanDesc scan)
Definition: tableam.h:831

◆ ExecInitTidScan()

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

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

500 {
501  TidScanState *tidstate;
502  Relation currentRelation;
503 
504  /*
505  * create state structure
506  */
507  tidstate = makeNode(TidScanState);
508  tidstate->ss.ps.plan = (Plan *) node;
509  tidstate->ss.ps.state = estate;
510  tidstate->ss.ps.ExecProcNode = ExecTidScan;
511 
512  /*
513  * Miscellaneous initialization
514  *
515  * create expression context for node
516  */
517  ExecAssignExprContext(estate, &tidstate->ss.ps);
518 
519  /*
520  * mark tid list as not computed yet
521  */
522  tidstate->tss_TidList = NULL;
523  tidstate->tss_NumTids = 0;
524  tidstate->tss_TidPtr = -1;
525 
526  /*
527  * open the scan relation
528  */
529  currentRelation = ExecOpenScanRelation(estate, node->scan.scanrelid, eflags);
530 
531  tidstate->ss.ss_currentRelation = currentRelation;
532  tidstate->ss.ss_currentScanDesc = NULL; /* no heap scan here */
533 
534  /*
535  * get the scan type from the relation descriptor.
536  */
537  ExecInitScanTupleSlot(estate, &tidstate->ss,
538  RelationGetDescr(currentRelation),
539  table_slot_callbacks(currentRelation));
540 
541  /*
542  * Initialize result type and projection.
543  */
544  ExecInitResultTypeTL(&tidstate->ss.ps);
545  ExecAssignScanProjectionInfo(&tidstate->ss);
546 
547  /*
548  * initialize child expressions
549  */
550  tidstate->ss.ps.qual =
551  ExecInitQual(node->scan.plan.qual, (PlanState *) tidstate);
552 
553  TidExprListCreate(tidstate);
554 
555  /*
556  * all done.
557  */
558  return tidstate;
559 }
List * qual
Definition: plannodes.h:141
Plan plan
Definition: plannodes.h:340
Index scanrelid
Definition: plannodes.h:341
#define RelationGetDescr(relation)
Definition: rel.h:448
const TupleTableSlotOps * table_slot_callbacks(Relation relation)
Definition: tableam.c:44
struct TableScanDescData * ss_currentScanDesc
Definition: execnodes.h:1332
Relation ss_currentRelation
Definition: execnodes.h:1331
EState * state
Definition: execnodes.h:941
ExprState * ExecInitQual(List *qual, PlanState *parent)
Definition: execExpr.c:207
PlanState ps
Definition: execnodes.h:1330
ScanState ss
Definition: execnodes.h:1618
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:1623
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:573
Scan scan
Definition: plannodes.h:488
void ExecAssignExprContext(EState *estate, PlanState *planstate)
Definition: execUtils.c:444
ExprState * qual
Definition: execnodes.h:960
static TupleTableSlot * ExecTidScan(PlanState *pstate)
Definition: nodeTidscan.c:432

◆ ExecReScanTidScan()

void ExecReScanTidScan ( TidScanState node)

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

447 {
448  if (node->tss_TidList)
449  pfree(node->tss_TidList);
450  node->tss_TidList = NULL;
451  node->tss_NumTids = 0;
452  node->tss_TidPtr = -1;
453 
454  /* not really necessary, but seems good form */
455  if (node->ss.ss_currentScanDesc)
456  table_rescan(node->ss.ss_currentScanDesc, NULL);
457 
458  ExecScanReScan(&node->ss);
459 }
struct TableScanDescData * ss_currentScanDesc
Definition: execnodes.h:1332
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:1618
ItemPointerData * tss_TidList
Definition: execnodes.h:1623
void ExecScanReScan(ScanState *node)
Definition: execScan.c:299