Fix for AND/OR handling.
authorBruce Momjian
Mon, 21 Sep 1998 15:41:28 +0000 (15:41 +0000)
committerBruce Momjian
Mon, 21 Sep 1998 15:41:28 +0000 (15:41 +0000)
src/backend/optimizer/path/indxpath.c
src/backend/optimizer/path/orindxpath.c
src/backend/optimizer/util/pathnode.c

index 24f46ec9331068d0a819fb4d574e7d88b1088885..3d505c87c008ca5f900a7a7be48cf1761dd3442c 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.34 1998/09/01 04:29:33 momjian Exp $
+ *   $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.35 1998/09/21 15:41:26 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1293,8 +1293,13 @@ index_innerjoin(Query *root, RelOptInfo * rel, List *clausegroup_list,
                          length(clausegroup),
                          &temp_pages,
                          &temp_selec);
+
        pathnode->path.pathtype = T_IndexScan;
        pathnode->path.parent = rel;
+       pathnode->path.p_ordering.ordtype = SORTOP_ORDER;
+       pathnode->path.p_ordering.ord.sortop = index->ordering;
+       pathnode->path.keys = NIL;  /* not sure about this, bjm 1998/09/21 */
+
        pathnode->indexid = index->relids;
        pathnode->indexkeys = index->indexkeys;
        pathnode->indexqual = clausegroup;
index 3f8d6b15daf0c578be1370949adf4d44527e15eb..31bd977de162da51ff1986b06c2c692a2fab8a08 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/backend/optimizer/path/orindxpath.c,v 1.11 1998/09/01 04:29:41 momjian Exp $
+ *   $Header: /cvsroot/pgsql/src/backend/optimizer/path/orindxpath.c,v 1.12 1998/09/21 15:41:27 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -104,6 +104,15 @@ create_or_index_paths(Query *root,
 
                pathnode->path.pathtype = T_IndexScan;
                pathnode->path.parent = rel;
+               pathnode->path.p_ordering.ordtype = SORTOP_ORDER;
+               /*
+                *  This is an IndexScan, but it does index lookups based
+                *  on the order of the fields specified in the WHERE clause,
+                *  not in any order, so the sortop is NULL.
+                */
+               pathnode->path.p_ordering.ord.sortop = NULL;
+               pathnode->path.keys = NIL;  /* not sure about this, bjm 1998/09/21 */
+
                pathnode->indexqual = lcons(clausenode, NIL);
                pathnode->indexid = indexids;
                pathnode->path.path_cost = cost;
index 598400fa49adef8a3e19747f79e2c3ef9e5100c7..d7dcbcc84f9e201e5f3353aa3142d2ba179d50d9 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/backend/optimizer/util/pathnode.c,v 1.12 1998/09/01 04:30:08 momjian Exp $
+ *   $Header: /cvsroot/pgsql/src/backend/optimizer/util/pathnode.c,v 1.13 1998/09/21 15:41:28 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -355,20 +355,17 @@ create_index_path(Query *root,
                          &npages,
                          &selec);
        /* each clause gets an equal selectivity */
-       clausesel =
-           pow(selec,
-               1.0 / (double) length(restriction_clauses));
+       clausesel = pow(selec, 1.0 / (double) length(restriction_clauses));
 
        pathnode->indexqual = restriction_clauses;
-       pathnode->path.path_cost =
-           cost_index(lfirsti(index->relids),
-                      (int) npages,
-                      selec,
-                      rel->pages,
-                      rel->tuples,
-                      index->pages,
-                      index->tuples,
-                      false);
+       pathnode->path.path_cost = cost_index(lfirsti(index->relids),
+                                              (int) npages,
+                                              selec,
+                                              rel->pages,
+                                              rel->tuples,
+                                              index->pages,
+                                              index->tuples,
+                                              false);
 
 #if 0
        /* add in expensive functions cost!  -- JMH, 7/7/92 */