mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-02-05 19:09:58 +08:00
Ensure that ExecPrepareExprList's result is all in one memory context.
Noted by Amit Langote. Discussion: https://postgr.es/m/aad31672-4983-d95d-d24e-6b42fee9b985@lab.ntt.co.jp
This commit is contained in:
parent
0c732850d2
commit
dbb2a93147
@ -511,8 +511,12 @@ List *
|
||||
ExecPrepareExprList(List *nodes, EState *estate)
|
||||
{
|
||||
List *result = NIL;
|
||||
MemoryContext oldcontext;
|
||||
ListCell *lc;
|
||||
|
||||
/* Ensure that the list cell nodes are in the right context too */
|
||||
oldcontext = MemoryContextSwitchTo(estate->es_query_cxt);
|
||||
|
||||
foreach(lc, nodes)
|
||||
{
|
||||
Expr *e = (Expr *) lfirst(lc);
|
||||
@ -520,6 +524,8 @@ ExecPrepareExprList(List *nodes, EState *estate)
|
||||
result = lappend(result, ExecPrepareExpr(e, estate));
|
||||
}
|
||||
|
||||
MemoryContextSwitchTo(oldcontext);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user