diff options
author | Sergei Golubchik <serg@mariadb.org> | 2019-03-15 20:00:28 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2019-03-15 21:00:41 +0100 |
commit | 0508d327aef520d3131ff8a85ed610337149fffc (patch) | |
tree | 7e04769f49b4aded9053adcad442fe00eb487d98 /sql/sql_union.cc | |
parent | bb8c82c66abddf796e8d44f817518e5ab38ae6e4 (diff) | |
parent | 34db9958e28c325b0f708f78b7ff029de810d5ea (diff) | |
download | mariadb-git-0508d327aef520d3131ff8a85ed610337149fffc.tar.gz |
Merge branch '10.1' into 10.2
Diffstat (limited to 'sql/sql_union.cc')
-rw-r--r-- | sql/sql_union.cc | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/sql/sql_union.cc b/sql/sql_union.cc index abee979ff1c..94b8c662a06 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -843,15 +843,6 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result, allocation in setup_ref_array(). */ fake_select_lex->n_child_sum_items+= global_parameters()->n_sum_items; - - saved_error= fake_select_lex->join-> - prepare(fake_select_lex->table_list.first, - 0, 0, - global_parameters()->order_list.elements, // og_num - global_parameters()->order_list.first, // order - false, NULL, NULL, NULL, - fake_select_lex, this); - fake_select_lex->table_list.empty(); } } else @@ -862,6 +853,24 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result, */ table->reset_item_list(&item_list); } + if (fake_select_lex != NULL && + (thd->stmt_arena->is_stmt_prepare() || + (thd->lex->context_analysis_only & CONTEXT_ANALYSIS_ONLY_VIEW))) + { + if (!fake_select_lex->join && + !(fake_select_lex->join= + new JOIN(thd, item_list, thd->variables.option_bits, result))) + { + fake_select_lex->table_list.empty(); + DBUG_RETURN(TRUE); + } + saved_error= fake_select_lex->join-> + prepare(fake_select_lex->table_list.first, 0, 0, + global_parameters()->order_list.elements, // og_num + global_parameters()->order_list.first, // order + false, NULL, NULL, NULL, fake_select_lex, this); + fake_select_lex->table_list.empty(); + } } thd_arg->lex->current_select= lex_select_save; |