Can anybody explain the following code detail ?
A comment in execMain.c tells us:
--start code snippet--* NB: the CurrentMemoryContext when this is called must be the context* to be used as the
per-querycontext for the query plan. ExecutorRun()* and ExecutorEnd() must be called in this same memory context.*
----------------------------------------------------------------*/
TupleDesc
ExecutorStart(QueryDesc *queryDesc, EState *estate)
--end code snippet--
Nevertheless in ExecRelCheck a context switch to per-query memory
context is made:
--start code snippet-- /* * If first time through for this result relation, build expression *
nodetreesfor rel's constraint expressions. Keep them in the * per-query memory context so they'll survive
throughoutthe query. */ if (resultRelInfo->ri_ConstraintExprs == NULL) { oldContext =
MemoryContextSwitchTo(estate->es_query_cxt); resultRelInfo->ri_ConstraintExprs =
(List**) palloc(ncheck * sizeof(List *)); for (i = 0; i < ncheck; i++) {
qual = (List *) stringToNode(check[i].ccbin); resultRelInfo->ri_ConstraintExprs[i] = qual;
} MemoryContextSwitchTo(oldContext); }
--end code snippet--
Is this a switch from per-query memory context to per-query memory
context, hence not necessary, or do I miss something ?
--
Holger Krug
hkrug@rationalizer.com