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.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())
{