diff options
author | evgen@moonbone.local <> | 2005-08-15 23:05:05 +0400 |
---|---|---|
committer | evgen@moonbone.local <> | 2005-08-15 23:05:05 +0400 |
commit | 69319f17e7c2ffcde7b86a6679adc7acefc582ec (patch) | |
tree | 762356cfe7e6b7b4041c264bbfe2db5669a2c765 /sql/sql_lex.cc | |
parent | fb19be7d6d1d94942de20ae4f9a413c8c0f3fba6 (diff) | |
download | mariadb-git-69319f17e7c2ffcde7b86a6679adc7acefc582ec.tar.gz |
Fix bug #10624 Views with multiple UNION and UNION ALL produce incorrect
results.
st_select_lex_unit::print() was losing UNION ALL if in statement were present
UNION DISTINCT.
Diffstat (limited to 'sql/sql_lex.cc')
-rw-r--r-- | sql/sql_lex.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 86e677cc8dc..bbff64e516f 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -1511,13 +1511,16 @@ bool st_select_lex::setup_ref_array(THD *thd, uint order_group_num) void st_select_lex_unit::print(String *str) { + bool union_all= !union_distinct; for (SELECT_LEX *sl= first_select(); sl; sl= sl->next_select()) { if (sl != first_select()) { str->append(" union ", 7); - if (!union_distinct) + if (union_all) str->append("all ", 4); + else if (union_distinct == sl) + union_all= true; } if (sl->braces) str->append('('); |