Merge pull request #332 from citusdata/bugfix/memory_context_leak

Remove unnecessary memory context switch on the planner
pull/336/head
Önder Kalacı 2016-02-12 11:13:12 -08:00
commit a55287411b
1 changed files with 1 additions and 10 deletions

View File

@ -52,19 +52,10 @@ multi_planner(Query *parse, int cursorOptions, ParamListInfo boundParams)
if (NeedsDistributedPlanning(parse)) if (NeedsDistributedPlanning(parse))
{ {
MemoryContext oldcontext = NULL; MultiPlan *physicalPlan = CreatePhysicalPlan(parse);
MultiPlan *physicalPlan = NULL;
/* Switch to top level message context */
oldcontext = MemoryContextSwitchTo(MessageContext);
physicalPlan = CreatePhysicalPlan(parse);
/* store required data into the planned statement */ /* store required data into the planned statement */
result = MultiQueryContainerNode(result, physicalPlan); result = MultiQueryContainerNode(result, physicalPlan);
/* Now switch back to original context */
MemoryContextSwitchTo(oldcontext);
} }
return result; return result;