77 * Portions Copyright (c) 1994, Regents of the University of California
88 *
99 * IDENTIFICATION
10- * $Header: /cvsroot/pgsql/src/backend/executor/nodeSubplan.c,v 1.39 2002/12/15 16:17:46 tgl Exp $
10+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeSubplan.c,v 1.40 2002/12/26 22:37:42 tgl Exp $
1111 *
1212 *-------------------------------------------------------------------------
1313 */
@@ -475,15 +475,6 @@ ExecSetParamPlan(SubPlanState *node, ExprContext *econtext)
475475}
476476}
477477
478- if (planstate -> plan -> extParam == NULL )/* un-correlated ... */
479- {
480- ExecEndPlan (planstate ,node -> sub_estate );
481- /* mustn't free context while still in it... */
482- MemoryContextSwitchTo (oldcontext );
483- FreeExecutorState (node -> sub_estate );
484- node -> needShutdown = false;
485- }
486-
487478MemoryContextSwitchTo (oldcontext );
488479}
489480
@@ -502,6 +493,8 @@ ExecEndSubPlan(SubPlanState *node)
502493ExecEndPlan (node -> planstate ,node -> sub_estate );
503494MemoryContextSwitchTo (oldcontext );
504495FreeExecutorState (node -> sub_estate );
496+ node -> sub_estate = NULL ;
497+ node -> planstate = NULL ;
505498node -> needShutdown = false;
506499}
507500if (node -> curTuple )