Noted by Amit Langote.
Discussion: https://postgr.es/m/
aad31672-4983-d95d-d24e-
6b42fee9b985@lab.ntt.co.jp
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);
result = lappend(result, ExecPrepareExpr(e, estate));
}
+ MemoryContextSwitchTo(oldcontext);
+
return result;
}