Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit d320101

Browse files
committed
Get rid of the last remaining uses of var_is_rel(), to wit some debugging
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.
1 parent e36716a commit d320101

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

src/backend/executor/nodeBitmapIndexscan.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/executor/nodeBitmapIndexscan.c,v 1.27 2008/04/13 20:51:20 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/executor/nodeBitmapIndexscan.c,v 1.28 2008/08/25 20:20:29 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -275,6 +275,7 @@ ExecInitBitmapIndexScan(BitmapIndexScan *node, EState *estate, int eflags)
275275
*/
276276
ExecIndexBuildScanKeys((PlanState *) indexstate,
277277
indexstate->biss_RelationDesc,
278+
node->scan.scanrelid,
278279
node->indexqual,
279280
&indexstate->biss_ScanKeys,
280281
&indexstate->biss_NumScanKeys,

src/backend/executor/nodeIndexscan.c

+9-8
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* 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 $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -29,7 +29,6 @@
2929
#include "access/relscan.h"
3030
#include "executor/execdebug.h"
3131
#include "executor/nodeIndexscan.h"
32-
#include "nodes/nodeFuncs.h"
3332
#include "optimizer/clauses.h"
3433
#include "utils/array.h"
3534
#include "utils/lsyscache.h"
@@ -576,6 +575,7 @@ ExecInitIndexScan(IndexScan *node, EState *estate, int eflags)
576575
*/
577576
ExecIndexBuildScanKeys((PlanState *) indexstate,
578577
indexstate->iss_RelationDesc,
578+
node->scan.scanrelid,
579579
node->indexqual,
580580
&indexstate->iss_ScanKeys,
581581
&indexstate->iss_NumScanKeys,
@@ -653,6 +653,7 @@ ExecInitIndexScan(IndexScan *node, EState *estate, int eflags)
653653
*
654654
* planstate: executor state node we are working for
655655
* index: the index we are building scan keys for
656+
* scanrelid: varno of the index's relation within current query
656657
* quals: indexquals expressions
657658
*
658659
* Output params are:
@@ -668,8 +669,8 @@ ExecInitIndexScan(IndexScan *node, EState *estate, int eflags)
668669
* ScalarArrayOpExpr quals are not supported.
669670
*/
670671
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,
673674
IndexRuntimeKeyInfo **runtimeKeys, int *numRuntimeKeys,
674675
IndexArrayKeyInfo **arrayKeys, int *numArrayKeys)
675676
{
@@ -753,7 +754,7 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index, List *quals,
753754
Assert(leftop != NULL);
754755

755756
if (!(IsA(leftop, Var) &&
756-
var_is_rel((Var *) leftop)))
757+
((Var *) leftop)->varno == scanrelid))
757758
elog(ERROR, "indexqual doesn't have key on left side");
758759

759760
varattno = ((Var *) leftop)->varattno;
@@ -837,7 +838,7 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index, List *quals,
837838
Assert(leftop != NULL);
838839

839840
if (!(IsA(leftop, Var) &&
840-
var_is_rel((Var *) leftop)))
841+
((Var *) leftop)->varno == scanrelid))
841842
elog(ERROR, "indexqual doesn't have key on left side");
842843

843844
varattno = ((Var *) leftop)->varattno;
@@ -942,7 +943,7 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index, List *quals,
942943
Assert(leftop != NULL);
943944

944945
if (!(IsA(leftop, Var) &&
945-
var_is_rel((Var *) leftop)))
946+
((Var *) leftop)->varno == scanrelid))
946947
elog(ERROR, "indexqual doesn't have key on left side");
947948

948949
varattno = ((Var *) leftop)->varattno;
@@ -1003,7 +1004,7 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index, List *quals,
10031004
Assert(leftop != NULL);
10041005

10051006
if (!(IsA(leftop, Var) &&
1006-
var_is_rel((Var *) leftop)))
1007+
((Var *) leftop)->varno == scanrelid))
10071008
elog(ERROR, "NullTest indexqual has wrong key");
10081009

10091010
varattno = ((Var *) leftop)->varattno;

src/include/executor/nodeIndexscan.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/include/executor/nodeIndexscan.h,v 1.32 2008/04/13 20:51:21 tgl Exp $
10+
* $PostgreSQL: pgsql/src/include/executor/nodeIndexscan.h,v 1.33 2008/08/25 20:20:30 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -26,6 +26,7 @@ extern void ExecIndexReScan(IndexScanState *node, ExprContext *exprCtxt);
2626

2727
/* routines exported to share code with nodeBitmapIndexscan.c */
2828
extern void ExecIndexBuildScanKeys(PlanState *planstate, Relation index,
29+
Index scanrelid,
2930
List *quals, ScanKey *scanKeys, int *numScanKeys,
3031
IndexRuntimeKeyInfo **runtimeKeys, int *numRuntimeKeys,
3132
IndexArrayKeyInfo **arrayKeys, int *numArrayKeys);

0 commit comments

Comments
 (0)