summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <bar@bar.mysql.r18.ru>2003-07-29 17:39:39 +0500
committerunknown <bar@bar.mysql.r18.ru>2003-07-29 17:39:39 +0500
commitec1a433f087d09fd187d4a224394bfa87baa09ce (patch)
tree8aef48655752a7aa7cdc0d8c7c93977de47d1af4
parent8d7b54b7c225bb3395ea8fa0692c6799032d7304 (diff)
downloadmariadb-git-ec1a433f087d09fd187d4a224394bfa87baa09ce.tar.gz
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;
-rw-r--r--mysql-test/r/ctype_collate.result6
-rw-r--r--mysql-test/t/ctype_collate.test8
-rw-r--r--sql/item_cmpfunc.cc3
3 files changed, 16 insertions, 1 deletions
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;