summaryrefslogtreecommitdiff
path: root/sql/sql_union.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_union.cc')
-rw-r--r--sql/sql_union.cc13
1 files changed, 12 insertions, 1 deletions
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index 7265a99d6e5..468bdab9119 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -460,13 +460,24 @@ int st_select_lex_unit::cleanup()
table= 0; // Safety
}
JOIN *join;
- for (SELECT_LEX *sl= first_select_in_union(); sl; sl= sl->next_select())
+ SELECT_LEX *sl= first_select_in_union();
+ for (; sl; sl= sl->next_select())
{
if ((join= sl->join))
{
error|= sl->join->cleanup();
delete join;
}
+ else
+ {
+ // it can be DO/SET with subqueries
+ for (SELECT_LEX_UNIT *lex_unit= sl->first_inner_unit();
+ lex_unit != 0;
+ lex_unit= lex_unit->next_unit())
+ {
+ error|= lex_unit->cleanup();
+ }
+ }
}
if (fake_select_lex && (join= fake_select_lex->join))
{