OSDN Git Service

Up to date with 10 beta 2
[pghintplan/pg_hint_plan.git] / make_join_rel.c
index 109c4fa..ac8e0c2 100644 (file)
@@ -1,7 +1,8 @@
 /*-------------------------------------------------------------------------
  *
  * make_join_rel.c
- *       Routines copied from PostgreSQL core distribution.
+ *       Routines copied from PostgreSQL core distribution with some
+ *       modifications.
  *
  * src/backend/optimizer/path/joinrels.c
  *     make_join_rel()
  *-------------------------------------------------------------------------
  */
 
+static void populate_joinrel_with_paths(PlannerInfo *root, RelOptInfo *rel1,
+                                                                               RelOptInfo *rel2, RelOptInfo *joinrel,
+                                                                               SpecialJoinInfo *sjinfo,
+                                                                               List *restrictlist);
 /*
  * adjust_rows: tweak estimated row numbers according to the hint.
 */
@@ -207,6 +212,27 @@ make_join_rel(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2)
                return joinrel;
        }
 
+       /* Add paths to the join relation. */
+       populate_joinrel_with_paths(root, rel1, rel2, joinrel, sjinfo,
+                                                               restrictlist);
+
+       bms_free(joinrelids);
+
+       return joinrel;
+}
+
+/*
+ * populate_joinrel_with_paths
+ *       Add paths to the given joinrel for given pair of joining relations. The
+ *       SpecialJoinInfo provides details about the join and the restrictlist
+ *       contains the join clauses and the other clauses applicable for given pair
+ *       of the joining relations.
+ */
+static void
+populate_joinrel_with_paths(PlannerInfo *root, RelOptInfo *rel1,
+                                                       RelOptInfo *rel2, RelOptInfo *joinrel,
+                                                       SpecialJoinInfo *sjinfo, List *restrictlist)
+{
        /*
         * Consider paths using each rel as both outer and inner.  Depending on
         * the join type, a provably empty outer or inner rel might mean the join
@@ -351,8 +377,4 @@ make_join_rel(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2)
                        elog(ERROR, "unrecognized join type: %d", (int) sjinfo->jointype);
                        break;
        }
-
-       bms_free(joinrelids);
-
-       return joinrel;
 }