summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2022-04-06 08:06:35 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2022-04-06 08:06:35 +0300
commit7c584d8270cf192496f36e993e7759616f3b650b (patch)
tree26e4111ca76af60136ac25c47496909f7e6e3545 /sql/sql_select.cc
parent2d2c3da8ec846d8018c112d8901e2ae029f1c795 (diff)
parent75b9014fedd8bb85d15501a2281fbade6b56fe78 (diff)
downloadmariadb-git-7c584d8270cf192496f36e993e7759616f3b650b.tar.gz
Merge 10.2 into 10.3
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r--sql/sql_select.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 35715fe2812..8d922ca953f 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -26450,8 +26450,11 @@ bool mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit, select_result *result)
if (unit->is_unit_op() || unit->fake_select_lex)
{
+ ulonglong save_options= 0;
+
if (unit->union_needs_tmp_table() && unit->fake_select_lex)
{
+ save_options= unit->fake_select_lex->options;
unit->fake_select_lex->select_number= FAKE_SELECT_LEX_ID; // just for initialization
unit->fake_select_lex->type= unit_operation_text[unit->common_op()];
unit->fake_select_lex->options|= SELECT_DESCRIBE;
@@ -26459,6 +26462,9 @@ bool mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit, select_result *result)
if (!(res= unit->prepare(unit->derived, result,
SELECT_NO_UNLOCK | SELECT_DESCRIBE)))
res= unit->exec();
+
+ if (unit->union_needs_tmp_table() && unit->fake_select_lex)
+ unit->fake_select_lex->options= save_options;
}
else
{