*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
#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"
*/
ExecIndexBuildScanKeys((PlanState *) indexstate,
indexstate->iss_RelationDesc,
+ node->scan.scanrelid,
node->indexqual,
&indexstate->iss_ScanKeys,
&indexstate->iss_NumScanKeys,
*
* 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:
* 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)
{
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;
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;
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;
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;
* 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 $
*
*-------------------------------------------------------------------------
*/
/* 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);