211{
217
218 /*
219 * ValuesScan should not have any children.
220 */
223
224 /*
225 * create new ScanState for node
226 */
231
232 /*
233 * Miscellaneous initialization
234 */
235 planstate = &scanstate->
ss.
ps;
236
237 /*
238 * Create expression contexts. We need two, one for per-sublist
239 * processing and one for execScan.c to use for quals and projections. We
240 * cheat a little by using ExecAssignExprContext() to build both.
241 */
245
246 /*
247 * Get info about values list, initialize scan slot with it.
248 */
251
252 /*
253 * Initialize result type and projection.
254 */
257
258 /*
259 * initialize child expressions
260 */
263
264 /*
265 * Other node-specific setup
266 */
269
270 /*
271 * Convert the list of expression sublists into an array for easier
272 * addressing at runtime. Also, detect whether any sublists contain
273 * SubPlans; for just those sublists, go ahead and do expression
274 * initialization. (This avoids problems with SubPlans wanting to connect
275 * themselves up to the outer plan tree. Notably, EXPLAIN won't see the
276 * subplans otherwise; also we will have troubles with dangling pointers
277 * and/or leaked resources if we try to handle SubPlans the same as
278 * simpler expressions.)
279 */
286 {
288
290
291 /*
292 * We can avoid the cost of a contain_subplans() scan in the simple
293 * case where there are no SubPlans anywhere.
294 */
297 {
298 int saved_jit_flags;
299
300 /*
301 * As these expressions are only used once, disable JIT for them.
302 * This is worthwhile because it's common to insert significant
303 * amounts of data via VALUES(). Note that this doesn't prevent
304 * use of JIT *within* a subplan, since that's initialized
305 * separately; this just affects the upper-level subexpressions.
306 */
309
312
314 }
316 }
317
318 return scanstate;
319}
bool contain_subplans(Node *clause)
ExprState * ExecInitQual(List *qual, PlanState *parent)
List * ExecInitExprList(List *nodes, PlanState *parent)
void ExecAssignScanProjectionInfo(ScanState *node)
const TupleTableSlotOps TTSOpsVirtual
void ExecInitScanTupleSlot(EState *estate, ScanState *scanstate, TupleDesc tupledesc, const TupleTableSlotOps *tts_ops)
void ExecInitResultTypeTL(PlanState *planstate)
TupleDesc ExecTypeFromExprList(List *exprList)
void ExecAssignExprContext(EState *estate, PlanState *planstate)
Assert(PointerIsAligned(start, uint64))
void * palloc0(Size size)
static TupleTableSlot * ExecValuesScan(PlanState *pstate)
#define lfirst_node(type, lc)
static int list_length(const List *l)
ExprContext * ps_ExprContext
ExecProcNodeMtd ExecProcNode