From: | Holger Krug <hkrug(at)rationalizer(dot)com> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Why MemoryContextSwitch in ExecRelCheck ? |
Date: | 2002-01-07 07:59:16 |
Message-ID: | 20020107085916.A1260@dev12.rationalizer.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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-query context 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
* nodetrees for rel's constraint expressions. Keep them in the
* per-query memory context so they'll survive throughout the 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(at)rationalizer(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Meskes | 2002-01-07 09:06:19 | Re: fork() while connected |
Previous Message | Holger Krug | 2002-01-07 07:48:51 | Re: ON ERROR triggers |