From ec1a433f087d09fd187d4a224394bfa87baa09ce Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 29 Jul 2003 17:39:39 +0500 Subject: Fixed that this sequence didn't produce an error as it should have: CREATE TABLE t1 (s1 CHAR(5) COLLATE latin1_german1_ci, s2 CHAR(5) COLLATE latin1_swedish_ci); SELECT * FROM t1 WHERE s1 = s2; --- mysql-test/r/ctype_collate.result | 6 ++++++ mysql-test/t/ctype_collate.test | 8 ++++++++ sql/item_cmpfunc.cc | 3 ++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/ctype_collate.result b/mysql-test/r/ctype_collate.result index 2c2eebc86fa..b865084b409 100644 --- a/mysql-test/r/ctype_collate.result +++ b/mysql-test/r/ctype_collate.result @@ -530,3 +530,9 @@ latin1 latin1_swedish_ci 3 1 SET CHARACTER SET 'DEFAULT'; ERROR 42000: Unknown character set: 'DEFAULT' DROP TABLE t1; +CREATE TABLE t1 +(s1 CHAR(5) COLLATE latin1_german1_ci, +s2 CHAR(5) COLLATE latin1_swedish_ci); +SELECT * FROM t1 WHERE s1 = s2; +ERROR HY000: Illegal mix of collations (latin1_german1_ci,IMPLICIT) and (latin1_swedish_ci,IMPLICIT) for operation '=' +DROP TABLE t1; diff --git a/mysql-test/t/ctype_collate.test b/mysql-test/t/ctype_collate.test index 3fd9df0c6ce..23039a4b116 100644 --- a/mysql-test/t/ctype_collate.test +++ b/mysql-test/t/ctype_collate.test @@ -148,3 +148,11 @@ SELECT charset('a'),collation('a'),coercibility('a'),'a'='A'; SET CHARACTER SET 'DEFAULT'; DROP TABLE t1; + +CREATE TABLE t1 +(s1 CHAR(5) COLLATE latin1_german1_ci, + s2 CHAR(5) COLLATE latin1_swedish_ci); +--error 1265 +SELECT * FROM t1 WHERE s1 = s2; +DROP TABLE t1; + \ No newline at end of file diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index f89b68d3879..d992b4d69d0 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -249,7 +249,8 @@ int Arg_comparator::set_compare_func(Item_bool_func2 *item, Item_result type) We must set cmp_charset here as we may be called from for an automatic generated item, like in natural join */ - if (cmp_collation.set((*a)->collation, (*b)->collation)) + if (cmp_collation.set((*a)->collation, (*b)->collation) || + cmp_collation.derivation == DERIVATION_NONE) { my_coll_agg_error((*a)->collation, (*b)->collation, owner->func_name()); return 1; -- cgit v1.2.1