PostgreSQL Source Code git master
execScan.c File Reference
#include "postgres.h"
#include "executor/executor.h"
#include "executor/execScan.h"
#include "miscadmin.h"
Include dependency graph for execScan.c:

Go to the source code of this file.

Functions

TupleTableSlotExecScan (ScanState *node, ExecScanAccessMtd accessMtd, ExecScanRecheckMtd recheckMtd)
 
void ExecAssignScanProjectionInfo (ScanState *node)
 
void ExecAssignScanProjectionInfoWithVarno (ScanState *node, int varno)
 
void ExecScanReScan (ScanState *node)
 

Function Documentation

◆ ExecAssignScanProjectionInfo()

◆ ExecAssignScanProjectionInfoWithVarno()

void ExecAssignScanProjectionInfoWithVarno ( ScanState node,
int  varno 
)

◆ ExecScan()

TupleTableSlot * ExecScan ( ScanState node,
ExecScanAccessMtd  accessMtd,
ExecScanRecheckMtd  recheckMtd 
)

Definition at line 47 of file execScan.c.

50{
51 EPQState *epqstate;
52 ExprState *qual;
53 ProjectionInfo *projInfo;
54
55 epqstate = node->ps.state->es_epq_active;
56 qual = node->ps.qual;
57 projInfo = node->ps.ps_ProjInfo;
58
59 return ExecScanExtended(node,
60 accessMtd,
61 recheckMtd,
62 epqstate,
63 qual,
64 projInfo);
65}
static pg_attribute_always_inline TupleTableSlot * ExecScanExtended(ScanState *node, ExecScanAccessMtd accessMtd, ExecScanRecheckMtd recheckMtd, EPQState *epqstate, ExprState *qual, ProjectionInfo *projInfo)
Definition: execScan.h:152
struct EPQState * es_epq_active
Definition: execnodes.h:741
ExprState * qual
Definition: execnodes.h:1180
EState * state
Definition: execnodes.h:1161
ProjectionInfo * ps_ProjInfo
Definition: execnodes.h:1199

References EState::es_epq_active, ExecScanExtended(), ScanState::ps, PlanState::ps_ProjInfo, PlanState::qual, and PlanState::state.

Referenced by ExecBitmapHeapScan(), ExecCteScan(), ExecForeignScan(), ExecFunctionScan(), ExecIndexOnlyScan(), ExecIndexScan(), ExecNamedTuplestoreScan(), ExecSampleScan(), ExecSeqScanEPQ(), ExecSubqueryScan(), ExecTableFuncScan(), ExecTidRangeScan(), ExecTidScan(), ExecValuesScan(), and ExecWorkTableScan().

◆ ExecScanReScan()

void ExecScanReScan ( ScanState node)

Definition at line 108 of file execScan.c.

109{
110 EState *estate = node->ps.state;
111
112 /*
113 * We must clear the scan tuple so that observers (e.g., execCurrent.c)
114 * can tell that this plan node is not positioned on a tuple.
115 */
117
118 /*
119 * Rescan EvalPlanQual tuple(s) if we're inside an EvalPlanQual recheck.
120 * But don't lose the "blocked" status of blocked target relations.
121 */
122 if (estate->es_epq_active != NULL)
123 {
124 EPQState *epqstate = estate->es_epq_active;
125 Index scanrelid = ((Scan *) node->ps.plan)->scanrelid;
126
127 if (scanrelid > 0)
128 epqstate->relsubs_done[scanrelid - 1] =
129 epqstate->relsubs_blocked[scanrelid - 1];
130 else
131 {
132 Bitmapset *relids;
133 int rtindex = -1;
134
135 /*
136 * If an FDW or custom scan provider has replaced the join with a
137 * scan, there are multiple RTIs; reset the epqScanDone flag for
138 * all of them.
139 */
140 if (IsA(node->ps.plan, ForeignScan))
141 relids = ((ForeignScan *) node->ps.plan)->fs_base_relids;
142 else if (IsA(node->ps.plan, CustomScan))
143 relids = ((CustomScan *) node->ps.plan)->custom_relids;
144 else
145 elog(ERROR, "unexpected scan node: %d",
146 (int) nodeTag(node->ps.plan));
147
148 while ((rtindex = bms_next_member(relids, rtindex)) >= 0)
149 {
150 Assert(rtindex > 0);
151 epqstate->relsubs_done[rtindex - 1] =
152 epqstate->relsubs_blocked[rtindex - 1];
153 }
154 }
155 }
156}
int bms_next_member(const Bitmapset *a, int prevbit)
Definition: bitmapset.c:1306
unsigned int Index
Definition: c.h:585
#define ERROR
Definition: elog.h:39
#define elog(elevel,...)
Definition: elog.h:225
Assert(PointerIsAligned(start, uint64))
#define IsA(nodeptr, _type_)
Definition: nodes.h:164
#define nodeTag(nodeptr)
Definition: nodes.h:139
bool * relsubs_blocked
Definition: execnodes.h:1350
bool * relsubs_done
Definition: execnodes.h:1341
static TupleTableSlot * ExecClearTuple(TupleTableSlot *slot)
Definition: tuptable.h:458

References Assert(), bms_next_member(), elog, ERROR, EState::es_epq_active, ExecClearTuple(), IsA, nodeTag, PlanState::plan, ScanState::ps, EPQState::relsubs_blocked, EPQState::relsubs_done, ScanState::ss_ScanTupleSlot, and PlanState::state.

Referenced by ExecReScanBitmapHeapScan(), ExecReScanCteScan(), ExecReScanForeignScan(), ExecReScanFunctionScan(), ExecReScanIndexOnlyScan(), ExecReScanIndexScan(), ExecReScanNamedTuplestoreScan(), ExecReScanSampleScan(), ExecReScanSeqScan(), ExecReScanSubqueryScan(), ExecReScanTableFuncScan(), ExecReScanTidRangeScan(), ExecReScanTidScan(), ExecReScanValuesScan(), and ExecReScanWorkTableScan().