diff options
author | Sergei Golubchik <serg@mariadb.org> | 2021-02-23 13:01:27 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2021-02-23 13:06:22 +0100 |
commit | f33e57a9e66f7e1790cb84b141381bb668e281a0 (patch) | |
tree | 31bb1c5bd8e0addc9e994a1bb42b4703c37f7ed8 /sql/sql_tvc.cc | |
parent | 1a0526e2f294acdcac829672794ee1fe708eb2b3 (diff) | |
parent | 245d33db4e0586df4fe28362fb002cef0151a1c9 (diff) | |
download | mariadb-git-f33e57a9e66f7e1790cb84b141381bb668e281a0.tar.gz |
Merge branch '10.4' into 10.5
Diffstat (limited to 'sql/sql_tvc.cc')
-rw-r--r-- | sql/sql_tvc.cc | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/sql/sql_tvc.cc b/sql/sql_tvc.cc index 9a7084cdca2..e8a201aecfc 100644 --- a/sql/sql_tvc.cc +++ b/sql/sql_tvc.cc @@ -372,6 +372,13 @@ int table_value_constr::save_explain_data_intern(THD *thd, if (select_lex->master_unit()->derived) explain->connection_type= Explain_node::EXPLAIN_NODE_DERIVED; + for (SELECT_LEX_UNIT *unit= select_lex->first_inner_unit(); + unit; + unit= unit->next_unit()) + { + explain->add_child(unit->first_select()->select_number); + } + output->add_node(explain); if (select_lex->is_top_level_node()) @@ -396,9 +403,14 @@ bool table_value_constr::optimize(THD *thd) thd->lex->explain && // for "SET" command in SPs. (!thd->lex->explain->get_select(select_lex->select_number))) { - return save_explain_data_intern(thd, thd->lex->explain); + if (save_explain_data_intern(thd, thd->lex->explain)) + return true; } - return 0; + + if (select_lex->optimize_unflattened_subqueries(true)) + return true; + + return false; } @@ -811,11 +823,12 @@ st_select_lex *wrap_tvc_with_tail(THD *thd, st_select_lex *tvc_sl) SELECT * FROM (VALUES (v1), ... (vn)) tvc_x and replaces the subselect with the result of the transformation. - @retval false if successfull - true otherwise + @retval wrapping select if successful + 0 otherwise */ -bool Item_subselect::wrap_tvc_into_select(THD *thd, st_select_lex *tvc_sl) +st_select_lex * +Item_subselect::wrap_tvc_into_select(THD *thd, st_select_lex *tvc_sl) { LEX *lex= thd->lex; /* SELECT_LEX object where the transformation is performed */ @@ -826,12 +839,12 @@ bool Item_subselect::wrap_tvc_into_select(THD *thd, st_select_lex *tvc_sl) if (engine->engine_type() == subselect_engine::SINGLE_SELECT_ENGINE) ((subselect_single_select_engine *) engine)->change_select(wrapper_sl); lex->current_select= wrapper_sl; - return false; + return wrapper_sl; } else { lex->current_select= parent_select; - return true; + return 0; } } |