From 3a0a16cb7e2aba8d9864d117d1199181432b42b8 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Wed, 25 Jan 2006 20:29:24 +0000 Subject: Allow row comparisons to be used as indexscan qualifications. This completes the project to upgrade our handling of row comparisons. --- src/backend/executor/nodeBitmapIndexscan.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) (limited to 'src/backend/executor/nodeBitmapIndexscan.c') diff --git a/src/backend/executor/nodeBitmapIndexscan.c b/src/backend/executor/nodeBitmapIndexscan.c index 114de29ba8e..37839c0255b 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.14 2005/12/03 05:51:01 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/executor/nodeBitmapIndexscan.c,v 1.15 2006/01/25 20:29:23 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -244,6 +244,20 @@ ExecInitBitmapIndexScan(BitmapIndexScan *node, EState *estate) #define BITMAPINDEXSCAN_NSLOTS 0 + /* + * We do not open or lock the base relation here. We assume that an + * ancestor BitmapHeapScan node is holding AccessShareLock (or better) + * on the heap relation throughout the execution of the plan tree. + */ + + indexstate->ss.ss_currentRelation = NULL; + indexstate->ss.ss_currentScanDesc = NULL; + + /* + * Open the index relation. + */ + indexstate->biss_RelationDesc = index_open(node->indexid); + /* * Initialize index-specific scan state */ @@ -255,6 +269,7 @@ ExecInitBitmapIndexScan(BitmapIndexScan *node, EState *estate) * build the index scan keys from the index qualification */ ExecIndexBuildScanKeys((PlanState *) indexstate, + indexstate->biss_RelationDesc, node->indexqual, node->indexstrategy, node->indexsubtype, @@ -286,16 +301,8 @@ ExecInitBitmapIndexScan(BitmapIndexScan *node, EState *estate) } /* - * We do not open or lock the base relation here. We assume that an - * ancestor BitmapHeapScan node is holding AccessShareLock (or better) - * on the heap relation throughout the execution of the plan tree. - */ - - indexstate->ss.ss_currentRelation = NULL; - indexstate->ss.ss_currentScanDesc = NULL; - - /* - * Open the index relation and initialize relation and scan descriptors. + * Initialize scan descriptor. + * * Note we acquire no locks here; the index machinery does its own locks * and unlocks. (We rely on having a lock on the parent table to * ensure the index won't go away!) Furthermore, if the parent table @@ -303,7 +310,6 @@ ExecInitBitmapIndexScan(BitmapIndexScan *node, EState *estate) * opened and write-locked the index, so we can tell the index machinery * not to bother getting an extra lock. */ - indexstate->biss_RelationDesc = index_open(node->indexid); relistarget = ExecRelationIsTargetRelation(estate, node->scan.scanrelid); indexstate->biss_ScanDesc = index_beginscan_multi(indexstate->biss_RelationDesc, -- cgit v1.2.3