diff options
author | Sergei Golubchik <serg@mariadb.org> | 2017-10-24 14:53:18 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2017-10-24 14:53:18 +0200 |
commit | e0a1c745ec3ed1ec6c0375a2a624697c29f480a6 (patch) | |
tree | 24ded2c6ebe3ea3413ce56af89ea0f2f63bb3a39 /sql/sql_select.cc | |
parent | 4ec88ea9c3ec52d996b39167d12a61ab95fdeacc (diff) | |
parent | 2aa51f528fd5d23cc54eca8fbd07e88e7b2993c7 (diff) | |
download | mariadb-git-e0a1c745ec3ed1ec6c0375a2a624697c29f480a6.tar.gz |
Merge branch '10.1' into 10.2
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 f4f0e46afed..46e1a912250 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -804,7 +804,7 @@ JOIN::prepare(TABLE_LIST *tables_init, thd->lex->current_select->context_analysis_place; thd->lex->current_select->context_analysis_place= SELECT_LIST; if (setup_fields(thd, ref_ptrs, fields_list, MARK_COLUMNS_READ, - &all_fields, 1)) + &all_fields, &select_lex->pre_fix, 1)) DBUG_RETURN(-1); thd->lex->current_select->context_analysis_place= save_place; @@ -14708,10 +14708,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); /* |