summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql')
-rw-r--r--sql/item_subselect.cc3
-rw-r--r--sql/sql_class.h6
-rw-r--r--sql/sql_lex.h1
-rw-r--r--sql/sql_union.cc2
4 files changed, 5 insertions, 7 deletions
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index 832a67774a2..a62bb175a86 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -3397,7 +3397,8 @@ bool subselect_union_engine::no_rows()
/* Check if we got any rows when reading UNION result from temp. table: */
return MY_TEST(!(unit->fake_select_lex ?
unit->fake_select_lex->join->send_records :
- ((select_union_direct *) result)->send_records));
+ ((select_union_direct *)(unit->get_union_result()))
+ ->send_records));
}
diff --git a/sql/sql_class.h b/sql/sql_class.h
index d44ade1c845..4198402ae9b 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -4463,13 +4463,7 @@ public:
}
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;
- DBUG_ASSERT(false); /* purecov: inspected */
}
void set_thd(THD *thd_arg)
{
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index deb476296fd..b18cff131ca 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -676,6 +676,7 @@ public:
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_part2(Explain_query *output);
};
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index 45d27116c36..490123b644b 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -784,6 +784,8 @@ bool st_select_lex_unit::exec()
if (uncacheable || !item || !item->assigned() || describe)
{
+ if (!fake_select_lex)
+ union_result->cleanup();
for (SELECT_LEX *sl= select_cursor; sl; sl= sl->next_select())
{
ha_rows records_at_start= 0;