]> granicus.if.org Git - postgresql/commitdiff
Get rid of the last remaining uses of var_is_rel(), to wit some debugging
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 25 Aug 2008 20:20:30 +0000 (20:20 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 25 Aug 2008 20:20:30 +0000 (20:20 +0000)
checks in ExecIndexBuildScanKeys() that were inadequate anyway: it's better
to verify the correct varno on an expected index key, not just reject OUTER
and INNER.

This makes the entire current contents of nodeFuncs.c dead code.  I'll be
replacing it with some other stuff later, as per recent proposal.

src/backend/executor/nodeBitmapIndexscan.c
src/backend/executor/nodeIndexscan.c
src/include/executor/nodeIndexscan.h

index 6223db4f62a3cf9bc996ec9d5bf791122178619f..59c156924d361b6888639cea6dbcdb0e65bc90c8 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/executor/nodeBitmapIndexscan.c,v 1.27 2008/04/13 20:51:20 tgl Exp $
+ *       $PostgreSQL: pgsql/src/backend/executor/nodeBitmapIndexscan.c,v 1.28 2008/08/25 20:20:29 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -275,6 +275,7 @@ ExecInitBitmapIndexScan(BitmapIndexScan *node, EState *estate, int eflags)
         */
        ExecIndexBuildScanKeys((PlanState *) indexstate,
                                                   indexstate->biss_RelationDesc,
+                                                  node->scan.scanrelid,
                                                   node->indexqual,
                                                   &indexstate->biss_ScanKeys,
                                                   &indexstate->biss_NumScanKeys,
index 4f7fce4e227370f27ad3bf29b270e17a8c02417d..e90f7df14c573efd56e9a6907bc4b39707b4cdc5 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/executor/nodeIndexscan.c,v 1.129 2008/06/19 00:46:04 alvherre Exp $
+ *       $PostgreSQL: pgsql/src/backend/executor/nodeIndexscan.c,v 1.130 2008/08/25 20:20:30 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -29,7 +29,6 @@
 #include "access/relscan.h"
 #include "executor/execdebug.h"
 #include "executor/nodeIndexscan.h"
-#include "nodes/nodeFuncs.h"
 #include "optimizer/clauses.h"
 #include "utils/array.h"
 #include "utils/lsyscache.h"
@@ -576,6 +575,7 @@ ExecInitIndexScan(IndexScan *node, EState *estate, int eflags)
         */
        ExecIndexBuildScanKeys((PlanState *) indexstate,
                                                   indexstate->iss_RelationDesc,
+                                                  node->scan.scanrelid,
                                                   node->indexqual,
                                                   &indexstate->iss_ScanKeys,
                                                   &indexstate->iss_NumScanKeys,
@@ -653,6 +653,7 @@ ExecInitIndexScan(IndexScan *node, EState *estate, int eflags)
  *
  * planstate: executor state node we are working for
  * index: the index we are building scan keys for
+ * scanrelid: varno of the index's relation within current query
  * quals: indexquals expressions
  *
  * Output params are:
@@ -668,8 +669,8 @@ ExecInitIndexScan(IndexScan *node, EState *estate, int eflags)
  * ScalarArrayOpExpr quals are not supported.
  */
 void
-ExecIndexBuildScanKeys(PlanState *planstate, Relation index, List *quals,
-                                          ScanKey *scanKeys, int *numScanKeys,
+ExecIndexBuildScanKeys(PlanState *planstate, Relation index, Index scanrelid,
+                                          List *quals, ScanKey *scanKeys, int *numScanKeys,
                                           IndexRuntimeKeyInfo **runtimeKeys, int *numRuntimeKeys,
                                           IndexArrayKeyInfo **arrayKeys, int *numArrayKeys)
 {
@@ -753,7 +754,7 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index, List *quals,
                        Assert(leftop != NULL);
 
                        if (!(IsA(leftop, Var) &&
-                                 var_is_rel((Var *) leftop)))
+                                 ((Var *) leftop)->varno == scanrelid))
                                elog(ERROR, "indexqual doesn't have key on left side");
 
                        varattno = ((Var *) leftop)->varattno;
@@ -837,7 +838,7 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index, List *quals,
                                Assert(leftop != NULL);
 
                                if (!(IsA(leftop, Var) &&
-                                         var_is_rel((Var *) leftop)))
+                                         ((Var *) leftop)->varno == scanrelid))
                                        elog(ERROR, "indexqual doesn't have key on left side");
 
                                varattno = ((Var *) leftop)->varattno;
@@ -942,7 +943,7 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index, List *quals,
                        Assert(leftop != NULL);
 
                        if (!(IsA(leftop, Var) &&
-                                 var_is_rel((Var *) leftop)))
+                                 ((Var *) leftop)->varno == scanrelid))
                                elog(ERROR, "indexqual doesn't have key on left side");
 
                        varattno = ((Var *) leftop)->varattno;
@@ -1003,7 +1004,7 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index, List *quals,
                        Assert(leftop != NULL);
 
                        if (!(IsA(leftop, Var) &&
-                                 var_is_rel((Var *) leftop)))
+                                 ((Var *) leftop)->varno == scanrelid))
                                elog(ERROR, "NullTest indexqual has wrong key");
 
                        varattno = ((Var *) leftop)->varattno;
index 674c4572341767e26f53d06a23958ccc4b5c05df..5c16d46155174be9c4e5e0c0d129b7afcddbfc02 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/include/executor/nodeIndexscan.h,v 1.32 2008/04/13 20:51:21 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/executor/nodeIndexscan.h,v 1.33 2008/08/25 20:20:30 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -26,6 +26,7 @@ extern void ExecIndexReScan(IndexScanState *node, ExprContext *exprCtxt);
 
 /* routines exported to share code with nodeBitmapIndexscan.c */
 extern void ExecIndexBuildScanKeys(PlanState *planstate, Relation index,
+                                          Index scanrelid,
                                           List *quals, ScanKey *scanKeys, int *numScanKeys,
                                           IndexRuntimeKeyInfo **runtimeKeys, int *numRuntimeKeys,
                                           IndexArrayKeyInfo **arrayKeys, int *numArrayKeys);