From ed875a4132c0d72269cdeda2538c155ea23ace6d Mon Sep 17 00:00:00 2001 From: "Vadim B. Mikheev" Date: Thu, 19 Feb 1998 04:47:07 +0000 Subject: [PATCH] Fix for InitPlan-s: have to copy subselect' result tuple. --- src/backend/executor/nodeSubplan.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/backend/executor/nodeSubplan.c b/src/backend/executor/nodeSubplan.c index 610f0a0964..3c5560d13b 100644 --- a/src/backend/executor/nodeSubplan.c +++ b/src/backend/executor/nodeSubplan.c @@ -95,6 +95,9 @@ ExecSubPlan(SubPlan *node, List *pvar, ExprContext *econtext) break; } + if ( !found && sublink->subLinkType == ALL_SUBLINK ) + return ((Datum) true); + return ((Datum) result); } @@ -193,6 +196,15 @@ ExecSetParamPlan (SubPlan *node) break; } + /* + * If this is uncorrelated subquery then its plan will be closed + * (see below) and this tuple will be free-ed - bad for not byval + * types... But is free-ing possible in the next ExecProcNode in + * this loop ? Who knows... Someday we'll keep track of saved + * tuples... + */ + tup = heap_copytuple (tup); + foreach (lst, node->setParam) { ParamExecData *prm = &(plan->state->es_param_exec_vals[lfirsti(lst)]);