Skip to content

Commit 71b4790

Browse files
committed
Commebts & one check in EndEvalPlanQual().
1 parent e4d8d43 commit 71b4790

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/backend/executor/execMain.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
*
2828
*
2929
* IDENTIFICATION
30-
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.111 2000/04/07 00:59:17 tgl Exp $
30+
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.112 2000/04/07 07:24:47 vadim Exp $
3131
*
3232
*-------------------------------------------------------------------------
3333
*/
@@ -2022,15 +2022,21 @@ EndEvalPlanQual(EState *estate)
20222022
EState *epqstate = &(epq->estate);
20232023
evalPlanQual *oldepq;
20242024

2025-
if (epq->rti == 0) /* still live? */
2025+
if (epq->rti == 0) /* plans already shutdowned */
2026+
{
2027+
Assert(epq->estate.es_evalPlanQual == NULL);
20262028
return;
2029+
}
20272030

20282031
for (;;)
20292032
{
20302033
ExecEndNode(epq->plan, epq->plan);
20312034
epqstate->es_tupleTable->next = 0;
2032-
heap_freetuple(epqstate->es_evTuple[epq->rti - 1]);
2033-
epqstate->es_evTuple[epq->rti - 1] = NULL;
2035+
if (epqstate->es_evTuple[epq->rti - 1] != NULL)
2036+
{
2037+
heap_freetuple(epqstate->es_evTuple[epq->rti - 1]);
2038+
epqstate->es_evTuple[epq->rti - 1] = NULL;
2039+
}
20342040
/* pop old PQ from the stack */
20352041
oldepq = (evalPlanQual *) epqstate->es_evalPlanQual;
20362042
if (oldepq == (evalPlanQual *) NULL)

0 commit comments

Comments
 (0)