Commit d2491996 authored by Igor Babaev's avatar Igor Babaev

Correction for the fix of the bug mdev-6874.

parent ec89abfe
...@@ -3397,7 +3397,8 @@ bool subselect_union_engine::no_rows() ...@@ -3397,7 +3397,8 @@ bool subselect_union_engine::no_rows()
/* Check if we got any rows when reading UNION result from temp. table: */ /* Check if we got any rows when reading UNION result from temp. table: */
return MY_TEST(!(unit->fake_select_lex ? return MY_TEST(!(unit->fake_select_lex ?
unit->fake_select_lex->join->send_records : unit->fake_select_lex->join->send_records :
((select_union_direct *) result)->send_records)); ((select_union_direct *)(unit->get_union_result()))
->send_records));
} }
......
...@@ -4463,13 +4463,7 @@ class select_union_direct :public select_union ...@@ -4463,13 +4463,7 @@ class select_union_direct :public select_union
} }
void cleanup() void cleanup()
{ {
/*
Only called for top-level select_results, usually select_send,
and for the results of subquery engines
(select_<something>_subselect).
*/
send_records= 0; send_records= 0;
DBUG_ASSERT(false); /* purecov: inspected */
} }
void set_thd(THD *thd_arg) void set_thd(THD *thd_arg)
{ {
......
...@@ -676,6 +676,7 @@ class st_select_lex_unit: public st_select_lex_node { ...@@ -676,6 +676,7 @@ class st_select_lex_unit: public st_select_lex_node {
List<Item> *get_unit_column_types(); List<Item> *get_unit_column_types();
select_union *get_union_result() { return union_result; }
int save_union_explain(Explain_query *output); int save_union_explain(Explain_query *output);
int save_union_explain_part2(Explain_query *output); int save_union_explain_part2(Explain_query *output);
}; };
......
...@@ -784,6 +784,8 @@ bool st_select_lex_unit::exec() ...@@ -784,6 +784,8 @@ bool st_select_lex_unit::exec()
if (uncacheable || !item || !item->assigned() || describe) if (uncacheable || !item || !item->assigned() || describe)
{ {
if (!fake_select_lex)
union_result->cleanup();
for (SELECT_LEX *sl= select_cursor; sl; sl= sl->next_select()) for (SELECT_LEX *sl= select_cursor; sl; sl= sl->next_select())
{ {
ha_rows records_at_start= 0; ha_rows records_at_start= 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment