]> granicus.if.org Git - postgresql/commitdiff
Fix for InitPlan-s: have to copy subselect' result tuple.
authorVadim B. Mikheev <vadim4o@yahoo.com>
Thu, 19 Feb 1998 04:47:07 +0000 (04:47 +0000)
committerVadim B. Mikheev <vadim4o@yahoo.com>
Thu, 19 Feb 1998 04:47:07 +0000 (04:47 +0000)
src/backend/executor/nodeSubplan.c

index 610f0a09643f2c499bb7d84e7c2cdee54e599525..3c5560d13bd20690a526432e1101864beff055f9 100644 (file)
@@ -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)]);