Commit 226837e5 authored by Tom Lane's avatar Tom Lane

Since createplan.c no longer cares whether index operators are lossy, it has

no particular need to do get_op_opfamily_properties() while building an
indexscan plan.  Postpone that lookup until executor start.  This simplifies
createplan.c a lot more than it complicates nodeIndexscan.c, and makes things
more uniform since we already had to do it that way for RowCompare
expressions.  Should be a bit faster too, at least for plans that aren't
re-used many times, since we avoid palloc'ing and perhaps copying the
intermediate list data structure.
parent 24558da1
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/executor/execQual.c,v 1.228 2008/03/25 22:42:43 tgl Exp $ * $PostgreSQL: pgsql/src/backend/executor/execQual.c,v 1.229 2008/04/13 20:51:20 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -4175,14 +4175,12 @@ ExecInitExpr(Expr *node, PlanState *parent) ...@@ -4175,14 +4175,12 @@ ExecInitExpr(Expr *node, PlanState *parent)
int strategy; int strategy;
Oid lefttype; Oid lefttype;
Oid righttype; Oid righttype;
bool recheck;
Oid proc; Oid proc;
get_op_opfamily_properties(opno, opfamily, get_op_opfamily_properties(opno, opfamily,
&strategy, &strategy,
&lefttype, &lefttype,
&righttype, &righttype);
&recheck);
proc = get_opfamily_proc(opfamily, proc = get_opfamily_proc(opfamily,
lefttype, lefttype,
righttype, righttype,
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/executor/nodeBitmapIndexscan.c,v 1.26 2008/04/10 22:25:25 tgl Exp $ * $PostgreSQL: pgsql/src/backend/executor/nodeBitmapIndexscan.c,v 1.27 2008/04/13 20:51:20 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -276,8 +276,6 @@ ExecInitBitmapIndexScan(BitmapIndexScan *node, EState *estate, int eflags) ...@@ -276,8 +276,6 @@ ExecInitBitmapIndexScan(BitmapIndexScan *node, EState *estate, int eflags)
ExecIndexBuildScanKeys((PlanState *) indexstate, ExecIndexBuildScanKeys((PlanState *) indexstate,
indexstate->biss_RelationDesc, indexstate->biss_RelationDesc,
node->indexqual, node->indexqual,
node->indexstrategy,
node->indexsubtype,
&indexstate->biss_ScanKeys, &indexstate->biss_ScanKeys,
&indexstate->biss_NumScanKeys, &indexstate->biss_NumScanKeys,
&indexstate->biss_RuntimeKeys, &indexstate->biss_RuntimeKeys,
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/executor/nodeIndexscan.c,v 1.127 2008/04/13 19:18:14 tgl Exp $ * $PostgreSQL: pgsql/src/backend/executor/nodeIndexscan.c,v 1.128 2008/04/13 20:51:20 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -576,8 +576,6 @@ ExecInitIndexScan(IndexScan *node, EState *estate, int eflags) ...@@ -576,8 +576,6 @@ ExecInitIndexScan(IndexScan *node, EState *estate, int eflags)
ExecIndexBuildScanKeys((PlanState *) indexstate, ExecIndexBuildScanKeys((PlanState *) indexstate,
indexstate->iss_RelationDesc, indexstate->iss_RelationDesc,
node->indexqual, node->indexqual,
node->indexstrategy,
node->indexsubtype,
&indexstate->iss_ScanKeys, &indexstate->iss_ScanKeys,
&indexstate->iss_NumScanKeys, &indexstate->iss_NumScanKeys,
&indexstate->iss_RuntimeKeys, &indexstate->iss_RuntimeKeys,
...@@ -655,12 +653,6 @@ ExecInitIndexScan(IndexScan *node, EState *estate, int eflags) ...@@ -655,12 +653,6 @@ ExecInitIndexScan(IndexScan *node, EState *estate, int eflags)
* planstate: executor state node we are working for * planstate: executor state node we are working for
* index: the index we are building scan keys for * index: the index we are building scan keys for
* quals: indexquals expressions * quals: indexquals expressions
* strategies: associated operator strategy numbers
* subtypes: associated operator subtype OIDs
*
* (Any elements of the strategies and subtypes lists that correspond to
* RowCompareExpr quals are not used here; instead we look up the info
* afresh.)
* *
* Output params are: * Output params are:
* *
...@@ -675,15 +667,12 @@ ExecInitIndexScan(IndexScan *node, EState *estate, int eflags) ...@@ -675,15 +667,12 @@ ExecInitIndexScan(IndexScan *node, EState *estate, int eflags)
* ScalarArrayOpExpr quals are not supported. * ScalarArrayOpExpr quals are not supported.
*/ */
void void
ExecIndexBuildScanKeys(PlanState *planstate, Relation index, ExecIndexBuildScanKeys(PlanState *planstate, Relation index, List *quals,
List *quals, List *strategies, List *subtypes,
ScanKey *scanKeys, int *numScanKeys, ScanKey *scanKeys, int *numScanKeys,
IndexRuntimeKeyInfo **runtimeKeys, int *numRuntimeKeys, IndexRuntimeKeyInfo **runtimeKeys, int *numRuntimeKeys,
IndexArrayKeyInfo **arrayKeys, int *numArrayKeys) IndexArrayKeyInfo **arrayKeys, int *numArrayKeys)
{ {
ListCell *qual_cell; ListCell *qual_cell;
ListCell *strategy_cell;
ListCell *subtype_cell;
ScanKey scan_keys; ScanKey scan_keys;
IndexRuntimeKeyInfo *runtime_keys; IndexRuntimeKeyInfo *runtime_keys;
IndexArrayKeyInfo *array_keys; IndexArrayKeyInfo *array_keys;
...@@ -725,40 +714,31 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index, ...@@ -725,40 +714,31 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index,
extra_scan_keys = n_scan_keys; extra_scan_keys = n_scan_keys;
/* /*
* for each opclause in the given qual, convert each qual's opclause into * for each opclause in the given qual, convert the opclause into
* a single scan key * a single scan key
*/ */
qual_cell = list_head(quals); j = 0;
strategy_cell = list_head(strategies); foreach(qual_cell, quals)
subtype_cell = list_head(subtypes);
for (j = 0; j < n_scan_keys; j++)
{ {
ScanKey this_scan_key = &scan_keys[j]; Expr *clause = (Expr *) lfirst(qual_cell);
Expr *clause; /* one clause of index qual */ ScanKey this_scan_key = &scan_keys[j++];
Oid opno; /* operator's OID */
RegProcedure opfuncid; /* operator proc id used in scan */ RegProcedure opfuncid; /* operator proc id used in scan */
StrategyNumber strategy; /* op's strategy number */ Oid opfamily; /* opfamily of index column */
Oid subtype; /* op's strategy subtype */ int op_strategy; /* operator's strategy number */
Oid op_lefttype; /* operator's declared input types */
Oid op_righttype;
Expr *leftop; /* expr on lhs of operator */ Expr *leftop; /* expr on lhs of operator */
Expr *rightop; /* expr on rhs ... */ Expr *rightop; /* expr on rhs ... */
AttrNumber varattno; /* att number used in scan */ AttrNumber varattno; /* att number used in scan */
/*
* extract clause information from the qualification
*/
clause = (Expr *) lfirst(qual_cell);
qual_cell = lnext(qual_cell);
strategy = lfirst_int(strategy_cell);
strategy_cell = lnext(strategy_cell);
subtype = lfirst_oid(subtype_cell);
subtype_cell = lnext(subtype_cell);
if (IsA(clause, OpExpr)) if (IsA(clause, OpExpr))
{ {
/* indexkey op const or indexkey op expression */ /* indexkey op const or indexkey op expression */
int flags = 0; int flags = 0;
Datum scanvalue; Datum scanvalue;
opno = ((OpExpr *) clause)->opno;
opfuncid = ((OpExpr *) clause)->opfuncid; opfuncid = ((OpExpr *) clause)->opfuncid;
/* /*
...@@ -776,6 +756,19 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index, ...@@ -776,6 +756,19 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index,
elog(ERROR, "indexqual doesn't have key on left side"); elog(ERROR, "indexqual doesn't have key on left side");
varattno = ((Var *) leftop)->varattno; varattno = ((Var *) leftop)->varattno;
if (varattno < 1 || varattno > index->rd_index->indnatts)
elog(ERROR, "bogus index qualification");
/*
* We have to look up the operator's strategy number. This
* provides a cross-check that the operator does match the index.
*/
opfamily = index->rd_opfamily[varattno - 1];
get_op_opfamily_properties(opno, opfamily,
&op_strategy,
&op_lefttype,
&op_righttype);
/* /*
* rightop is the constant or variable comparison value * rightop is the constant or variable comparison value
...@@ -810,8 +803,8 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index, ...@@ -810,8 +803,8 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index,
ScanKeyEntryInitialize(this_scan_key, ScanKeyEntryInitialize(this_scan_key,
flags, flags,
varattno, /* attribute number to scan */ varattno, /* attribute number to scan */
strategy, /* op's strategy */ op_strategy, /* op's strategy */
subtype, /* strategy subtype */ op_righttype, /* strategy subtype */
opfuncid, /* reg proc to use */ opfuncid, /* reg proc to use */
scanvalue); /* constant */ scanvalue); /* constant */
} }
...@@ -830,12 +823,6 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index, ...@@ -830,12 +823,6 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index,
ScanKey this_sub_key = &scan_keys[extra_scan_keys]; ScanKey this_sub_key = &scan_keys[extra_scan_keys];
int flags = SK_ROW_MEMBER; int flags = SK_ROW_MEMBER;
Datum scanvalue; Datum scanvalue;
Oid opno;
Oid opfamily;
int op_strategy;
Oid op_lefttype;
Oid op_righttype;
bool op_recheck;
/* /*
* leftop should be the index key Var, possibly relabeled * leftop should be the index key Var, possibly relabeled
...@@ -897,8 +884,7 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index, ...@@ -897,8 +884,7 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index,
get_op_opfamily_properties(opno, opfamily, get_op_opfamily_properties(opno, opfamily,
&op_strategy, &op_strategy,
&op_lefttype, &op_lefttype,
&op_righttype, &op_righttype);
&op_recheck);
if (op_strategy != rc->rctype) if (op_strategy != rc->rctype)
elog(ERROR, "RowCompare index qualification contains wrong operator"); elog(ERROR, "RowCompare index qualification contains wrong operator");
...@@ -941,6 +927,7 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index, ...@@ -941,6 +927,7 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index,
ScalarArrayOpExpr *saop = (ScalarArrayOpExpr *) clause; ScalarArrayOpExpr *saop = (ScalarArrayOpExpr *) clause;
Assert(saop->useOr); Assert(saop->useOr);
opno = saop->opno;
opfuncid = saop->opfuncid; opfuncid = saop->opfuncid;
/* /*
...@@ -958,6 +945,19 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index, ...@@ -958,6 +945,19 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index,
elog(ERROR, "indexqual doesn't have key on left side"); elog(ERROR, "indexqual doesn't have key on left side");
varattno = ((Var *) leftop)->varattno; varattno = ((Var *) leftop)->varattno;
if (varattno < 1 || varattno > index->rd_index->indnatts)
elog(ERROR, "bogus index qualification");
/*
* We have to look up the operator's strategy number. This
* provides a cross-check that the operator does match the index.
*/
opfamily = index->rd_opfamily[varattno - 1];
get_op_opfamily_properties(opno, opfamily,
&op_strategy,
&op_lefttype,
&op_righttype);
/* /*
* rightop is the constant or variable array value * rightop is the constant or variable array value
...@@ -981,8 +981,8 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index, ...@@ -981,8 +981,8 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index,
ScanKeyEntryInitialize(this_scan_key, ScanKeyEntryInitialize(this_scan_key,
0, /* flags */ 0, /* flags */
varattno, /* attribute number to scan */ varattno, /* attribute number to scan */
strategy, /* op's strategy */ op_strategy, /* op's strategy */
subtype, /* strategy subtype */ op_righttype, /* strategy subtype */
opfuncid, /* reg proc to use */ opfuncid, /* reg proc to use */
(Datum) 0); /* constant */ (Datum) 0); /* constant */
} }
...@@ -1013,8 +1013,8 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index, ...@@ -1013,8 +1013,8 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index,
ScanKeyEntryInitialize(this_scan_key, ScanKeyEntryInitialize(this_scan_key,
SK_ISNULL | SK_SEARCHNULL, SK_ISNULL | SK_SEARCHNULL,
varattno, /* attribute number to scan */ varattno, /* attribute number to scan */
strategy, /* op's strategy */ InvalidStrategy, /* no strategy */
subtype, /* strategy subtype */ InvalidOid, /* no strategy subtype */
InvalidOid, /* no reg proc for this */ InvalidOid, /* no reg proc for this */
(Datum) 0); /* constant */ (Datum) 0); /* constant */
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/executor/nodeMergejoin.c,v 1.90 2008/01/01 19:45:49 momjian Exp $ * $PostgreSQL: pgsql/src/backend/executor/nodeMergejoin.c,v 1.91 2008/04/13 20:51:20 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -180,7 +180,6 @@ MJExamineQuals(List *mergeclauses, ...@@ -180,7 +180,6 @@ MJExamineQuals(List *mergeclauses,
int op_strategy; int op_strategy;
Oid op_lefttype; Oid op_lefttype;
Oid op_righttype; Oid op_righttype;
bool op_recheck;
RegProcedure cmpproc; RegProcedure cmpproc;
AclResult aclresult; AclResult aclresult;
...@@ -197,12 +196,10 @@ MJExamineQuals(List *mergeclauses, ...@@ -197,12 +196,10 @@ MJExamineQuals(List *mergeclauses,
get_op_opfamily_properties(qual->opno, opfamily, get_op_opfamily_properties(qual->opno, opfamily,
&op_strategy, &op_strategy,
&op_lefttype, &op_lefttype,
&op_righttype, &op_righttype);
&op_recheck);
if (op_strategy != BTEqualStrategyNumber) /* should not happen */ if (op_strategy != BTEqualStrategyNumber) /* should not happen */
elog(ERROR, "cannot merge using non-equality operator %u", elog(ERROR, "cannot merge using non-equality operator %u",
qual->opno); qual->opno);
Assert(!op_recheck); /* never true for btree */
/* And get the matching support procedure (comparison function) */ /* And get the matching support procedure (comparison function) */
cmpproc = get_opfamily_proc(opfamily, cmpproc = get_opfamily_proc(opfamily,
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.390 2008/03/21 22:41:48 tgl Exp $ * $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.391 2008/04/13 20:51:20 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -279,8 +279,6 @@ _copyIndexScan(IndexScan *from) ...@@ -279,8 +279,6 @@ _copyIndexScan(IndexScan *from)
COPY_SCALAR_FIELD(indexid); COPY_SCALAR_FIELD(indexid);
COPY_NODE_FIELD(indexqual); COPY_NODE_FIELD(indexqual);
COPY_NODE_FIELD(indexqualorig); COPY_NODE_FIELD(indexqualorig);
COPY_NODE_FIELD(indexstrategy);
COPY_NODE_FIELD(indexsubtype);
COPY_SCALAR_FIELD(indexorderdir); COPY_SCALAR_FIELD(indexorderdir);
return newnode; return newnode;
...@@ -305,8 +303,6 @@ _copyBitmapIndexScan(BitmapIndexScan *from) ...@@ -305,8 +303,6 @@ _copyBitmapIndexScan(BitmapIndexScan *from)
COPY_SCALAR_FIELD(indexid); COPY_SCALAR_FIELD(indexid);
COPY_NODE_FIELD(indexqual); COPY_NODE_FIELD(indexqual);
COPY_NODE_FIELD(indexqualorig); COPY_NODE_FIELD(indexqualorig);
COPY_NODE_FIELD(indexstrategy);
COPY_NODE_FIELD(indexsubtype);
return newnode; return newnode;
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/nodes/outfuncs.c,v 1.324 2008/03/21 22:41:48 tgl Exp $ * $PostgreSQL: pgsql/src/backend/nodes/outfuncs.c,v 1.325 2008/04/13 20:51:20 tgl Exp $
* *
* NOTES * NOTES
* Every node type that can appear in stored rules' parsetrees *must* * Every node type that can appear in stored rules' parsetrees *must*
...@@ -372,8 +372,6 @@ _outIndexScan(StringInfo str, IndexScan *node) ...@@ -372,8 +372,6 @@ _outIndexScan(StringInfo str, IndexScan *node)
WRITE_OID_FIELD(indexid); WRITE_OID_FIELD(indexid);
WRITE_NODE_FIELD(indexqual); WRITE_NODE_FIELD(indexqual);
WRITE_NODE_FIELD(indexqualorig); WRITE_NODE_FIELD(indexqualorig);
WRITE_NODE_FIELD(indexstrategy);
WRITE_NODE_FIELD(indexsubtype);
WRITE_ENUM_FIELD(indexorderdir, ScanDirection); WRITE_ENUM_FIELD(indexorderdir, ScanDirection);
} }
...@@ -387,8 +385,6 @@ _outBitmapIndexScan(StringInfo str, BitmapIndexScan *node) ...@@ -387,8 +385,6 @@ _outBitmapIndexScan(StringInfo str, BitmapIndexScan *node)
WRITE_OID_FIELD(indexid); WRITE_OID_FIELD(indexid);
WRITE_NODE_FIELD(indexqual); WRITE_NODE_FIELD(indexqual);
WRITE_NODE_FIELD(indexqualorig); WRITE_NODE_FIELD(indexqualorig);
WRITE_NODE_FIELD(indexstrategy);
WRITE_NODE_FIELD(indexsubtype);
} }
static void static void
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/optimizer/path/indxpath.c,v 1.228 2008/03/25 22:42:43 tgl Exp $ * $PostgreSQL: pgsql/src/backend/optimizer/path/indxpath.c,v 1.229 2008/04/13 20:51:20 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -2465,7 +2465,6 @@ expand_indexqual_rowcompare(RestrictInfo *rinfo, ...@@ -2465,7 +2465,6 @@ expand_indexqual_rowcompare(RestrictInfo *rinfo,
int op_strategy; int op_strategy;
Oid op_lefttype; Oid op_lefttype;
Oid op_righttype; Oid op_righttype;
bool op_recheck;
int matching_cols; int matching_cols;
Oid expr_op; Oid expr_op;
List *opfamilies; List *opfamilies;
...@@ -2488,8 +2487,7 @@ expand_indexqual_rowcompare(RestrictInfo *rinfo, ...@@ -2488,8 +2487,7 @@ expand_indexqual_rowcompare(RestrictInfo *rinfo,
get_op_opfamily_properties(expr_op, index->opfamily[indexcol], get_op_opfamily_properties(expr_op, index->opfamily[indexcol],
&op_strategy, &op_strategy,
&op_lefttype, &op_lefttype,
&op_righttype, &op_righttype);
&op_recheck);
/* Build lists of the opfamilies and operator datatypes in case needed */ /* Build lists of the opfamilies and operator datatypes in case needed */
opfamilies = list_make1_oid(index->opfamily[indexcol]); opfamilies = list_make1_oid(index->opfamily[indexcol]);
lefttypes = list_make1_oid(op_lefttype); lefttypes = list_make1_oid(op_lefttype);
...@@ -2557,8 +2555,7 @@ expand_indexqual_rowcompare(RestrictInfo *rinfo, ...@@ -2557,8 +2555,7 @@ expand_indexqual_rowcompare(RestrictInfo *rinfo,
get_op_opfamily_properties(expr_op, index->opfamily[i], get_op_opfamily_properties(expr_op, index->opfamily[i],
&op_strategy, &op_strategy,
&op_lefttype, &op_lefttype,
&op_righttype, &op_righttype);
&op_recheck);
opfamilies = lappend_oid(opfamilies, index->opfamily[i]); opfamilies = lappend_oid(opfamilies, index->opfamily[i]);
lefttypes = lappend_oid(lefttypes, op_lefttype); lefttypes = lappend_oid(lefttypes, op_lefttype);
righttypes = lappend_oid(righttypes, op_righttype); righttypes = lappend_oid(righttypes, op_righttype);
......
This diff is collapsed.
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/selfuncs.c,v 1.247 2008/03/25 22:42:44 tgl Exp $ * $PostgreSQL: pgsql/src/backend/utils/adt/selfuncs.c,v 1.248 2008/04/13 20:51:20 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -2275,7 +2275,6 @@ mergejoinscansel(PlannerInfo *root, Node *clause, ...@@ -2275,7 +2275,6 @@ mergejoinscansel(PlannerInfo *root, Node *clause,
int op_strategy; int op_strategy;
Oid op_lefttype; Oid op_lefttype;
Oid op_righttype; Oid op_righttype;
bool op_recheck;
Oid opno, Oid opno,
lsortop, lsortop,
rsortop, rsortop,
...@@ -2314,10 +2313,8 @@ mergejoinscansel(PlannerInfo *root, Node *clause, ...@@ -2314,10 +2313,8 @@ mergejoinscansel(PlannerInfo *root, Node *clause,
get_op_opfamily_properties(opno, opfamily, get_op_opfamily_properties(opno, opfamily,
&op_strategy, &op_strategy,
&op_lefttype, &op_lefttype,
&op_righttype, &op_righttype);
&op_recheck);
Assert(op_strategy == BTEqualStrategyNumber); Assert(op_strategy == BTEqualStrategyNumber);
Assert(!op_recheck);
/* /*
* Look up the various operators we need. If we don't find them all, it * Look up the various operators we need. If we don't find them all, it
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/cache/lsyscache.c,v 1.156 2008/03/25 22:42:44 tgl Exp $ * $PostgreSQL: pgsql/src/backend/utils/cache/lsyscache.c,v 1.157 2008/04/13 20:51:21 tgl Exp $
* *
* NOTES * NOTES
* Eventually, the index information should go through here, too. * Eventually, the index information should go through here, too.
...@@ -80,8 +80,8 @@ get_op_opfamily_strategy(Oid opno, Oid opfamily) ...@@ -80,8 +80,8 @@ get_op_opfamily_strategy(Oid opno, Oid opfamily)
/* /*
* get_op_opfamily_properties * get_op_opfamily_properties
* *
* Get the operator's strategy number, input types, and recheck (lossy) * Get the operator's strategy number and declared input data types
* flag within the specified opfamily. * within the specified opfamily.
* *
* Caller should already have verified that opno is a member of opfamily, * Caller should already have verified that opno is a member of opfamily,
* therefore we raise an error if the tuple is not found. * therefore we raise an error if the tuple is not found.
...@@ -90,8 +90,7 @@ void ...@@ -90,8 +90,7 @@ void
get_op_opfamily_properties(Oid opno, Oid opfamily, get_op_opfamily_properties(Oid opno, Oid opfamily,
int *strategy, int *strategy,
Oid *lefttype, Oid *lefttype,
Oid *righttype, Oid *righttype)
bool *recheck)
{ {
HeapTuple tp; HeapTuple tp;
Form_pg_amop amop_tup; Form_pg_amop amop_tup;
...@@ -107,7 +106,6 @@ get_op_opfamily_properties(Oid opno, Oid opfamily, ...@@ -107,7 +106,6 @@ get_op_opfamily_properties(Oid opno, Oid opfamily,
*strategy = amop_tup->amopstrategy; *strategy = amop_tup->amopstrategy;
*lefttype = amop_tup->amoplefttype; *lefttype = amop_tup->amoplefttype;
*righttype = amop_tup->amoprighttype; *righttype = amop_tup->amoprighttype;
*recheck = amop_tup->amopreqcheck;
ReleaseSysCache(tp); ReleaseSysCache(tp);
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/include/executor/nodeIndexscan.h,v 1.31 2008/01/01 19:45:57 momjian Exp $ * $PostgreSQL: pgsql/src/include/executor/nodeIndexscan.h,v 1.32 2008/04/13 20:51:21 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -26,8 +26,7 @@ extern void ExecIndexReScan(IndexScanState *node, ExprContext *exprCtxt); ...@@ -26,8 +26,7 @@ extern void ExecIndexReScan(IndexScanState *node, ExprContext *exprCtxt);
/* routines exported to share code with nodeBitmapIndexscan.c */ /* routines exported to share code with nodeBitmapIndexscan.c */
extern void ExecIndexBuildScanKeys(PlanState *planstate, Relation index, extern void ExecIndexBuildScanKeys(PlanState *planstate, Relation index,
List *quals, List *strategies, List *subtypes, List *quals, ScanKey *scanKeys, int *numScanKeys,
ScanKey *scanKeys, int *numScanKeys,
IndexRuntimeKeyInfo **runtimeKeys, int *numRuntimeKeys, IndexRuntimeKeyInfo **runtimeKeys, int *numRuntimeKeys,
IndexArrayKeyInfo **arrayKeys, int *numArrayKeys); IndexArrayKeyInfo **arrayKeys, int *numArrayKeys);
extern void ExecIndexEvalRuntimeKeys(ExprContext *econtext, extern void ExecIndexEvalRuntimeKeys(ExprContext *econtext,
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/include/nodes/plannodes.h,v 1.99 2008/01/01 19:45:58 momjian Exp $ * $PostgreSQL: pgsql/src/include/nodes/plannodes.h,v 1.100 2008/04/13 20:51:21 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -241,10 +241,6 @@ typedef Scan SeqScan; ...@@ -241,10 +241,6 @@ typedef Scan SeqScan;
* table). This is a bit hokey ... would be cleaner to use a special-purpose * table). This is a bit hokey ... would be cleaner to use a special-purpose
* node type that could not be mistaken for a regular Var. But it will do * node type that could not be mistaken for a regular Var. But it will do
* for now. * for now.
*
* indexstrategy and indexsubtype are lists corresponding one-to-one with
* indexqual; they give information about the indexable operators that appear
* at the top of each indexqual.
* ---------------- * ----------------
*/ */
typedef struct IndexScan typedef struct IndexScan
...@@ -253,8 +249,6 @@ typedef struct IndexScan ...@@ -253,8 +249,6 @@ typedef struct IndexScan
Oid indexid; /* OID of index to scan */ Oid indexid; /* OID of index to scan */
List *indexqual; /* list of index quals (OpExprs) */ List *indexqual; /* list of index quals (OpExprs) */
List *indexqualorig; /* the same in original form */ List *indexqualorig; /* the same in original form */
List *indexstrategy; /* integer list of strategy numbers */
List *indexsubtype; /* OID list of strategy subtypes */
ScanDirection indexorderdir; /* forward or backward or don't care */ ScanDirection indexorderdir; /* forward or backward or don't care */
} IndexScan; } IndexScan;
...@@ -281,8 +275,6 @@ typedef struct BitmapIndexScan ...@@ -281,8 +275,6 @@ typedef struct BitmapIndexScan
Oid indexid; /* OID of index to scan */ Oid indexid; /* OID of index to scan */
List *indexqual; /* list of index quals (OpExprs) */ List *indexqual; /* list of index quals (OpExprs) */
List *indexqualorig; /* the same in original form */ List *indexqualorig; /* the same in original form */
List *indexstrategy; /* integer list of strategy numbers */
List *indexsubtype; /* OID list of strategy subtypes */
} BitmapIndexScan; } BitmapIndexScan;
/* ---------------- /* ----------------
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/include/utils/lsyscache.h,v 1.122 2008/01/01 19:45:59 momjian Exp $ * $PostgreSQL: pgsql/src/include/utils/lsyscache.h,v 1.123 2008/04/13 20:51:21 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -31,8 +31,7 @@ extern int get_op_opfamily_strategy(Oid opno, Oid opfamily); ...@@ -31,8 +31,7 @@ extern int get_op_opfamily_strategy(Oid opno, Oid opfamily);
extern void get_op_opfamily_properties(Oid opno, Oid opfamily, extern void get_op_opfamily_properties(Oid opno, Oid opfamily,
int *strategy, int *strategy,
Oid *lefttype, Oid *lefttype,
Oid *righttype, Oid *righttype);
bool *recheck);
extern Oid get_opfamily_member(Oid opfamily, Oid lefttype, Oid righttype, extern Oid get_opfamily_member(Oid opfamily, Oid lefttype, Oid righttype,
int16 strategy); int16 strategy);
extern bool get_ordering_op_properties(Oid opno, extern bool get_ordering_op_properties(Oid opno,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment