diff options
author | Sergei Golubchik <serg@mariadb.org> | 2017-10-22 13:03:41 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2017-10-22 13:03:41 +0200 |
commit | 9d2e2d753323a934604d25144b9d1ecaf34b47d8 (patch) | |
tree | 051a721f7ea77c2278d09323e36088abe22aa66a /sql/sql_select.cc | |
parent | d11af09865299033d5eef64531704f6ab8af5304 (diff) | |
parent | 2eb3c5e5420a724945a4cba914df25aa1e3744ce (diff) | |
download | mariadb-git-9d2e2d753323a934604d25144b9d1ecaf34b47d8.tar.gz |
Merge branch '10.0' into 10.1
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r-- | sql/sql_select.cc | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc index f9da12aac29..9c6656d9e5d 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -797,7 +797,7 @@ JOIN::prepare(Item ***rref_pointer_array, wild_num)) || select_lex->setup_ref_array(thd, real_og_num) || setup_fields(thd, (*rref_pointer_array), fields_list, MARK_COLUMNS_READ, - &all_fields, 1) || + &all_fields, &select_lex->pre_fix, 1) || setup_without_group(thd, (*rref_pointer_array), tables_list, select_lex->leaf_tables, fields_list, all_fields, &conds, order, group_list, @@ -14639,10 +14639,23 @@ simplify_joins(JOIN *join, List<TABLE_LIST> *join_list, COND *conds, bool top, nested_join= table->nested_join; if (table->sj_on_expr && !in_sj) { - /* - If this is a semi-join that is not contained within another semi-join, - leave it intact (otherwise it is flattened) - */ + /* + If this is a semi-join that is not contained within another semi-join + leave it intact (otherwise it is flattened) + */ + /* + Make sure that any semi-join appear in + the join->select_lex->sj_nests list only once + */ + List_iterator_fast<TABLE_LIST> sj_it(join->select_lex->sj_nests); + TABLE_LIST *sj_nest; + while ((sj_nest= sj_it++)) + { + if (table == sj_nest) + break; + } + if (sj_nest) + continue; join->select_lex->sj_nests.push_back(table, join->thd->mem_root); /* |