summaryrefslogtreecommitdiff
path: root/sql/sql_union.cc
diff options
context:
space:
mode:
authorunknown <bar@mysql.com>2004-10-18 17:56:25 +0500
committerunknown <bar@mysql.com>2004-10-18 17:56:25 +0500
commit1412365a3f277d562d016e353ad0240eba4697e5 (patch)
treec0ae693067fb8f1e887906a373c442dafb8c1123 /sql/sql_union.cc
parentf8f7e4591918dbada386d4f6b2afc527d5df29ac (diff)
downloadmariadb-git-1412365a3f277d562d016e353ad0240eba4697e5.tar.gz
Bug #6139 UNION doesn't understand collate in the column of second select
Diffstat (limited to 'sql/sql_union.cc')
-rw-r--r--sql/sql_union.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index b46cfc05538..6b5d27270c9 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -264,6 +264,23 @@ int st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
}
}
+ {
+ /*
+ Check that it was possible to aggregate all collations together.
+ */
+ List_iterator_fast<Item> tp(types);
+ Item *type;
+ while ((type= tp++))
+ {
+ if (type->result_type() == STRING_RESULT &&
+ type->collation.derivation == DERIVATION_NONE)
+ {
+ my_error(ER_CANT_AGGREGATE_NCOLLATIONS, MYF(0), "UNION");
+ goto err;
+ }
+ }
+ }
+
// it is not single select
if (first_select->next_select())
{