From b4c7cdff8bd3f55812e5ff898fc41533642102c3 Mon Sep 17 00:00:00 2001 From: Kyotaro Horiguchi Date: Thu, 27 Jul 2017 19:07:55 +0900 Subject: [PATCH] Up to date with 10 beta 2 Make copied code to be up to date with the core as of 10 beta 2. --- core.c | 9 +++++---- make_join_rel.c | 29 +++++++++++++++++++++++++---- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/core.c b/core.c index aa8d868..d78858c 100644 --- a/core.c +++ b/core.c @@ -194,14 +194,14 @@ add_paths_to_append_rel(PlannerInfo *root, RelOptInfo *rel, */ if (childrel->cheapest_total_path->param_info == NULL) subpaths = accumulate_append_subpath(subpaths, - childrel->cheapest_total_path); + childrel->cheapest_total_path); else subpaths_valid = false; /* Same idea, but for a partial plan. */ if (childrel->partial_pathlist != NIL) partial_subpaths = accumulate_append_subpath(partial_subpaths, - linitial(childrel->partial_pathlist)); + linitial(childrel->partial_pathlist)); else partial_subpaths_valid = false; @@ -758,7 +758,7 @@ join_search_one_level(PlannerInfo *root, int level) if (level == 2) /* consider remaining initial rels */ other_rels = lnext(r); - else /* consider all initial rels */ + else /* consider all initial rels */ other_rels = list_head(joinrels[1]); make_rels_by_clause_joins(root, @@ -1282,7 +1282,7 @@ join_is_legal(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2, !bms_is_subset(sjinfo->min_righthand, join_plus_rhs)) { join_plus_rhs = bms_add_members(join_plus_rhs, - sjinfo->min_righthand); + sjinfo->min_righthand); more = true; } /* full joins constrain both sides symmetrically */ @@ -1455,3 +1455,4 @@ restriction_is_constant_false(List *restrictlist, bool only_pushed_down) } return false; } + diff --git a/make_join_rel.c b/make_join_rel.c index 94bbfb8..ac8e0c2 100644 --- a/make_join_rel.c +++ b/make_join_rel.c @@ -14,6 +14,10 @@ *------------------------------------------------------------------------- */ +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. */ @@ -208,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 @@ -352,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; } -- 2.11.0