Skip to content
Snippets Groups Projects
Commit 6f3da9ae authored by Tom Lane's avatar Tom Lane
Browse files

Remove unnecessary EvalPlanQual support code --- since this plan node

type never scans a relation directly, it can't be an EPQ target.
Explicitly drop subplan's tuple table to ensure we have no buffer pin
leaks.
parent d0e1091c
No related branches found
No related tags found
No related merge requests found
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeSubqueryscan.c,v 1.7 2001/05/08 19:47:02 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/nodeSubqueryscan.c,v 1.8 2001/05/15 16:11:58 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -61,28 +61,11 @@ SubqueryNext(SubqueryScan *node) ...@@ -61,28 +61,11 @@ SubqueryNext(SubqueryScan *node)
estate = node->scan.plan.state; estate = node->scan.plan.state;
subquerystate = (SubqueryScanState *) node->scan.scanstate; subquerystate = (SubqueryScanState *) node->scan.scanstate;
direction = estate->es_direction; direction = estate->es_direction;
slot = subquerystate->csstate.css_ScanTupleSlot;
/* /*
* Check if we are evaluating PlanQual for tuple of this relation. * We need not support EvalPlanQual here, since we are not scanning
* Additional checking is not good, but no other way for now. We could * a real relation.
* introduce new nodes for this case and handle SubqueryScan -->
* NewNode switching in Init/ReScan plan...
*/ */
if (estate->es_evTuple != NULL &&
estate->es_evTuple[node->scan.scanrelid - 1] != NULL)
{
ExecClearTuple(slot);
if (estate->es_evTupleNull[node->scan.scanrelid - 1])
return slot; /* return empty slot */
ExecStoreTuple(estate->es_evTuple[node->scan.scanrelid - 1],
slot, InvalidBuffer, false);
/* Flag for the next call that no more tuples */
estate->es_evTupleNull[node->scan.scanrelid - 1] = true;
return (slot);
}
/* /*
* get the next tuple from the sub-query * get the next tuple from the sub-query
...@@ -234,12 +217,16 @@ ExecEndSubqueryScan(SubqueryScan *node) ...@@ -234,12 +217,16 @@ ExecEndSubqueryScan(SubqueryScan *node)
*/ */
ExecEndNode(node->subplan, node->subplan); ExecEndNode(node->subplan, node->subplan);
/* XXX we seem to be leaking the sub-EState and tuple table... */ /*
* clean up subquery's tuple table
*/
subquerystate->csstate.css_ScanTupleSlot = NULL; subquerystate->csstate.css_ScanTupleSlot = NULL;
ExecDropTupleTable(subquerystate->sss_SubEState->es_tupleTable, true);
/* XXX we seem to be leaking the sub-EState... */
/* /*
* clean out the tuple table * clean out the upper tuple table
*/ */
ExecClearTuple(subquerystate->csstate.cstate.cs_ResultTupleSlot); ExecClearTuple(subquerystate->csstate.cstate.cs_ResultTupleSlot);
} }
...@@ -259,14 +246,6 @@ ExecSubqueryReScan(SubqueryScan *node, ExprContext *exprCtxt, Plan *parent) ...@@ -259,14 +246,6 @@ ExecSubqueryReScan(SubqueryScan *node, ExprContext *exprCtxt, Plan *parent)
subquerystate = (SubqueryScanState *) node->scan.scanstate; subquerystate = (SubqueryScanState *) node->scan.scanstate;
estate = node->scan.plan.state; estate = node->scan.plan.state;
/* If this is re-scanning of PlanQual ... */
if (estate->es_evTuple != NULL &&
estate->es_evTuple[node->scan.scanrelid - 1] != NULL)
{
estate->es_evTupleNull[node->scan.scanrelid - 1] = false;
return;
}
/* /*
* ExecReScan doesn't know about my subplan, so I have to do * ExecReScan doesn't know about my subplan, so I have to do
* changed-parameter signaling myself. * changed-parameter signaling myself.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment