diff options
Diffstat (limited to 'sql/sql_derived.cc')
-rw-r--r-- | sql/sql_derived.cc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc index 0e04316a2e7..4bfb8cdfe3c 100644 --- a/sql/sql_derived.cc +++ b/sql/sql_derived.cc @@ -151,7 +151,11 @@ static int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, if (is_union) - res= mysql_union(thd, lex, derived_result, unit); + { + // execute union without clean up + if (!(res= unit->prepare(thd, derived_result, SELECT_NO_UNLOCK))) + res= unit->exec(); + } else { unit->offset_limit_cnt= first_select->offset_limit; |