From 53e757689ce94520f1c53a89dbaa14ea57b09da7 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 12 Jul 2010 17:01:06 +0000 Subject: Make NestLoop plan nodes pass outer-relation variables into their inner relation using the general PARAM_EXEC executor parameter mechanism, rather than the ad-hoc kluge of passing the outer tuple down through ExecReScan. The previous method was hard to understand and could never be extended to handle parameters coming from multiple join levels. This patch doesn't change the set of possible plans nor have any significant performance effect, but it's necessary infrastructure for future generalization of the concept of an inner indexscan plan. ExecReScan's second parameter is now unused, so it's removed. --- src/backend/executor/nodeBitmapHeapscan.c | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) (limited to 'src/backend/executor/nodeBitmapHeapscan.c') diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c index 2a7ce624321..0ea3a88e451 100644 --- a/src/backend/executor/nodeBitmapHeapscan.c +++ b/src/backend/executor/nodeBitmapHeapscan.c @@ -21,7 +21,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/executor/nodeBitmapHeapscan.c,v 1.38 2010/01/02 16:57:41 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/executor/nodeBitmapHeapscan.c,v 1.39 2010/07/12 17:01:05 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -30,7 +30,7 @@ * ExecBitmapHeapScan scans a relation using bitmap info * ExecBitmapHeapNext workhorse for above * ExecInitBitmapHeapScan creates and initializes state info. - * ExecBitmapHeapReScan prepares to rescan the plan. + * ExecReScanBitmapHeapScan prepares to rescan the plan. * ExecEndBitmapHeapScan releases all storage. */ #include "postgres.h" @@ -420,24 +420,12 @@ ExecBitmapHeapScan(BitmapHeapScanState *node) } /* ---------------------------------------------------------------- - * ExecBitmapHeapReScan(node) + * ExecReScanBitmapHeapScan(node) * ---------------------------------------------------------------- */ void -ExecBitmapHeapReScan(BitmapHeapScanState *node, ExprContext *exprCtxt) +ExecReScanBitmapHeapScan(BitmapHeapScanState *node) { - /* - * If we are being passed an outer tuple, link it into the "regular" - * per-tuple econtext for possible qual eval. - */ - if (exprCtxt != NULL) - { - ExprContext *stdecontext; - - stdecontext = node->ss.ps.ps_ExprContext; - stdecontext->ecxt_outertuple = exprCtxt->ecxt_outertuple; - } - /* rescan to release any page pin */ heap_rescan(node->ss.ss_currentScanDesc, NULL); @@ -455,10 +443,11 @@ ExecBitmapHeapReScan(BitmapHeapScanState *node, ExprContext *exprCtxt) ExecScanReScan(&node->ss); /* - * Always rescan the input immediately, to ensure we can pass down any - * outer tuple that might be used in index quals. + * if chgParam of subnode is not null then plan will be re-scanned by + * first ExecProcNode. */ - ExecReScan(outerPlanState(node), exprCtxt); + if (node->ss.ps.lefttree->chgParam == NULL) + ExecReScan(node->ss.ps.lefttree); } /* ---------------------------------------------------------------- -- cgit v1.2.3