158{
160
161 /* interrupt checks are in ExecScanFetch */
162
163 /*
164 * If we have neither a qual to check nor a projection to do, just skip
165 * all the overhead and return the raw scan tuple.
166 */
167 if (!qual && !projInfo)
168 {
171 }
172
173 /*
174 * Reset per-tuple memory context to free any expression evaluation
175 * storage allocated in the previous tuple cycle.
176 */
178
179 /*
180 * get a tuple from the access method. Loop until we obtain a tuple that
181 * passes the qualification.
182 */
183 for (;;)
184 {
186
188
189 /*
190 * if the slot returned by the accessMtd contains NULL, then it means
191 * there is nothing more to scan so we just return an empty slot,
192 * being careful to use the projection result slot so it has correct
193 * tupleDesc.
194 */
196 {
197 if (projInfo)
199 else
200 return slot;
201 }
202
203 /*
204 * place the current tuple into the expr context
205 */
207
208 /*
209 * check that the current tuple satisfies the qual-clause
210 *
211 * check for non-null qual here to avoid a function call to ExecQual()
212 * when the qual is null ... saves only a few cycles, but they add up
213 * ...
214 */
215 if (qual == NULL ||
ExecQual(qual, econtext))
216 {
217 /*
218 * Found a satisfactory scan tuple.
219 */
220 if (projInfo)
221 {
222 /*
223 * Form a projection tuple, store it in the result tuple slot
224 * and return it.
225 */
227 }
228 else
229 {
230 /*
231 * Here, we aren't projecting, so just return scan tuple.
232 */
233 return slot;
234 }
235 }
236 else
238
239 /*
240 * Tuple fails qual, so free per-tuple memory and try again.
241 */
243 }
244}
static pg_attribute_always_inline TupleTableSlot * ExecScanFetch(ScanState *node, EPQState *epqstate, ExecScanAccessMtd accessMtd, ExecScanRecheckMtd recheckMtd)
#define InstrCountFiltered1(node, delta)
static TupleTableSlot * ExecProject(ProjectionInfo *projInfo)
#define ResetExprContext(econtext)
static bool ExecQual(ExprState *state, ExprContext *econtext)
TupleTableSlot * ecxt_scantuple
TupleTableSlot * resultslot
ExprContext * ps_ExprContext
static TupleTableSlot * ExecClearTuple(TupleTableSlot *slot)