Commit ebdf2c01 authored by unknown's avatar unknown

ctype_collate.result, ctype_collate.test, union.result, union.test:

  fixing tests accordingly
item.cc:
  Allow mixing non-binary collation and binary collation
  even if coercibility is the same. 
  For easier 4.0 -> 4.1 migrating.


sql/item.cc:
  Allow mixing non-binary collation and binary collation
  even if coercibility is the same. 
  For easier 4.0 -> 4.1 migrating.
mysql-test/t/union.test:
  fixing tests accordingly
mysql-test/r/union.result:
  fixing tests accordingly
mysql-test/t/ctype_collate.test:
  fixing tests accordingly
mysql-test/r/ctype_collate.result:
  fixing tests accordingly
parent f2824c4d
...@@ -535,6 +535,19 @@ s2 CHAR(5) COLLATE latin1_swedish_ci); ...@@ -535,6 +535,19 @@ s2 CHAR(5) COLLATE latin1_swedish_ci);
SELECT * FROM t1 WHERE s1 = s2; SELECT * FROM t1 WHERE s1 = s2;
ERROR HY000: Illegal mix of collations (latin1_german1_ci,IMPLICIT) and (latin1_swedish_ci,IMPLICIT) for operation '=' ERROR HY000: Illegal mix of collations (latin1_german1_ci,IMPLICIT) and (latin1_swedish_ci,IMPLICIT) for operation '='
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1
(s1 CHAR(5) COLLATE latin1_german1_ci,
s2 CHAR(5) COLLATE latin1_swedish_ci,
s3 CHAR(5) COLLATE latin1_bin);
INSERT INTO t1 VALUES ('a','A','A');
SELECT * FROM t1 WHERE s1 = s2;
ERROR HY000: Illegal mix of collations (latin1_german1_ci,IMPLICIT) and (latin1_swedish_ci,IMPLICIT) for operation '='
SELECT * FROM t1 WHERE s1 = s3;
s1 s2 s3
SELECT * FROM t1 WHERE s2 = s3;
s1 s2 s3
a A A
DROP TABLE t1;
SET NAMES latin1; SET NAMES latin1;
CREATE TABLE t1 CREATE TABLE t1
(s1 char(10) COLLATE latin1_german1_ci, (s1 char(10) COLLATE latin1_german1_ci,
......
...@@ -1103,7 +1103,7 @@ count(*) ...@@ -1103,7 +1103,7 @@ count(*)
drop table t1; drop table t1;
create table t2 ( create table t2 (
a char character set latin1 collate latin1_swedish_ci, a char character set latin1 collate latin1_swedish_ci,
b char character set latin1 collate latin1_bin); b char character set latin1 collate latin1_german1_ci);
create table t1 as create table t1 as
(select a from t2) union (select a from t2) union
(select b from t2); (select b from t2);
......
...@@ -158,6 +158,18 @@ SELECT * FROM t1 WHERE s1 = s2; ...@@ -158,6 +158,18 @@ SELECT * FROM t1 WHERE s1 = s2;
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1
(s1 CHAR(5) COLLATE latin1_german1_ci,
s2 CHAR(5) COLLATE latin1_swedish_ci,
s3 CHAR(5) COLLATE latin1_bin);
INSERT INTO t1 VALUES ('a','A','A');
--error 1267
SELECT * FROM t1 WHERE s1 = s2;
SELECT * FROM t1 WHERE s1 = s3;
SELECT * FROM t1 WHERE s2 = s3;
DROP TABLE t1;
# #
# Test that optimizer doesn't use indexes with wrong collation # Test that optimizer doesn't use indexes with wrong collation
# #
......
...@@ -641,7 +641,7 @@ drop table t1; ...@@ -641,7 +641,7 @@ drop table t1;
create table t2 ( create table t2 (
a char character set latin1 collate latin1_swedish_ci, a char character set latin1 collate latin1_swedish_ci,
b char character set latin1 collate latin1_bin); b char character set latin1 collate latin1_german1_ci);
--error 1271 --error 1271
create table t1 as create table t1 as
(select a from t2) union (select a from t2) union
......
...@@ -474,8 +474,17 @@ bool DTCollation::aggregate(DTCollation &dt, uint flags) ...@@ -474,8 +474,17 @@ bool DTCollation::aggregate(DTCollation &dt, uint flags)
set(0, DERIVATION_NONE); set(0, DERIVATION_NONE);
return 1; return 1;
} }
if (collation->state & MY_CS_BINSORT)
{
return 0;
}
else if (dt.collation->state & MY_CS_BINSORT)
{
set(dt);
return 0;
}
CHARSET_INFO *bin= get_charset_by_csname(collation->csname, CHARSET_INFO *bin= get_charset_by_csname(collation->csname,
MY_CS_BINSORT,MYF(0)); MY_CS_BINSORT,MYF(0));
set(bin, DERIVATION_NONE); set(bin, DERIVATION_NONE);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment