mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge mysql.com:/home/bar/mysql-work/mysql-5.0.b28875
into mysql.com:/home/bar/mysql-work/mysql-5.0-rpl
This commit is contained in:
@ -895,5 +895,30 @@ hex(s2)
|
||||
select hex(convert(s1 using latin1)) from t1;
|
||||
hex(convert(s1 using latin1))
|
||||
7F
|
||||
create table t1 (a varchar(15) character set ascii not null, b int);
|
||||
insert into t1 values ('a',1);
|
||||
select concat(a,if(b<10,_ucs2 0x0061,_ucs2 0x0062)) from t1;
|
||||
concat(a,if(b<10,_ucs2 0x0061,_ucs2 0x0062))
|
||||
aa
|
||||
select concat(a,if(b>10,_ucs2 0x0061,_ucs2 0x0062)) from t1;
|
||||
concat(a,if(b>10,_ucs2 0x0061,_ucs2 0x0062))
|
||||
ab
|
||||
select * from t1 where a=if(b<10,_ucs2 0x0061,_ucs2 0x0062);
|
||||
a b
|
||||
a 1
|
||||
select * from t1 where a=if(b>10,_ucs2 0x0061,_ucs2 0x0062);
|
||||
a b
|
||||
select concat(a,if(b<10,_ucs2 0x00C0,_ucs2 0x0062)) from t1;
|
||||
ERROR HY000: Illegal mix of collations (ascii_general_ci,IMPLICIT) and (ucs2_general_ci,COERCIBLE) for operation 'concat'
|
||||
select concat(a,if(b>10,_ucs2 0x00C0,_ucs2 0x0062)) from t1;
|
||||
ERROR HY000: Illegal mix of collations (ascii_general_ci,IMPLICIT) and (ucs2_general_ci,COERCIBLE) for operation 'concat'
|
||||
select concat(a,if(b<10,_ucs2 0x0062,_ucs2 0x00C0)) from t1;
|
||||
ERROR HY000: Illegal mix of collations (ascii_general_ci,IMPLICIT) and (ucs2_general_ci,COERCIBLE) for operation 'concat'
|
||||
select concat(a,if(b>10,_ucs2 0x0062,_ucs2 0x00C0)) from t1;
|
||||
ERROR HY000: Illegal mix of collations (ascii_general_ci,IMPLICIT) and (ucs2_general_ci,COERCIBLE) for operation 'concat'
|
||||
select * from t1 where a=if(b<10,_ucs2 0x00C0,_ucs2 0x0062);
|
||||
ERROR HY000: Illegal mix of collations (ascii_general_ci,IMPLICIT) and (ucs2_general_ci,COERCIBLE) for operation '='
|
||||
select * from t1 where a=if(b<10,_ucs2 0x0062,_ucs2 0x00C0);
|
||||
ERROR HY000: Illegal mix of collations (ascii_general_ci,IMPLICIT) and (ucs2_general_ci,COERCIBLE) for operation '='
|
||||
drop table t1;
|
||||
End of 5.0 tests
|
||||
|
@ -1639,6 +1639,42 @@ coercibility(col1) collation(col1)
|
||||
0 utf8_swedish_ci
|
||||
drop view v1, v2;
|
||||
drop table t1;
|
||||
set names utf8;
|
||||
create table t1 (a varchar(10) character set latin1, b int);
|
||||
insert into t1 values ('a',1);
|
||||
select concat(a, if(b>10, N'x', N'y')) from t1;
|
||||
concat(a, if(b>10, N'x', N'y'))
|
||||
ay
|
||||
select concat(a, if(b>10, N'æ', N'ß')) from t1;
|
||||
ERROR HY000: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation 'concat'
|
||||
drop table t1;
|
||||
set names utf8;
|
||||
create table t1 (a varchar(10) character set latin1, b int);
|
||||
insert into t1 values ('a',1);
|
||||
select concat(a, if(b>10, _utf8'x', _utf8'y')) from t1;
|
||||
concat(a, if(b>10, _utf8'x', _utf8'y'))
|
||||
ay
|
||||
select concat(a, if(b>10, _utf8'æ', _utf8'ß')) from t1;
|
||||
ERROR HY000: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation 'concat'
|
||||
drop table t1;
|
||||
set names utf8;
|
||||
create table t1 (a varchar(10) character set latin1, b int);
|
||||
insert into t1 values ('a',1);
|
||||
select concat(a, if(b>10, _utf8 0x78, _utf8 0x79)) from t1;
|
||||
concat(a, if(b>10, _utf8 0x78, _utf8 0x79))
|
||||
ay
|
||||
select concat(a, if(b>10, _utf8 0xC3A6, _utf8 0xC3AF)) from t1;
|
||||
ERROR HY000: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation 'concat'
|
||||
drop table t1;
|
||||
set names utf8;
|
||||
create table t1 (a varchar(10) character set latin1, b int);
|
||||
insert into t1 values ('a',1);
|
||||
select concat(a, if(b>10, 'x' 'x', 'y' 'y')) from t1;
|
||||
concat(a, if(b>10, 'x' 'x', 'y' 'y'))
|
||||
ayy
|
||||
select concat(a, if(b>10, 'x' 'æ', 'y' 'ß')) from t1;
|
||||
ERROR HY000: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation 'concat'
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
colA int(11) NOT NULL,
|
||||
colB varchar(255) character set utf8 NOT NULL,
|
||||
|
@ -1246,3 +1246,19 @@ SELECT TIME_FORMAT(SEC_TO_TIME(a),"%H:%i:%s") FROM (SELECT 3020399 AS a UNION SE
|
||||
TIME_FORMAT(SEC_TO_TIME(a),"%H:%i:%s")
|
||||
838:59:58
|
||||
838:59:59
|
||||
set names latin1;
|
||||
create table t1 (a varchar(15) character set ascii not null);
|
||||
insert into t1 values ('070514-000000');
|
||||
select concat(a,ifnull(min(date_format(now(), '%Y-%m-%d')),' ull')) from t1;
|
||||
concat(a,ifnull(min(date_format(now(), '%Y-%m-%d')),' ull'))
|
||||
#
|
||||
set names swe7;
|
||||
select concat(a,ifnull(min(date_format(now(), '%Y-%m-%d')),' ull')) from t1;
|
||||
ERROR HY000: Illegal mix of collations (ascii_general_ci,IMPLICIT) and (swe7_swedish_ci,COERCIBLE) for operation 'concat'
|
||||
set names latin1;
|
||||
set lc_time_names=fr_FR;
|
||||
select concat(a,ifnull(min(date_format(now(), '%Y-%m-%d')),' ull')) from t1;
|
||||
ERROR HY000: Illegal mix of collations (ascii_general_ci,IMPLICIT) and (latin1_swedish_ci,COERCIBLE) for operation 'concat'
|
||||
set lc_time_names=en_US;
|
||||
drop table t1;
|
||||
End of 5.0 tests
|
||||
|
@ -622,4 +622,33 @@ select hex(s2) from t1;
|
||||
select hex(convert(s1 using latin1)) from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Conversion from UCS2 to ASCII is possible
|
||||
# if the UCS2 string consists of only ASCII characters
|
||||
#
|
||||
create table t1 (a varchar(15) character set ascii not null, b int);
|
||||
insert into t1 values ('a',1);
|
||||
select concat(a,if(b<10,_ucs2 0x0061,_ucs2 0x0062)) from t1;
|
||||
select concat(a,if(b>10,_ucs2 0x0061,_ucs2 0x0062)) from t1;
|
||||
select * from t1 where a=if(b<10,_ucs2 0x0061,_ucs2 0x0062);
|
||||
select * from t1 where a=if(b>10,_ucs2 0x0061,_ucs2 0x0062);
|
||||
|
||||
#
|
||||
# Conversion from UCS2 to ASCII is not possible if
|
||||
# the UCS2 string has non-ASCII characters
|
||||
#
|
||||
--error 1267
|
||||
select concat(a,if(b<10,_ucs2 0x00C0,_ucs2 0x0062)) from t1;
|
||||
--error 1267
|
||||
select concat(a,if(b>10,_ucs2 0x00C0,_ucs2 0x0062)) from t1;
|
||||
--error 1267
|
||||
select concat(a,if(b<10,_ucs2 0x0062,_ucs2 0x00C0)) from t1;
|
||||
--error 1267
|
||||
select concat(a,if(b>10,_ucs2 0x0062,_ucs2 0x00C0)) from t1;
|
||||
--error 1267
|
||||
select * from t1 where a=if(b<10,_ucs2 0x00C0,_ucs2 0x0062);
|
||||
--error 1267
|
||||
select * from t1 where a=if(b<10,_ucs2 0x0062,_ucs2 0x00C0);
|
||||
drop table t1;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
@ -1314,6 +1314,46 @@ select coercibility(col1), collation(col1) from v2;
|
||||
drop view v1, v2;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Check conversion of NCHAR strings to subset (e.g. latin1).
|
||||
# Conversion is possible if string repertoire is ASCII.
|
||||
# Conversion is not possible if the string have extended characters
|
||||
#
|
||||
set names utf8;
|
||||
create table t1 (a varchar(10) character set latin1, b int);
|
||||
insert into t1 values ('a',1);
|
||||
select concat(a, if(b>10, N'x', N'y')) from t1;
|
||||
--error 1267
|
||||
select concat(a, if(b>10, N'æ', N'ß')) from t1;
|
||||
drop table t1;
|
||||
|
||||
# Conversion tests for character set introducers
|
||||
set names utf8;
|
||||
create table t1 (a varchar(10) character set latin1, b int);
|
||||
insert into t1 values ('a',1);
|
||||
select concat(a, if(b>10, _utf8'x', _utf8'y')) from t1;
|
||||
--error 1267
|
||||
select concat(a, if(b>10, _utf8'æ', _utf8'ß')) from t1;
|
||||
drop table t1;
|
||||
|
||||
# Conversion tests for introducer + HEX string
|
||||
set names utf8;
|
||||
create table t1 (a varchar(10) character set latin1, b int);
|
||||
insert into t1 values ('a',1);
|
||||
select concat(a, if(b>10, _utf8 0x78, _utf8 0x79)) from t1;
|
||||
--error 1267
|
||||
select concat(a, if(b>10, _utf8 0xC3A6, _utf8 0xC3AF)) from t1;
|
||||
drop table t1;
|
||||
|
||||
# Conversion tests for "text_literal TEXT_STRING_literal" syntax structure
|
||||
set names utf8;
|
||||
create table t1 (a varchar(10) character set latin1, b int);
|
||||
insert into t1 values ('a',1);
|
||||
select concat(a, if(b>10, 'x' 'x', 'y' 'y')) from t1;
|
||||
--error 1267
|
||||
select concat(a, if(b>10, 'x' 'æ', 'y' 'ß')) from t1;
|
||||
drop table t1;
|
||||
|
||||
|
||||
#
|
||||
# Bug#19960: Inconsistent results when joining
|
||||
|
@ -752,3 +752,29 @@ DROP TABLE t1;
|
||||
# Check if using GROUP BY with TIME_FORMAT() produces correct results
|
||||
|
||||
SELECT TIME_FORMAT(SEC_TO_TIME(a),"%H:%i:%s") FROM (SELECT 3020399 AS a UNION SELECT 3020398 ) x GROUP BY 1;
|
||||
|
||||
#
|
||||
# Bug#28875 Conversion between ASCII and LATIN1 charsets does not function
|
||||
#
|
||||
set names latin1;
|
||||
create table t1 (a varchar(15) character set ascii not null);
|
||||
insert into t1 values ('070514-000000');
|
||||
# Conversion of date_format() result to ASCII
|
||||
# is safe with the default locale en_US
|
||||
--replace_column 1 #
|
||||
select concat(a,ifnull(min(date_format(now(), '%Y-%m-%d')),' ull')) from t1;
|
||||
# Error for swe7: it is not ASCII compatible
|
||||
set names swe7;
|
||||
--error 1267
|
||||
select concat(a,ifnull(min(date_format(now(), '%Y-%m-%d')),' ull')) from t1;
|
||||
set names latin1;
|
||||
# Conversion of date_format() result to ASCII
|
||||
# is not safe with the non-default locale fr_FR
|
||||
# because month and day names can have accented characters
|
||||
set lc_time_names=fr_FR;
|
||||
--error 1267
|
||||
select concat(a,ifnull(min(date_format(now(), '%Y-%m-%d')),' ull')) from t1;
|
||||
set lc_time_names=en_US;
|
||||
drop table t1;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
Reference in New Issue
Block a user