Skip to content

Commit 1aa1827

Browse files
committed
1. INDEXSCAN_PATCH changes: (op Param Var) should work too
2. IndexScanableOperand now uses match_indexkey_operand instead of equal_indexkey_var (if we have some index on attribute X then we shouldn't use it for 'where some_func(X) OP CONST').
1 parent 8e90978 commit 1aa1827

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/backend/optimizer/path/indxpath.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.4 1996/11/08 05:56:55 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.5 1997/01/22 06:25:42 vadim Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -441,9 +441,17 @@ group_clauses_by_indexkey(Rel *rel,
441441
*/
442442
#define IndexScanableOperand(opnd, indkeys, rel, index) \
443443
((index->indproc == InvalidOid) ? \
444-
equal_indexkey_var(indkeys,opnd) : \
444+
match_indexkey_operand(indkeys, opnd, rel) : \
445445
function_index_operand((Expr*)opnd,rel,index))
446446

447+
/*
448+
* There was
449+
* equal_indexkey_var(indkeys,opnd) : \
450+
* above, and now
451+
* match_indexkey_operand(indkeys, opnd, rel) : \
452+
* - vadim 01/22/97
453+
*/
454+
447455
/*
448456
* match_clause_to-indexkey--
449457
* Finds the first of a relation's available restriction clauses that
@@ -513,7 +521,13 @@ match_clause_to_indexkey(Rel *rel,
513521
/*
514522
* Must try to commute the clause to standard s-arg format.
515523
*/
524+
#ifdef INDEXSCAN_PATCH
525+
/* ...And here... - vadim 01/22/97 */
526+
else if ((leftop && IsA(leftop,Const)) ||
527+
(leftop && IsA(leftop,Param)))
528+
#else
516529
else if (leftop && IsA(leftop,Const))
530+
#endif
517531
{
518532
restrict_op =
519533
get_commutator(((Oper*)((Expr*)clause)->oper)->opno);

0 commit comments

Comments
 (0)