1/*-------------------------------------------------------------------------
4 * This code provides support for generalized relation scans. ExecScan
5 * is passed a node and a pointer to a function to "do the right thing"
6 * and return a tuple from the relation. ExecScan then does the tedious
7 * stuff - checking the qualification and projecting the tuple
10 * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
11 * Portions Copyright (c) 1994, Regents of the University of California
15 * src/backend/executor/execScan.c
17 *-------------------------------------------------------------------------
25/* ----------------------------------------------------------------
28 * Scans the relation using the 'access method' indicated and
29 * returns the next qualifying tuple.
30 * The access method returns the next tuple and ExecScan() is
31 * responsible for checking the tuple returned against the qual-clause.
33 * A 'recheck method' must also be provided that can check an
34 * arbitrary tuple of the relation against any qual conditions
35 * that are implemented internal to the access method.
38 * -- the "cursor" maintained by the AMI is positioned at the tuple
39 * returned previously.
42 * -- the relation indicated is opened for scanning so that the
43 * "cursor" is positioned before the first qualifying tuple.
44 * ----------------------------------------------------------------
68 * ExecAssignScanProjectionInfo
69 * Set up projection info for a scan node, if necessary.
71 * We can avoid a projection step if the requested tlist exactly matches
72 * the underlying tuple type. If so, we just set ps_ProjInfo to NULL.
73 * Note that this case occurs not only for simple "SELECT * FROM ...", but
74 * also in most cases where there are joins or other processing nodes above
75 * the scan node, because the planner will preferentially generate a matching
78 * The scan slot's descriptor must have been set already.
90 * ExecAssignScanProjectionInfoWithVarno
91 * As above, but caller can specify varno expected in Vars in the tlist.
104 * This must be called within the ReScan function of any plan node type
105 * that uses ExecScan().
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.
119 * Rescan EvalPlanQual tuple(s) if we're inside an EvalPlanQual recheck.
120 * But don't lose the "blocked" status of blocked target relations.
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
int bms_next_member(const Bitmapset *a, int prevbit)
void ExecAssignScanProjectionInfoWithVarno(ScanState *node, int varno)
TupleTableSlot * ExecScan(ScanState *node, ExecScanAccessMtd accessMtd, ExecScanRecheckMtd recheckMtd)
void ExecAssignScanProjectionInfo(ScanState *node)
void ExecScanReScan(ScanState *node)
static pg_attribute_always_inline TupleTableSlot * ExecScanExtended(ScanState *node, ExecScanAccessMtd accessMtd, ExecScanRecheckMtd recheckMtd, EPQState *epqstate, ExprState *qual, ProjectionInfo *projInfo)
void ExecConditionalAssignProjectionInfo(PlanState *planstate, TupleDesc inputDesc, int varno)
bool(* ExecScanRecheckMtd)(ScanState *node, TupleTableSlot *slot)
TupleTableSlot *(* ExecScanAccessMtd)(ScanState *node)
Assert(PointerIsAligned(start, uint64))
#define IsA(nodeptr, _type_)
struct EPQState * es_epq_active
ProjectionInfo * ps_ProjInfo
TupleTableSlot * ss_ScanTupleSlot
TupleDesc tts_tupleDescriptor
static TupleTableSlot * ExecClearTuple(TupleTableSlot *slot)