diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2010-07-12 17:01:06 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2010-07-12 17:01:06 +0000 |
commit | 53e757689ce94520f1c53a89dbaa14ea57b09da7 (patch) | |
tree | afa68ba05699223a719104b953bc20f37d4c33d1 /src/backend/executor/nodeBitmapIndexscan.c | |
parent | 5a3489357fb61f1ea76412ada33549aca152ad55 (diff) | |
download | postgresql-53e757689ce94520f1c53a89dbaa14ea57b09da7.tar.gz postgresql-53e757689ce94520f1c53a89dbaa14ea57b09da7.zip |
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.
Diffstat (limited to 'src/backend/executor/nodeBitmapIndexscan.c')
-rw-r--r-- | src/backend/executor/nodeBitmapIndexscan.c | 41 |
1 files changed, 15 insertions, 26 deletions
diff --git a/src/backend/executor/nodeBitmapIndexscan.c b/src/backend/executor/nodeBitmapIndexscan.c index 0781c21676b..73b569458d3 100644 --- a/src/backend/executor/nodeBitmapIndexscan.c +++ b/src/backend/executor/nodeBitmapIndexscan.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/executor/nodeBitmapIndexscan.c,v 1.33 2010/01/02 16:57:41 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/executor/nodeBitmapIndexscan.c,v 1.34 2010/07/12 17:01:05 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -16,7 +16,7 @@ * INTERFACE ROUTINES * MultiExecBitmapIndexScan scans a relation using index. * ExecInitBitmapIndexScan creates and initializes state info. - * ExecBitmapIndexReScan prepares to rescan the plan. + * ExecReScanBitmapIndexScan prepares to rescan the plan. * ExecEndBitmapIndexScan releases all storage. */ #include "postgres.h" @@ -60,7 +60,7 @@ MultiExecBitmapIndexScan(BitmapIndexScanState *node) if (!node->biss_RuntimeKeysReady && (node->biss_NumRuntimeKeys != 0 || node->biss_NumArrayKeys != 0)) { - ExecReScan((PlanState *) node, NULL); + ExecReScan((PlanState *) node); doscan = node->biss_RuntimeKeysReady; } else @@ -106,39 +106,28 @@ MultiExecBitmapIndexScan(BitmapIndexScanState *node) } /* ---------------------------------------------------------------- - * ExecBitmapIndexReScan(node) + * ExecReScanBitmapIndexScan(node) * - * Recalculates the value of the scan keys whose value depends on - * information known at runtime and rescans the indexed relation. + * Recalculates the values of any scan keys whose value depends on + * information known at runtime, then rescans the indexed relation. * ---------------------------------------------------------------- */ void -ExecBitmapIndexReScan(BitmapIndexScanState *node, ExprContext *exprCtxt) +ExecReScanBitmapIndexScan(BitmapIndexScanState *node) { - ExprContext *econtext; - - econtext = node->biss_RuntimeContext; /* context for runtime keys */ + ExprContext *econtext = node->biss_RuntimeContext; + /* + * Reset the runtime-key context so we don't leak memory as each outer + * tuple is scanned. Note this assumes that we will recalculate *all* + * runtime keys on each call. + */ if (econtext) - { - /* - * If we are being passed an outer tuple, save it for runtime key - * calc. - */ - if (exprCtxt != NULL) - econtext->ecxt_outertuple = exprCtxt->ecxt_outertuple; - - /* - * Reset the runtime-key context so we don't leak memory as each outer - * tuple is scanned. Note this assumes that we will recalculate *all* - * runtime keys on each call. - */ ResetExprContext(econtext); - } /* - * If we are doing runtime key calculations (ie, the index keys depend on - * data from an outer scan), compute the new key values. + * If we are doing runtime key calculations (ie, any of the index key + * values weren't simple Consts), compute the new key values. * * Array keys are also treated as runtime keys; note that if we return * with biss_RuntimeKeysReady still false, then there is an empty array |