8
8
*
9
9
*
10
10
* IDENTIFICATION
11
- * $PostgreSQL: pgsql/src/backend/executor/nodeIndexscan.c,v 1.129 2008/06/19 00:46:04 alvherre Exp $
11
+ * $PostgreSQL: pgsql/src/backend/executor/nodeIndexscan.c,v 1.130 2008/08/25 20:20:30 tgl Exp $
12
12
*
13
13
*-------------------------------------------------------------------------
14
14
*/
29
29
#include "access/relscan.h"
30
30
#include "executor/execdebug.h"
31
31
#include "executor/nodeIndexscan.h"
32
- #include "nodes/nodeFuncs.h"
33
32
#include "optimizer/clauses.h"
34
33
#include "utils/array.h"
35
34
#include "utils/lsyscache.h"
@@ -576,6 +575,7 @@ ExecInitIndexScan(IndexScan *node, EState *estate, int eflags)
576
575
*/
577
576
ExecIndexBuildScanKeys ((PlanState * ) indexstate ,
578
577
indexstate -> iss_RelationDesc ,
578
+ node -> scan .scanrelid ,
579
579
node -> indexqual ,
580
580
& indexstate -> iss_ScanKeys ,
581
581
& indexstate -> iss_NumScanKeys ,
@@ -653,6 +653,7 @@ ExecInitIndexScan(IndexScan *node, EState *estate, int eflags)
653
653
*
654
654
* planstate: executor state node we are working for
655
655
* index: the index we are building scan keys for
656
+ * scanrelid: varno of the index's relation within current query
656
657
* quals: indexquals expressions
657
658
*
658
659
* Output params are:
@@ -668,8 +669,8 @@ ExecInitIndexScan(IndexScan *node, EState *estate, int eflags)
668
669
* ScalarArrayOpExpr quals are not supported.
669
670
*/
670
671
void
671
- ExecIndexBuildScanKeys (PlanState * planstate , Relation index , List * quals ,
672
- ScanKey * scanKeys , int * numScanKeys ,
672
+ ExecIndexBuildScanKeys (PlanState * planstate , Relation index , Index scanrelid ,
673
+ List * quals , ScanKey * scanKeys , int * numScanKeys ,
673
674
IndexRuntimeKeyInfo * * runtimeKeys , int * numRuntimeKeys ,
674
675
IndexArrayKeyInfo * * arrayKeys , int * numArrayKeys )
675
676
{
@@ -753,7 +754,7 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index, List *quals,
753
754
Assert (leftop != NULL );
754
755
755
756
if (!(IsA (leftop , Var ) &&
756
- var_is_rel ((Var * ) leftop )))
757
+ ((Var * ) leftop )-> varno == scanrelid ))
757
758
elog (ERROR , "indexqual doesn't have key on left side" );
758
759
759
760
varattno = ((Var * ) leftop )-> varattno ;
@@ -837,7 +838,7 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index, List *quals,
837
838
Assert (leftop != NULL );
838
839
839
840
if (!(IsA (leftop , Var ) &&
840
- var_is_rel ((Var * ) leftop )))
841
+ ((Var * ) leftop )-> varno == scanrelid ))
841
842
elog (ERROR , "indexqual doesn't have key on left side" );
842
843
843
844
varattno = ((Var * ) leftop )-> varattno ;
@@ -942,7 +943,7 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index, List *quals,
942
943
Assert (leftop != NULL );
943
944
944
945
if (!(IsA (leftop , Var ) &&
945
- var_is_rel ((Var * ) leftop )))
946
+ ((Var * ) leftop )-> varno == scanrelid ))
946
947
elog (ERROR , "indexqual doesn't have key on left side" );
947
948
948
949
varattno = ((Var * ) leftop )-> varattno ;
@@ -1003,7 +1004,7 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index, List *quals,
1003
1004
Assert (leftop != NULL );
1004
1005
1005
1006
if (!(IsA (leftop , Var ) &&
1006
- var_is_rel ((Var * ) leftop )))
1007
+ ((Var * ) leftop )-> varno == scanrelid ))
1007
1008
elog (ERROR , "NullTest indexqual has wrong key" );
1008
1009
1009
1010
varattno = ((Var * ) leftop )-> varattno ;
0 commit comments