OSDN Git Service

1. INDEXSCAN_PATCH changes: (op Param Var) should work too
authorVadim B. Mikheev <vadim4o@yahoo.com>
Wed, 22 Jan 1997 06:25:42 +0000 (06:25 +0000)
committerVadim B. Mikheev <vadim4o@yahoo.com>
Wed, 22 Jan 1997 06:25:42 +0000 (06:25 +0000)
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').

src/backend/optimizer/path/indxpath.c

index 41cbdf9..ce6a3f7 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.4 1996/11/08 05:56:55 momjian Exp $
+ *    $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.5 1997/01/22 06:25:42 vadim Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -441,9 +441,17 @@ group_clauses_by_indexkey(Rel *rel,
  */
 #define IndexScanableOperand(opnd, indkeys, rel, index) \
     ((index->indproc == InvalidOid) ? \
-       equal_indexkey_var(indkeys,opnd) : \
+       match_indexkey_operand(indkeys, opnd, rel) : \
        function_index_operand((Expr*)opnd,rel,index))
 
+/*
+ * There was
+ *     equal_indexkey_var(indkeys,opnd) : \
+ * above, and now
+ *     match_indexkey_operand(indkeys, opnd, rel) : \
+ * - vadim 01/22/97
+ */
+
 /*    
  * match_clause_to-indexkey--
  *    Finds the first of a relation's available restriction clauses that
@@ -513,7 +521,13 @@ match_clause_to_indexkey(Rel *rel,
            /*
             * Must try to commute the clause to standard s-arg format.
             */
+#ifdef INDEXSCAN_PATCH
+           /* ...And here...  - vadim 01/22/97 */ 
+           else if ((leftop && IsA(leftop,Const)) ||
+                       (leftop && IsA(leftop,Param)))
+#else
            else if (leftop && IsA(leftop,Const))
+#endif
                {
                    restrict_op =
                        get_commutator(((Oper*)((Expr*)clause)->oper)->opno);