diff --git a/sql/sql_select.cc b/sql/sql_select.cc index a66c6bd15d8..d38363f15d1 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -10533,6 +10533,7 @@ void JOIN::cleanup(bool full) { tab->cleanup(); } + table= 0; } else { diff --git a/sql/sql_union.cc b/sql/sql_union.cc index 5c4a9a8db5f..f82657a837c 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -628,6 +628,7 @@ bool st_select_lex_unit::exec() { ha_rows records_at_start= 0; thd->lex->current_select= sl; + fake_select_lex->uncacheable|= sl->uncacheable; { set_limit(sl);