Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit dbb2a93

Browse files
committed
Ensure that ExecPrepareExprList's result is all in one memory context.
Noted by Amit Langote. Discussion: https://postgr.es/m/[email protected]
1 parent 0c73285 commit dbb2a93

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/backend/executor/execExpr.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,15 +511,21 @@ List *
511511
ExecPrepareExprList(List *nodes, EState *estate)
512512
{
513513
List *result = NIL;
514+
MemoryContext oldcontext;
514515
ListCell *lc;
515516

517+
/* Ensure that the list cell nodes are in the right context too */
518+
oldcontext = MemoryContextSwitchTo(estate->es_query_cxt);
519+
516520
foreach(lc, nodes)
517521
{
518522
Expr *e = (Expr *) lfirst(lc);
519523

520524
result = lappend(result, ExecPrepareExpr(e, estate));
521525
}
522526

527+
MemoryContextSwitchTo(oldcontext);
528+
523529
return result;
524530
}
525531

0 commit comments

Comments
 (0)