]> granicus.if.org Git - postgresql/blobdiff - src/backend/optimizer/path/indxpath.c
Clean up possibly-uninitialized-variable warnings reported by gcc 4.x.
[postgresql] / src / backend / optimizer / path / indxpath.c
index c689d1461e9e59db7f8ad2e473a1aa01b97cb4da..f186b89db4479ce920a733115a57f3af32d0d028 100644 (file)
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/optimizer/path/indxpath.c,v 1.188 2005/08/28 22:47:20 tgl Exp $
+ *       $PostgreSQL: pgsql/src/backend/optimizer/path/indxpath.c,v 1.190 2005/09/24 22:54:36 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -65,10 +65,9 @@ static bool matches_any_index(RestrictInfo *rinfo, RelOptInfo *rel,
                                                          Relids outer_relids);
 static List *find_clauses_for_join(PlannerInfo *root, RelOptInfo *rel,
                                                                   Relids outer_relids, bool isouterjoin);
-static bool match_variant_ordering(PlannerInfo *root,
-                                                                  IndexOptInfo *index,
-                                                                  List *restrictclauses,
-                                                                  ScanDirection *indexscandir);
+static ScanDirection match_variant_ordering(PlannerInfo *root,
+                                                                                       IndexOptInfo *index,
+                                                                                       List *restrictclauses);
 static List *identify_ignorable_ordering_cols(PlannerInfo *root,
                                                                                          IndexOptInfo *index,
                                                                                          List *restrictclauses);
@@ -362,15 +361,15 @@ find_usable_indexes(PlannerInfo *root, RelOptInfo *rel,
                        root->query_pathkeys != NIL &&
                        pathkeys_useful_for_ordering(root, useful_pathkeys) == 0)
                {
-                       ScanDirection   indexscandir;
+                       ScanDirection   scandir;
 
-                       if (match_variant_ordering(root, index, restrictclauses,
-                                                                          &indexscandir))
+                       scandir = match_variant_ordering(root, index, restrictclauses);
+                       if (!ScanDirectionIsNoMovement(scandir))
                        {
                                ipath = create_index_path(root, index,
                                                                                  restrictclauses,
                                                                                  root->query_pathkeys,
-                                                                                 indexscandir,
+                                                                                 scandir,
                                                                                  false);
                                result = lappend(result, ipath);
                        }
@@ -955,15 +954,13 @@ indexable_outerrelids(RelOptInfo *rel)
        /*
         * Examine each joinclause in the joininfo list to see if it matches any
         * key of any index.  If so, add the clause's other rels to the result.
-        * (Note: we consider only actual participants, not extraneous rels
-        * possibly mentioned in required_relids.)
         */
        foreach(l, rel->joininfo)
        {
                RestrictInfo *joininfo = (RestrictInfo *) lfirst(l);
                Relids  other_rels;
 
-               other_rels = bms_difference(joininfo->clause_relids, rel->relids);
+               other_rels = bms_difference(joininfo->required_relids, rel->relids);
                if (matches_any_index(joininfo, rel, other_rels))
                        outer_relids = bms_join(outer_relids, other_rels);
                else
@@ -1306,15 +1303,14 @@ find_clauses_for_join(PlannerInfo *root, RelOptInfo *rel,
  * 'restrictclauses' is the list of sublists of restriction clauses
  *             matching the columns of the index (NIL if none)
  *
- * Returns TRUE if able to match the requested query pathkeys, FALSE if not.
- * In the TRUE case, sets '*indexscandir' to either ForwardScanDirection or
- * BackwardScanDirection to indicate the proper scan direction.
+ * If able to match the requested query pathkeys, returns either
+ * ForwardScanDirection or BackwardScanDirection to indicate the proper index
+ * scan direction.  If no match, returns NoMovementScanDirection.
  */
-static bool
+static ScanDirection
 match_variant_ordering(PlannerInfo *root,
                                           IndexOptInfo *index,
-                                          List *restrictclauses,
-                                          ScanDirection *indexscandir)
+                                          List *restrictclauses)
 {
        List       *ignorables;
 
@@ -1330,7 +1326,7 @@ match_variant_ordering(PlannerInfo *root,
         * won't cope.
         */
        if (index->relam != BTREE_AM_OID)
-               return false;
+               return NoMovementScanDirection;
        /*
         * Figure out which index columns can be optionally ignored because
         * they have an equality constraint.  This is the same set for either
@@ -1346,17 +1342,13 @@ match_variant_ordering(PlannerInfo *root,
        if (ignorables &&
                match_index_to_query_keys(root, index, ForwardScanDirection,
                                                                  ignorables))
-       {
-               *indexscandir = ForwardScanDirection;
-               return true;
-       }
+               return ForwardScanDirection;
+
        if (match_index_to_query_keys(root, index, BackwardScanDirection,
                                                                  ignorables))
-       {
-               *indexscandir = BackwardScanDirection;
-               return true;
-       }
-       return false;
+               return BackwardScanDirection;
+
+       return NoMovementScanDirection;
 }
 
 /*