2 # Tests with the utf8mb4 character set
5 drop
table if exists t1,t2;
9 --echo # Start of 5.5 tests
14 select left(_utf8mb4 0xD0B0D0B1D0B2,1);
15 select right(_utf8mb4 0xD0B0D0B2D0B2,1);
17 select locate(
'he',
'hello');
18 select locate(
'he',
'hello',2);
19 select locate(
'lo',
'hello',2);
20 select locate(
'HE',
'hello');
21 select locate(
'HE',
'hello',2);
22 select locate(
'LO',
'hello',2);
23 select locate(
'HE',
'hello' collate utf8mb4_bin);
24 select locate(
'HE',
'hello' collate utf8mb4_bin,2);
25 select locate(
'LO',
'hello' collate utf8mb4_bin,2);
27 select locate(_utf8mb4 0xD0B1, _utf8mb4 0xD0B0D0B1D0B2);
28 select locate(_utf8mb4 0xD091, _utf8mb4 0xD0B0D0B1D0B2);
29 select locate(_utf8mb4 0xD0B1, _utf8mb4 0xD0B0D091D0B2);
30 select locate(_utf8mb4 0xD091, _utf8mb4 0xD0B0D0B1D0B2 collate utf8mb4_bin);
31 select locate(_utf8mb4 0xD0B1, _utf8mb4 0xD0B0D091D0B2 collate utf8mb4_bin);
33 select length(_utf8mb4 0xD0B1), bit_length(_utf8mb4 0xD0B1), char_length(_utf8mb4 0xD0B1);
37 select
'A' like
'a' collate utf8mb4_bin;
38 select _utf8mb4 0xD0B0D0B1D0B2 like concat(_utf8mb4
'%',_utf8mb4 0xD0B1,_utf8mb4
'%');
40 # Bug #6040: can't retrieve records with umlaut
41 # characters in case insensitive manner.
42 # Case insensitive search LIKE comparison
43 # was broken for multibyte characters:
44 select convert(_latin1
'Gnter Andr' using utf8mb4) like CONVERT(_latin1
'GNTER%' USING utf8mb4);
45 select CONVERT(_koi8r
'' USING utf8mb4) LIKE CONVERT(_koi8r
'' USING utf8mb4);
46 select CONVERT(_koi8r
'' USING utf8mb4) LIKE CONVERT(_koi8r
'' USING utf8mb4);
49 # Check the following:
61 # The same for binary collation
63 SELECT
'a' =
'a ' collate utf8mb4_bin;
64 SELECT
'a\0' <
'a' collate utf8mb4_bin;
65 SELECT
'a\0' <
'a ' collate utf8mb4_bin;
66 SELECT
'a\t' <
'a' collate utf8mb4_bin;
67 SELECT
'a\t' <
'a ' collate utf8mb4_bin;
69 eval CREATE
TABLE t1 (a
char(10) character
set utf8mb4 not null) ENGINE $engine;
70 INSERT INTO t1 VALUES (
'a'),(
'a\0'),(
'a\t'),(
'a ');
72 SELECT hex(a),STRCMP(a,
'a'), STRCMP(a,
'a ') FROM t1;
76 # Fix this, it should return 1:
78 #select _utf8mb4 0xD0B0D0B1D0B2 like concat(_utf8mb4'%',_utf8mb4 0xD091,_utf8mb4 '%');
82 # Bug 2367: INSERT() behaviour is different for different charsets.
84 select insert(
'txs',2,1,
'hi'),insert(
'is ',4,0,
'a'),insert(
'txxxxt',2,4,
'es');
85 select insert(
"aa",100,1,
"b"),insert(
"aa",1,3,
"b");
88 # LELF() didn't work well with utf8mb4 in some cases too.
90 select char_length(left(@a:=
'тест',5)), length(@a), @a;
96 eval create
table t1 ENGINE $engine select date_format(
"2004-01-19 10:10:10",
"%Y-%m-%d");
102 # Bug#22646 LC_TIME_NAMES: Assignment to non-UTF8 target fails
105 set LC_TIME_NAMES=
'fr_FR';
106 eval create
table t1 (s1
char(20) character
set latin1) engine $engine;
107 insert into t1 values (date_format(
'2004-02-02',
'%M'));
108 select hex(s1) from t1;
110 eval create
table t1 (s1
char(20) character set koi8r) engine $engine;
111 set LC_TIME_NAMES='ru_RU';
112 insert into t1 values (date_format('2004-02-02','%M'));
113 insert into t1 values (date_format('2004-02-02','%b'));
114 insert into t1 values (date_format('2004-02-02','%W'));
115 insert into t1 values (date_format('2004-02-02','%a'));
117 select hex(s1), s1 from t1;
119 set LC_TIME_NAMES='en_US';
123 # Bug #2366 Wrong utf8mb4 behaviour when data is truncated
126 eval create
table t1 (s1
char(1) character
set utf8mb4) engine $engine;
127 insert into t1 values (_koi8r
'');
128 select s1,hex(s1),char_length(s1),octet_length(s1) from t1;
133 eval create
table t1 (s1 tinytext character
set utf8mb4) engine $engine;
137 eval create
table t1 (s1 varchar(255) character
set utf8mb4) engine $engine;
139 insert into t1 select repeat(
'a',300);
140 insert into t1 select repeat(
'',300);
141 insert into t1 select repeat(
'a',300);
142 insert into t1 select repeat(
'a',300);
143 insert into t1 select repeat(
'',300);
145 select hex(s1) from t1;
147 select length(s1),char_length(s1) from t1;
152 eval create
table t1 (s1 text character
set utf8mb4) engine $engine;
156 eval create
table t1 (s1 varchar(255) character
set utf8mb4) engine $engine;
158 insert into t1 select repeat(
'a',66000);
159 insert into t1 select repeat(
'',66000);
160 insert into t1 select repeat(
'a',66000);
161 insert into t1 select repeat(
'a',66000);
162 insert into t1 select repeat(
'',66000);
164 select length(s1),char_length(s1) from t1;
168 # Bug #2368 Multibyte charsets do not check that incoming data is well-formed
170 eval create
table t1 (s1
char(10) character
set utf8mb4) engine $engine;
171 insert into t1 values (0x41FF);
172 select hex(s1) from t1;
175 eval create
table t1 (s1 varchar(10) character set utf8mb4) engine $engine;
176 insert into t1 values (0x41FF);
177 select hex(s1) from t1;
182 eval create
table t1 (s1 text character
set utf8mb4) engine $engine;
183 insert into t1 values (0x41FF);
184 select hex(s1) from t1;
190 # UTF8 breaks primary keys for cols > 333 characters
196 --error ER_TOO_LONG_KEY
197 eval create
table t1 (a text character
set utf8mb4, primary key(a(371))) engine $engine;
201 --error ER_BLOB_USED_AS_KEY
202 eval create
table t1 (a text character
set utf8mb4, primary key(a(371))) engine $engine;
208 # UTF8 charset breaks joins with mixed column/string constant
210 eval CREATE
TABLE t1 ( a varchar(10) ) CHARACTER SET utf8mb4 ENGINE $engine;
211 INSERT INTO t1 VALUES ( '
test' );
212 SELECT a.a, b.a FROM t1 a, t1 b WHERE a.a = b.a;
213 SELECT a.a, b.a FROM t1 a, t1 b WHERE a.a = 'test' and b.a = 'test';
214 SELECT a.a, b.a FROM t1 a, t1 b WHERE a.a = b.a and a.a = 'test';
217 eval create
table t1 (a
char(255) character set utf8mb4) engine $engine;
218 insert into t1 values('b'),('b');
219 select * from t1 where a = 'b';
220 select * from t1 where a = 'b' and a = 'b';
221 select * from t1 where a = 'b' and a != 'b';
227 set collation_connection=utf8mb4_general_ci;
228 --source include/ctype_regex.inc
232 # Bug #3928 regexp [[:>:]] and UTF-8
236 # This should return TRUE
237 select
'вася' rlike
'[[:<:]]вася[[:>:]]';
238 select
'вася ' rlike
'[[:<:]]вася[[:>:]]';
239 select
' вася' rlike
'[[:<:]]вася[[:>:]]';
240 select
' вася ' rlike
'[[:<:]]вася[[:>:]]';
242 # This should return FALSE
243 select
'васяz' rlike
'[[:<:]]вася[[:>:]]';
244 select
'zвася' rlike
'[[:<:]]вася[[:>:]]';
245 select
'zвасяz' rlike
'[[:<:]]вася[[:>:]]';
249 # ALTER TABLE crashes mysqld with enum column collated utf8mb4_unicode_ci
251 eval CREATE
TABLE t1 (a
enum (
'Y',
'N') DEFAULT
'N' COLLATE utf8mb4_unicode_ci) ENGINE $engine;
252 ALTER
TABLE t1 ADD COLUMN b CHAR(20);
255 # Customer Support Center issue # 3299
256 # ENUM and SET multibyte fields computed their length wronly
257 # when converted into a char field
259 eval create
table t1 (a
enum(
'aaaa',
'проба') character
set utf8mb4) engine $engine;
260 show create
table t1;
261 insert into t1 values (
'проба');
263 eval create
table t2 engine $engine select ifnull(a,a) from t1;
264 show create
table t2;
270 # Bug 4521: unique key prefix interacts poorly with utf8mb4
271 # MYISAM: keys with prefix compression, case insensitive collation.
275 eval create
table t1 (c varchar(30) character
set utf8mb4, unique(c(10))) engine $engine;
276 insert into t1 values ('1'),('2'),('3'),('x'),('y'),('z');
277 insert into t1 values ('aaaaaaaaaa');
279 insert into t1 values ('aaaaaaaaaaa');
281 insert into t1 values ('aaaaaaaaaaaa');
282 insert into t1 values (repeat('b',20));
283 select c c1 from t1 where c='1';
284 select c c2 from t1 where c='2';
285 select c c3 from t1 where c='3';
286 select c cx from t1 where c='x';
287 select c cy from t1 where c='y';
288 select c cz from t1 where c='z';
289 select c ca10 from t1 where c='aaaaaaaaaa';
290 select c cb20 from t1 where c=repeat('b',20);
294 # Bug 4521: unique key prefix interacts poorly with utf8mb4
295 # InnoDB: keys with prefix compression, case insensitive collation.
298 eval create
table t1 (c varchar(30) character
set utf8mb4, unique(c(10))) engine=$engine;
300 insert into t1 values ('1'),('2'),('3'),('x'),('y'),('z');
301 insert into t1 values ('aaaaaaaaaa');
303 insert into t1 values ('aaaaaaaaaaa');
305 insert into t1 values ('aaaaaaaaaaaa');
306 insert into t1 values (repeat('b',20));
307 select c c1 from t1 where c='1';
308 select c c2 from t1 where c='2';
309 select c c3 from t1 where c='3';
310 select c cx from t1 where c='x';
311 select c cy from t1 where c='y';
312 select c cz from t1 where c='z';
313 select c ca10 from t1 where c='aaaaaaaaaa';
314 select c cb20 from t1 where c=repeat('b',20);
318 # Bug 4521: unique key prefix interacts poorly with utf8mb4
319 # MYISAM: fixed length keys, case insensitive collation
321 eval create
table t1 (c
char(3) character
set utf8mb4, unique (c(2))) engine $engine;
322 insert into t1 values ('1'),('2'),('3'),('4'),('x'),('y'),('z');
323 insert into t1 values ('a');
324 insert into t1 values ('aa');
326 insert into t1 values ('aaa');
327 insert into t1 values ('b');
328 insert into t1 values ('bb');
330 insert into t1 values ('bbb');
331 insert into t1 values ('а');
332 insert into t1 values ('аа');
334 insert into t1 values ('ааа');
335 insert into t1 values ('б');
336 insert into t1 values ('бб');
338 insert into t1 values ('ббб');
339 insert into t1 values ('ꪪ');
340 insert into t1 values ('ꪪꪪ');
342 insert into t1 values ('ꪪꪪꪪ');
345 # Bug 4521: unique key prefix interacts poorly with utf8mb4
346 # InnoDB: fixed length keys, case insensitive collation
349 eval create
table t1 (c
char(3) character
set utf8mb4, unique (c(2))) engine=$engine;
351 insert into t1 values ('1'),('2'),('3'),('4'),('x'),('y'),('z');
352 insert into t1 values ('a');
353 insert into t1 values ('aa');
355 insert into t1 values ('aaa');
356 insert into t1 values ('b');
357 insert into t1 values ('bb');
359 insert into t1 values ('bbb');
360 insert into t1 values ('а');
361 insert into t1 values ('аа');
363 insert into t1 values ('ааа');
364 insert into t1 values ('б');
365 insert into t1 values ('бб');
367 insert into t1 values ('ббб');
368 insert into t1 values ('ꪪ');
369 insert into t1 values ('ꪪꪪ');
371 insert into t1 values ('ꪪꪪꪪ');
374 # Bug 4531: unique key prefix interacts poorly with utf8mb4
375 # Check HEAP+HASH, case insensitive collation
377 eval create
table t1 (
378 c
char(10) character
set utf8mb4,
379 unique key a
using hash (c(1))
381 show create
table t1;
382 insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
384 insert into t1 values ('aa');
386 insert into t1 values ('aaa');
387 insert into t1 values ('б');
389 insert into t1 values ('бб');
391 insert into t1 values ('ббб');
392 select c as c_all from t1 order by c;
393 select c as c_a from t1 where c='a';
394 select c as c_a from t1 where c='б';
398 # Bug 4531: unique key prefix interacts poorly with utf8mb4
399 # Check HEAP+BTREE, case insensitive collation
401 eval create
table t1 (
402 c
char(10) character
set utf8mb4,
403 unique key a
using btree (c(1))
405 show create
table t1;
406 insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
408 insert into t1 values ('aa');
410 insert into t1 values ('aaa');
411 insert into t1 values ('б');
413 insert into t1 values ('бб');
415 insert into t1 values ('ббб');
416 select c as c_all from t1 order by c;
417 select c as c_a from t1 where c='a';
418 select c as c_a from t1 where c='б';
422 # Bug 4531: unique key prefix interacts poorly with utf8mb4
423 # Check BDB, case insensitive collation
426 eval create
table t1 (
427 c
char(10) character
set utf8mb4,
431 insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
433 insert into t1 values ('aa');
435 insert into t1 values ('aaa');
436 insert into t1 values ('б');
438 insert into t1 values ('бб');
440 insert into t1 values ('ббб');
441 select c as c_all from t1 order by c;
442 select c as c_a from t1 where c='a';
443 select c as c_a from t1 where c='б';
447 # Bug 4521: unique key prefix interacts poorly with utf8mb4
448 # MYISAM: keys with prefix compression, binary collation.
450 eval create
table t1 (c varchar(30) character
set utf8mb4 collate utf8mb4_bin, unique(c(10))) engine $engine;
451 insert into t1 values ('1'),('2'),('3'),('x'),('y'),('z');
452 insert into t1 values ('aaaaaaaaaa');
454 insert into t1 values ('aaaaaaaaaaa');
456 insert into t1 values ('aaaaaaaaaaaa');
457 insert into t1 values (repeat('b',20));
458 select c c1 from t1 where c='1';
459 select c c2 from t1 where c='2';
460 select c c3 from t1 where c='3';
461 select c cx from t1 where c='x';
462 select c cy from t1 where c='y';
463 select c cz from t1 where c='z';
464 select c ca10 from t1 where c='aaaaaaaaaa';
465 select c cb20 from t1 where c=repeat('b',20);
469 # Bug 4521: unique key prefix interacts poorly with utf8mb4
470 # MYISAM: fixed length keys, binary collation
472 eval create
table t1 (c
char(3) character
set utf8mb4 collate utf8mb4_bin, unique (c(2))) engine $engine;
473 insert into t1 values ('1'),('2'),('3'),('4'),('x'),('y'),('z');
474 insert into t1 values ('a');
475 insert into t1 values ('aa');
477 insert into t1 values ('aaa');
478 insert into t1 values ('b');
479 insert into t1 values ('bb');
481 insert into t1 values ('bbb');
482 insert into t1 values ('а');
483 insert into t1 values ('аа');
485 insert into t1 values ('ааа');
486 insert into t1 values ('б');
487 insert into t1 values ('бб');
489 insert into t1 values ('ббб');
490 insert into t1 values ('ꪪ');
491 insert into t1 values ('ꪪꪪ');
493 insert into t1 values ('ꪪꪪꪪ');
497 # Bug 4531: unique key prefix interacts poorly with utf8mb4
498 # Check HEAP+HASH, binary collation
500 eval create
table t1 (
501 c
char(10) character
set utf8mb4 collate utf8mb4_bin,
502 unique key a
using hash (c(1))
504 show create
table t1;
505 insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
507 insert into t1 values ('aa');
509 insert into t1 values ('aaa');
510 insert into t1 values ('б');
512 insert into t1 values ('бб');
514 insert into t1 values ('ббб');
515 select c as c_all from t1 order by c;
516 select c as c_a from t1 where c='a';
517 select c as c_a from t1 where c='б';
521 # Bug 4531: unique key prefix interacts poorly with utf8mb4
522 # Check HEAP+BTREE, binary collation
524 eval create
table t1 (
525 c
char(10) character
set utf8mb4 collate utf8mb4_bin,
526 unique key a
using btree (c(1))
528 show create
table t1;
529 insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
531 insert into t1 values ('aa');
533 insert into t1 values ('aaa');
534 insert into t1 values ('б');
536 insert into t1 values ('бб');
538 insert into t1 values ('ббб');
539 select c as c_all from t1 order by c;
540 select c as c_a from t1 where c='a';
541 select c as c_a from t1 where c='б';
545 # Bug 4531: unique key prefix interacts poorly with utf8mb4
546 # Check BDB, binary collation
549 eval create
table t1 (
550 c
char(10) character
set utf8mb4 collate utf8mb4_bin,
554 insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
556 insert into t1 values ('aa');
558 insert into t1 values ('aaa');
559 insert into t1 values ('б');
561 insert into t1 values ('бб');
563 insert into t1 values ('ббб');
564 select c as c_all from t1 order by c;
565 select c as c_a from t1 where c='a';
566 select c as c_a from t1 where c='б';
571 # Bug#4594: column index make = failed for gbk, but like works
574 eval create
table t1 (
575 str varchar(255) character
set utf8mb4 not null,
578 INSERT INTO t1 VALUES ('str');
579 INSERT INTO t1 VALUES ('str2');
580 select * from t1 where str='str';
583 # Bug#4594: column index make = failed for gbk, but like works
587 eval create
table t1 (
588 str varchar(255) character
set utf8mb4 not null,
592 INSERT INTO t1 VALUES ('str');
593 INSERT INTO t1 VALUES ('str2');
594 select * from t1 where str='str';
597 # the same for HEAP+BTREE
600 eval create
table t1 (
601 str varchar(255) character
set utf8mb4 not null,
602 key str
using btree (str(2))
604 INSERT INTO t1 VALUES ('str');
605 INSERT INTO t1 VALUES ('str2');
606 select * from t1 where str='str';
609 # the same for HEAP+HASH
614 eval create
table t1 (
615 str varchar(255) character
set utf8mb4 not null,
616 key str
using hash (str(2))
618 INSERT INTO t1 VALUES ('str');
619 INSERT INTO t1 VALUES ('str2');
620 select * from t1 where str='str';
628 eval create
table t1 (
629 str varchar(255) character
set utf8mb4 not null,
633 INSERT INTO t1 VALUES ('str');
634 INSERT INTO t1 VALUES ('str2');
635 select * from t1 where str='str';
640 # Bug #5397: Crash with varchar binary and LIKE
642 eval CREATE
TABLE t1 (a varchar(32) BINARY) CHARACTER SET utf8mb4 ENGINE $engine;
643 INSERT INTO t1 VALUES ('test');
644 SELECT a FROM t1 WHERE a LIKE '%te';
648 # Bug #5723: length(<varchar utf8mb4 field>) returns varying results
653 eval CREATE
TABLE t1 (
654 subject varchar(255) character
set utf8mb4 collate utf8mb4_unicode_ci,
655 p varchar(15) character
set utf8mb4
656 ) ENGINE= $engine DEFAULT CHARSET=latin1;
658 INSERT INTO t1 VALUES (
'谷川俊二と申しますが、インターネット予約の会員登録をしましたところ、メールアドレスを間違えてしまい会員IDが受け取ることが出来ませんでした。間違えアドレスはtani-shun@n.vodafone.ne.jpを書き込みました。どうすればよいですか? その他、住所等は間違えありません。連絡ください。よろしくお願いします。m(__)m',
'040312-000057');
659 INSERT INTO t1 VALUES (
'aaa',
'bbb');
661 SELECT length(subject) FROM t1;
662 SELECT length(subject) FROM t1
ORDER BY 1;
666 # Bug #5832 SELECT doesn't return records in some cases
672 eval CREATE
TABLE t1 (
673 id int unsigned NOT NULL auto_increment,
674 list_id smallint
unsigned NOT NULL,
677 INDEX(list_id, term(4))
678 ) ENGINE=$engine CHARSET=utf8mb4;
679 INSERT INTO t1 SET list_id = 1, term = "letterc";
680 INSERT INTO t1 SET list_id = 1, term = "letterb";
681 INSERT INTO t1 SET list_id = 1, term = "lettera";
682 INSERT INTO t1 SET list_id = 1, term = "letterd";
683 SELECT
id FROM t1 WHERE (list_id = 1) AND (term = "letterc");
684 SELECT
id FROM t1 WHERE (list_id = 1) AND (term = "letterb");
685 SELECT
id FROM t1 WHERE (list_id = 1) AND (term = "lettera");
686 SELECT
id FROM t1 WHERE (list_id = 1) AND (term = "letterd");
690 # Bug #6043 erratic searching for diacriticals in indexed MyISAM UTF-8 table
693 eval CREATE
TABLE t1 (
694 id int unsigned NOT NULL auto_increment,
695 list_id smallint
unsigned NOT NULL,
698 INDEX(list_id, term(19))
699 ) ENGINE=$engine CHARSET=utf8mb4;
700 INSERT INTO t1 set list_id = 1, term = "testtest";
701 INSERT INTO t1 set list_id = 1, term = "testetest";
702 INSERT INTO t1 set list_id = 1, term = "testtest";
703 SELECT
id, term FROM t1 where (list_id = 1) AND (term = "testtest");
704 SELECT
id, term FROM t1 where (list_id = 1) AND (term = "testetest");
705 SELECT
id, term FROM t1 where (list_id = 1) AND (term = "testtest");
711 # Bug #6019 SELECT tries to use too short prefix index on utf8mb4 data
715 eval create
table t1 (
719 ) engine=$engine character set=utf8mb4;
721 insert into t1 values(1,'foo'),(2,'foobar');
723 select * from t1 where b like 'foob%';
725 alter
table t1 engine=innodb;
728 select * from t1 where b like 'foob%';
732 # Test for calculate_interval_lengths() function
734 eval create
table t1 (
735 a
enum(
'петя',
'вася',
'анюта') character
set utf8mb4 not null
default 'анюта',
736 b
set(
'петя',
'вася',
'анюта') character
set utf8mb4 not null
default 'анюта'
738 eval create
table t2 engine $engine select concat(a,_utf8mb4
'') as a, concat(b,_utf8mb4'')as b from t1;
739 show create
table t2;
744 # Bug #6787 LIKE not working properly with _ and utf8mb4 data
746 select
'c' like
'\_' as want0;
749 # SUBSTR with negative offset didn't work with multi-byte strings
751 SELECT SUBSTR(
'вася',-2);
755 # Bug #7730 Server crash using soundex on an utf8mb4 table
757 eval create
table t1 (
id integer, a varchar(100) character
set utf8mb4 collate utf8mb4_unicode_ci) engine $engine;
758 insert into t1 values (1,
'Test');
759 select * from t1 where soundex(a) = soundex(
'Test');
760 select * from t1 where soundex(a) = soundex(
'TEST');
761 select * from t1 where soundex(a) = soundex(
'test');
765 # Bug#22638 SOUNDEX broken for international characters
767 select soundex(_utf8mb4 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB);
768 select hex(soundex(_utf8mb4 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB));
769 select soundex(_utf8mb4 0xD091D092D093);
770 select hex(soundex(_utf8mb4 0xD091D092D093));
773 SET collation_connection=
'utf8mb4_general_ci';
774 -- source include/ctype_filesort.inc
775 -- source include/ctype_like_escape.inc
776 -- source include/ctype_german.inc
777 SET collation_connection=
'utf8mb4_bin';
778 -- source include/ctype_filesort.inc
779 -- source include/ctype_like_escape.inc
782 # Bug #7874 CONCAT() gives wrong results mixing
783 # latin1 field and utf8mb4 string literals
785 eval CREATE
TABLE t1 (
786 user varchar(255) NOT NULL
default ''
787 ) ENGINE=$engine DEFAULT CHARSET=latin1;
788 INSERT INTO t1 VALUES (
'one'),(
'two');
791 SELECT user, CONCAT(
'<', user,
'>') AS c FROM t1;
796 # the same problem with the above, but with nested CONCATs
798 eval create
table t1 (f1 varchar(1) not null)
default charset utf8mb4 engine $engine;
799 insert into t1 values (
''), (
'');
800 select concat(concat(_latin1
'->',f1),_latin1
'<-') from t1;
804 # Bug#8385: utf8mb4_general_ci treats Cyrillic letters I and SHORT I as the same
806 select convert(_koi8r
'' using utf8mb4) < convert(_koi8r
'' using utf8mb4);
809 # Bugs#5980: NULL requires a characterset in a union
812 eval create
table t1 (a varchar(10)) character set utf8mb4 engine $engine;
813 insert into t1 values ('test');
814 select ifnull(a,'') from t1;
816 select repeat(_utf8mb4'+',3) as h union select NULL;
817 select ifnull(NULL, _utf8mb4'
string');
820 # Bug#9509 Optimizer: wrong result after AND with comparisons
823 eval create
table t1 (s1
char(5) character
set utf8mb4 collate utf8mb4_lithuanian_ci) engine $engine;
824 insert into t1 values (
'I'),(
'K'),(
'Y');
826 select * from t1 where s1 <
'K' and s1 =
'Y';
828 select * from t1 where
'K' > s1 and s1 =
'Y';
831 eval create
table t1 (s1
char(5) character
set utf8mb4 collate utf8mb4_czech_ci) engine $engine;
832 insert into t1 values (
'c'),(
'd'),(
'h'),(
'ch'),(
'CH'),(
'cH'),(
'Ch'),(
'i');
834 select * from t1 where s1 >
'd' and s1 =
'CH';
836 select * from t1 where
'd' < s1 and s1 =
'CH';
838 select * from t1 where s1 =
'cH' and s1 <>
'ch';
840 select * from t1 where
'cH' = s1 and s1 <>
'ch';
844 # Bug#10714: Inserting double value into utf8mb4 column crashes server
846 eval create
table t1 (a varchar(255)) default character set utf8mb4 engine $engine;
847 insert into t1 values (1.0);
851 # Bug#10253 compound index length and utf8mb4 char set
852 # produces invalid query results
854 eval create
table t1 (
856 city varchar(20) not null,
858 ) character set=utf8mb4 engine $engine;
859 insert into t1 values (1,'Durban North');
860 insert into t1 values (2,'Durban');
861 select * from t1 where city = 'Durban';
862 select * from t1 where city = 'Durban ';
866 # Bug #11819 CREATE TABLE with a SET DEFAULT 0 and UTF8 crashes server.
869 eval create
table t1 (x
set(
'A',
'B')
default 0) character set utf8mb4 engine $engine;
871 eval create
table t1 (x enum('
A', 'B') default 0) character set utf8mb4 engine $engine;
875 # Test for bug #11167: join for utf8mb4 varchar value longer than 255 bytes
880 eval CREATE
TABLE t1 (
881 `
id`
int(20) NOT NULL auto_increment,
882 `country` varchar(100) NOT NULL
default '',
883 `shortcode` varchar(100) NOT NULL
default '',
884 `
operator` varchar(100) NOT NULL
default '',
885 `momid` varchar(30) NOT NULL
default '',
886 `keyword` varchar(160) NOT NULL
default '',
887 `content` varchar(160) NOT NULL
default '',
888 `second_token` varchar(160)
default NULL,
889 `gateway_id`
int(11) NOT NULL
default '0',
890 `created` datetime NOT NULL
default '0000-00-00 00:00:00',
891 `msisdn` varchar(15) NOT NULL
default '',
893 UNIQUE
KEY `MSCCSPK_20030521130957121` (`momid`),
894 KEY `IX_mobile_originated_message_keyword` (`keyword`),
895 KEY `IX_mobile_originated_message_created` (`created`),
896 KEY `IX_mobile_originated_message_support` (`msisdn`,`momid`,`keyword`,`gateway_id`,`created`)
897 ) ENGINE=$engine DEFAULT CHARSET=utf8mb4;
899 INSERT INTO t1 VALUES
900 (1,'blah','464','aaa','fkc1c9ilc20x0hgae7lx6j09','ERR','ERR Имри.Афимим.Аеимимримдмримрмрирор имримримримр имридм ирбднримрфмририримрфмфмим.Ад.Д имдимримрад.Адимримримрмдиримримримр м.Дадимфшьмримд им.Адимимрн имадми','ИМРИ.АФИМИМ.АЕИМИМРИМДМРИМРМРИРОР',3,'2005-06-01 17:30:43','1234567890'),
901 (2,'blah','464','aaa','haxpl2ilc20x00bj4tt2m5ti','11','11 g','G',3,'2005-06-02 22:43:10','1234567890');
904 eval CREATE
TABLE t2 (
905 `msisdn` varchar(15) NOT NULL default '',
906 `operator_id`
int(11) NOT NULL default '0',
907 `created` datetime NOT NULL default '0000-00-00 00:00:00',
908 UNIQUE
KEY `PK_user` (`msisdn`)
909 ) ENGINE=$engine DEFAULT CHARSET=utf8mb4;
912 INSERT INTO t2 VALUES ('1234567890',2,'2005-05-24 13:53:25');
914 SELECT content, t2.msisdn FROM t1, t2 WHERE t1.msisdn = '1234567890';
919 # Bug#11591: CHAR column with utf8mb4 does not work properly
920 # (more chars than expected)
922 eval create
table t1 (a
char(20) character
set utf8mb4) engine $engine;
923 insert into t1 values (
'123456'),(
'андрей');
924 alter
table t1 modify a char(2) character set utf8mb4;
925 select char_length(a), length(a), a from t1 order by a;
930 # ESCAPE + LIKE do not work when the escape char is a multibyte one
933 select
'andre%' like
'andreñ%' escape
'ñ';
936 # Bugs#11754: SET NAMES utf8mb4 followed by SELECT "A\\" LIKE "A\\" returns 0
939 select
'a\\' like
'a\\';
940 select
'aa\\' like
'a%\\';
942 eval create
table t1 (a
char(10), key(a)) character set utf8mb4 engine $engine;
943 insert into t1 values ("a"),("abc"),("abcd"),("hello"),("test");
945 select * from t1 where a like "abc%";
947 select * from t1 where a like concat("abc","%");
949 select * from t1 where a like "ABC%";
950 select * from t1 where a like "test%";
951 select * from t1 where a like "te_t";
953 select * from t1 where a like "%a%";
955 select * from t1 where a like "%abcd%";
956 select * from t1 where a like "%abc\d%";
961 # Bug#9557 MyISAM utf8mb4 table crash
963 eval CREATE
TABLE t1 (
964 a varchar(255) NOT NULL
default '',
966 ) ENGINE=$engine DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci;
967 insert into t1 values (_utf8mb4 0xe880bd);
968 insert into t1 values (_utf8mb4 0x5b);
970 select hex(a) from t1;
974 # Bug#13751 find_in_set: Illegal mix of collations
977 eval create
table t1 (a varchar(255)) default charset=utf8mb4 engine $engine;
978 select * from t1 where find_in_set('-1', a);
982 # Bug#13233: select distinct char(column) fails with utf8mb4
984 eval create
table t1 (a
int) engine $engine;
985 insert into t1 values (48),(49),(50);
988 select distinct char(a) from t1;
994 # Bug#15581: COALESCE function truncates mutli-byte TINYTEXT values
996 eval CREATE
TABLE t1 (t TINYTEXT CHARACTER SET utf8mb4) ENGINE $engine;
997 INSERT INTO t1 VALUES(REPEAT(
'a', 100));
1000 eval CREATE TEMPORARY
TABLE t2 ENGINE $engine SELECT COALESCE(t) AS bug FROM t1;
1004 eval CREATE
TABLE t2 ENGINE $engine SELECT COALESCE(t) AS bug FROM t1;
1006 SELECT LENGTH(bug) FROM t2;
1012 # Bug#17313: N'xxx' and _utf8mb4'xxx' are not equivalent
1014 eval CREATE
TABLE t1 (item varchar(255)) default character set utf8mb4 ENGINE $engine;
1015 INSERT INTO t1 VALUES (N'\\');
1016 INSERT INTO t1 VALUES (_utf8mb4'\\');
1017 INSERT INTO t1 VALUES (N'Cote d\'Ivoire');
1018 INSERT INTO t1 VALUES (_utf8mb4'Cote d\'Ivoire');
1019 SELECT item FROM t1
ORDER BY item;
1023 # Bug#17705: Corruption of compressed index when index length changes between
1028 DROP
TABLE IF EXISTS t1;
1029 eval CREATE
TABLE t1(a VARCHAR(255),
KEY(a)) ENGINE=$engine DEFAULT CHARSET=utf8mb4;
1030 INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb');
1031 INSERT INTO t1 VALUES('uu');
1033 INSERT INTO t1 VALUES('uU');
1035 INSERT INTO t1 VALUES('uu');
1037 INSERT INTO t1 VALUES('uuABC');
1039 INSERT INTO t1 VALUES('UuABC');
1041 INSERT INTO t1 VALUES('uuABC');
1043 alter
table t1 add b
int;
1044 INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',1);
1045 INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',2);
1046 delete from t1 where b=1;
1047 INSERT INTO t1 VALUES('UUABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',1);
1049 INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',3);
1050 INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',4);
1051 delete from t1 where b=3;
1052 INSERT INTO t1 VALUES('uUABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',3);
1057 # Bug#20471 LIKE search fails with indexed utf8mb4 char column
1060 eval create
table t1 (s1
char(5) character
set utf8mb4) engine $engine;
1061 insert into t1 values
1062 (
'a'),(
'b'),(null),(
'ペテルグル'),(
'ü'),(
'Y');
1063 create
index it1 on t1 (s1);
1064 select s1 as before_delete_general_ci from t1 where s1 like
'ペテ%';
1065 delete from t1 where s1 =
'Y';
1066 select s1 as after_delete_general_ci from t1 where s1 like
'ペテ%';
1070 eval create
table t1 (s1
char(5) character
set utf8mb4 collate utf8mb4_unicode_ci) engine $engine;
1071 insert into t1 values
1072 (
'a'),(
'b'),(null),(
'ペテルグル'),(
'ü'),(
'Y');
1073 create
index it1 on t1 (s1);
1074 select s1 as before_delete_unicode_ci from t1 where s1 like
'ペテ%';
1075 delete from t1 where s1 =
'Y';
1076 select s1 as after_delete_unicode_ci from t1 where s1 like
'ペテ%';
1080 eval create
table t1 (s1
char(5) character
set utf8mb4 collate utf8mb4_bin) engine $engine;
1081 insert into t1 values
1082 (
'a'),(
'b'),(null),(
'ペテルグル'),(
'ü'),(
'Y');
1083 create
index it1 on t1 (s1);
1084 select s1 as before_delete_bin from t1 where s1 like
'ペテ%';
1085 delete from t1 where s1 =
'Y';
1086 select s1 as after_delete_bin from t1 where s1 like
'ペテ%';
1089 # additional tests from duplicate bug#20744 MySQL return no result
1093 eval create
table t1 (a varchar(30) not null primary key)
1094 engine=$engine
default character
set utf8mb4 collate utf8mb4_general_ci;
1096 insert into t1 values (
'あいうえおかきくけこさしすせそ');
1097 insert into t1 values (
'さしすせそかきくけこあいうえお');
1098 select a as gci1 from t1 where a like
'さしすせそかきくけこあいうえお%';
1099 select a as gci2 from t1 where a like
'あいうえおかきくけこさしすせそ';
1104 eval create
table t1 (a varchar(30) not null primary key)
1105 engine=$engine
default character
set utf8mb4 collate utf8mb4_unicode_ci;
1107 insert into t1 values (
'あいうえおかきくけこさしすせそ');
1108 insert into t1 values (
'さしすせそかきくけこあいうえお');
1109 select a as uci1 from t1 where a like
'さしすせそかきくけこあいうえお%';
1110 select a as uci2 from t1 where a like
'あいうえおかきくけこさしすせそ';
1115 eval create
table t1 (a varchar(30) not null primary key)
1116 engine=$engine
default character
set utf8mb4 collate utf8mb4_bin;
1118 insert into t1 values (
'あいうえおかきくけこさしすせそ');
1119 insert into t1 values (
'さしすせそかきくけこあいうえお');
1120 select a as bin1 from t1 where a like
'さしすせそかきくけこあいうえお%';
1121 select a as bin2 from t1 where a like
'あいうえおかきくけこさしすせそ';
1127 # Bug#14896: Comparison with a key in a partial index over mb chararacter field
1131 eval CREATE
TABLE t1 (
id int PRIMARY
KEY,
1132 a varchar(16) collate utf8mb4_unicode_ci NOT NULL
default '',
1134 f varchar(128)
default 'XXX',
1136 ) ENGINE=$engine DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1137 INSERT INTO t1(
id, a, b) VALUES
1138 (1, 'cccc', 50), (2, 'cccc', 70), (3, 'cccc', 30),
1139 (4, 'cccc', 30), (5, 'cccc', 20), (6, 'bbbbbb', 40),
1140 (7, 'dddd', 30), (8, 'aaaa', 10), (9, 'aaaa', 50),
1141 (10, 'eeeee', 40), (11, 'bbbbbb', 60);
1144 SELECT
id, a, b FROM t1;
1147 SELECT
id, a, b FROM t1 WHERE a BETWEEN 'aaaa' AND 'bbbbbb';
1150 SELECT
id, a FROM t1 WHERE a='bbbbbb';
1151 SELECT
id, a FROM t1 WHERE a='bbbbbb'
ORDER BY b;
1156 # Bug#16674: LIKE predicate for a utf8mb4 character set column
1161 eval CREATE
TABLE t1 (
1162 a CHAR(13) DEFAULT
'',
1164 ) ENGINE=$engine DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
1165 INSERT INTO t1 VALUES
1166 ('Käli Käli 2-4'), ('Käli Käli 2-4'),
1167 ('Käli Käli 2+4'), ('Käli Käli 2+4'),
1168 ('Käli Käli 2-6'), ('Käli Käli 2-6');
1169 INSERT INTO t1 SELECT * FROM t1;
1171 eval CREATE
TABLE t2 (
1172 a CHAR(13) DEFAULT '',
1174 ) ENGINE=$engine DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
1176 INSERT INTO t2 VALUES
1177 ('Kali Kali 2-4'), ('Kali Kali 2-4'),
1178 ('Kali Kali 2+4'), ('Kali Kali 2+4'),
1179 ('Kali Kali 2-6'), ('Kali Kali 2-6');
1180 INSERT INTO t2 SELECT * FROM t2;
1182 -- disable_query_log
1183 -- disable_result_log
1186 -- enable_result_log
1189 SELECT a FROM t1 WHERE a LIKE 'Käli Käli 2+4';
1190 SELECT a FROM t2 WHERE a LIKE 'Kali Kali 2+4';
1192 EXPLAIN SELECT a FROM t1 WHERE a LIKE 'Käli Käli 2+4';
1193 EXPLAIN SELECT a FROM t1 WHERE a = 'Käli Käli 2+4';
1194 EXPLAIN SELECT a FROM t2 WHERE a LIKE 'Kali Kali 2+4';
1195 EXPLAIN SELECT a FROM t2 WHERE a = 'Kali Kali 2+4';
1199 eval CREATE
TABLE t1 (
1200 a
char(255) DEFAULT '',
1202 ) ENGINE=$engine DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
1203 INSERT INTO t1 VALUES ('Käli Käli 2-4');
1204 SELECT * FROM t1 WHERE a LIKE 'Käli Käli 2%';
1205 INSERT INTO t1 VALUES ('Käli Käli 2-4');
1206 SELECT * FROM t1 WHERE a LIKE 'Käli Käli 2%';
1209 eval CREATE
TABLE t1 (
1210 a
char(255) DEFAULT ''
1211 ) ENGINE=$engine DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
1212 INSERT INTO t1 VALUES ('Käli Käli 2-4');
1213 INSERT INTO t1 VALUES ('Käli Käli 2-4');
1214 SELECT * FROM t1 WHERE a LIKE 'Käli Käli 2%';
1215 ALTER
TABLE t1 ADD KEY (a(10));
1216 SELECT * FROM t1 WHERE a LIKE 'Käli Käli 2%';
1220 # Bug#18359: LIKE predicate for a 'utf8mb4' text column with a partial index
1221 # (see bug #16674 as well)
1230 eval CREATE
TABLE t1 (
1231 id int(11) NOT NULL
default '0',
1232 tid
int(11) NOT NULL
default '0',
1234 INDEX idx(tid, val(10))
1235 ) ENGINE=$engine DEFAULT CHARSET=utf8mb4;
1237 INSERT INTO t1 VALUES
1238 (40988,72,'VOLN ADSL'),(41009,72,'VOLN ADSL'),
1239 (41032,72,'VOLN ADSL'),(41038,72,'VOLN ADSL'),
1240 (41063,72,'VOLN ADSL'),(41537,72,'VOLN ADSL Office'),
1241 (42141,72,'VOLN ADSL'),(42565,72,'VOLN ADSL Combi'),
1242 (42749,72,'VOLN ADSL'),(44205,72,'VOLN ADSL');
1244 SELECT * FROM t1 WHERE tid=72 and val LIKE 'VOLNY ADSL';
1245 SELECT * FROM t1 WHERE tid=72 and val LIKE 'VOLN ADSL';
1246 SELECT * FROM t1 WHERE tid=72 and val LIKE '%VOLN ADSL';
1248 ALTER
TABLE t1 DROP KEY idx;
1249 ALTER
TABLE t1 ADD KEY idx (tid,val(11));
1251 SELECT * FROM t1 WHERE tid=72 and val LIKE 'VOLN ADSL';
1258 # Bug 20709: problem with utf8mb4 fields in temporary tables
1261 eval create
table t1(a
char(200) collate utf8mb4_unicode_ci NOT NULL
default '')
1262 default charset=utf8mb4 collate=utf8mb4_unicode_ci engine $engine;
1263 insert into t1 values (unhex(
'65')), (unhex(
'C3A9')), (unhex(
'65'));
1264 -- disable_query_log
1265 -- disable_result_log
1267 -- enable_result_log
1269 explain select distinct a from t1;
1270 SELECT COUNT(*) FROM (SELECT DISTINCT a FROM t1) AS t2;
1271 explain select a from t1
group by a;
1272 SELECT COUNT(*) FROM (SELECT a FROM t1 GROUP BY a) AS t2;
1276 # Bug #20204: "order by" changes the results returned
1279 eval create
table t1(a
char(10)) default charset utf8mb4 engine $engine;
1280 insert into t1 values ('123'), ('456');
1281 -- disable_query_log
1282 -- disable_result_log
1284 -- enable_result_log
1287 select substr(Z.a,-1), Z.a from t1 as Y join t1 as Z on Y.a=Z.a order by 1;
1288 select substr(Z.a,-1), Z.a from t1 as Y join t1 as Z on Y.a=Z.a order by 1;
1292 # Bug #34349: Passing invalid parameter to CHAR() in an ORDER BY causes
1296 SET CHARACTER SET utf8mb4;
1297 SHOW VARIABLES LIKE
'character\_set\_%';
1298 CREATE DATABASE crashtest DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
1300 eval CREATE
TABLE crashtest (crash
char(10)) DEFAULT CHARSET=utf8mb4 ENGINE $engine;
1301 INSERT INTO crashtest VALUES ('35'), ('36'), ('37');
1302 SELECT * FROM crashtest
ORDER BY CHAR(crash USING utf8mb4);
1303 INSERT INTO crashtest VALUES ('-1000');
1304 -- disable_query_log
1305 -- disable_result_log
1306 ANALYZE
TABLE crashtest;
1307 -- enable_result_log
1309 EXPLAIN SELECT * FROM crashtest
ORDER BY CHAR(crash USING utf8mb4);
1310 SELECT * FROM crashtest
ORDER BY CHAR(crash USING utf8mb4);
1311 DROP
TABLE crashtest;
1312 DROP DATABASE crashtest;
1314 SET CHARACTER SET default;
1319 # Test for bug #11484: wrong results for a DISTINCT varchar column in uft8.
1322 eval CREATE
TABLE t1(
id varchar(20) NOT NULL) DEFAULT CHARSET=utf8mb4 ENGINE $engine;
1323 INSERT INTO t1 VALUES (
'xxx'), (
'aa'), (
'yyy'), (
'aa');
1328 SELECT DISTINCT
id FROM t1;
1329 SELECT DISTINCT
id FROM t1
ORDER BY
id;
1334 # Bug#20095 Changing length of VARCHAR field with UTF8
1335 # collation does not truncate values
1337 eval create
table t1 (
1338 a varchar(26) not null
1339 )
default character
set utf8mb4 ENGINE $engine;
1340 insert into t1 (a) values ('abcdefghijklmnopqrstuvwxyz');
1342 # varchar to varchar
1343 alter
table t1 change a a varchar(20) character set utf8mb4 not null;
1346 alter
table t1 change a a char(15) character set utf8mb4 not null;
1349 alter
table t1 change a a char(10) character set utf8mb4 not null;
1352 alter
table t1 change a a varchar(5) character set utf8mb4 not null;
1357 # Check that do_varstring2_mb produces a warning
1361 eval create
table t1 (
1362 a varchar(4000) not null
1363 )
default character
set utf8mb4 engine $engine;
1364 insert into t1 values (repeat(
'a',4000));
1365 alter
table t1 change a a varchar(3000) character set utf8mb4 not null;
1366 select length(a) from t1;
1371 # Bug#10504: Character set does not support traditional mode
1372 # Bug#14146: CHAR(...USING ...) and CONVERT(CHAR(...) USING...)
1373 # produce different results
1377 select hex(
char(1
using utf8mb4));
1378 select char(0xd1,0x8f
using utf8mb4);
1379 select char(0xd18f
using utf8mb4);
1380 select char(53647
using utf8mb4);
1381 # incorrect value: return with warning
1382 select char(0xff,0x8f
using utf8mb4);
1383 select convert(
char(0xff,0x8f)
using utf8mb4);
1384 # incorrect value in strict mode: return NULL with "Error" level warning
1385 set sql_mode=traditional;
1386 select char(0xff,0x8f
using utf8mb4);
1387 select char(195
using utf8mb4);
1388 select char(196
using utf8mb4);
1389 select char(2557
using utf8mb4);
1390 select convert(
char(0xff,0x8f)
using utf8mb4);
1393 # Check convert + char + using
1395 select hex(convert(
char(2557
using latin1)
using utf8mb4));
1398 # char() without USING returns "binary" by default, any argument is ok
1400 select hex(
char(195));
1401 select hex(
char(196));
1402 select hex(
char(2557));
1407 # Bug#12891: UNION doesn't return DISTINCT result for multi-byte characters
1410 eval create
table t1 (a
char(1)) default character set utf8mb4 engine $engine;
1411 eval create
table t2 (a
char(1)) default character set utf8mb4 engine $engine;
1412 insert into t1 values('a'),('a'),(0xE38182),(0xE38182);
1413 insert into t1 values('
i'),('i'),(0xE38184),(0xE38184);
1415 select * from t1 union distinct select * from t2;
1420 # Bug#12371: executing prepared statement fails (illegal mix of collations)
1423 eval create
table t1 (a
char(10), b varchar(10)) engine $engine;
1424 insert into t1 values ('bar','kostja');
1425 insert into t1 values ('kostja','bar');
1426 prepare my_stmt from "select * from t1 where a=?";
1428 execute my_stmt using @a;
1430 execute my_stmt using @a;
1432 execute my_stmt using @a;
1433 drop
table if exists t1;
1437 # Bug#21505 Create view - illegal mix of collation for operation 'UNION'
1440 drop
table if exists t1;
1441 drop
view if exists v1, v2;
1444 eval create
table t1(col1 varchar(12) character
set utf8mb4 collate utf8mb4_unicode_ci) engine $engine;
1445 insert into t1 values(
't1_val');
1446 create
view v1 as select
'v1_val' as col1;
1447 select coercibility(col1), collation(col1) from v1;
1448 create
view v2 as select col1 from v1 union select col1 from t1;
1449 select coercibility(col1), collation(col1)from v2;
1451 create
view v1 as select 'v1_val' collate utf8mb4_swedish_ci as col1;
1452 select coercibility(col1), collation(col1) from v1;
1453 create
view v2 as select col1 from v1 union select col1 from t1;
1454 select coercibility(col1), collation(col1) from v2;
1459 # Check conversion of NCHAR strings to subset (e.g. latin1).
1460 # Conversion is possible if string repertoire is ASCII.
1461 # Conversion is not possible if the string have extended characters
1464 eval create
table t1 (a varchar(10) character
set latin1, b
int) engine $engine;
1465 insert into t1 values (
'a',1);
1466 select concat(a,
if(b>10, N
'x', N
'y')) from t1;
1468 select concat(a, if(b>10, N'æ', N'ß')) from t1;
1471 # Conversion tests for character set introducers
1473 eval create
table t1 (a varchar(10) character
set latin1, b
int) engine $engine;
1474 insert into t1 values (
'a',1);
1475 select concat(a,
if(b>10, _utf8mb4
'x', _utf8mb4
'y')) from t1;
1477 select concat(a, if(b>10, _utf8mb4'æ', _utf8mb4'ß')) from t1;
1480 # Conversion tests for introducer + HEX string
1482 eval create
table t1 (a varchar(10) character
set latin1, b
int) engine $engine;
1483 insert into t1 values (
'a',1);
1484 select concat(a,
if(b>10, _utf8mb4 0x78, _utf8mb4 0x79)) from t1;
1486 select concat(a,
if(b>10, _utf8mb4 0xC3A6, _utf8mb4 0xC3AF)) from t1;
1489 # Conversion tests for "text_literal TEXT_STRING_literal" syntax structure
1491 eval create
table t1 (a varchar(10) character
set latin1, b
int) engine $engine;
1492 insert into t1 values (
'a',1);
1493 select concat(a,
if(b>10,
'x' 'x',
'y' 'y')) from t1;
1495 select concat(a, if(b>10, 'x' 'æ', 'y' 'ß')) from t1;
1500 # Bug#19960: Inconsistent results when joining
1501 # InnoDB tables using partial UTF8 indexes
1504 eval CREATE
TABLE t1 (
1505 colA
int(11) NOT NULL,
1506 colB varchar(255) character
set utf8mb4 NOT NULL,
1508 ) ENGINE=$engine DEFAULT CHARSET=latin1;
1510 INSERT INTO t1 (colA, colB) VALUES (1, 'foo'), (2, 'foo bar');
1512 eval CREATE
TABLE t2 (
1513 colA
int(11) NOT NULL,
1514 colB varchar(255) character set utf8mb4 NOT NULL,
1515 KEY bad (colA,colB(3))
1516 ) ENGINE=$engine DEFAULT CHARSET=latin1;
1518 INSERT INTO t2 (colA, colB) VALUES (1, 'foo'),(2, 'foo bar');
1519 SELECT * FROM t1
JOIN t2 ON t1.colA=t2.colA AND t1.colB=t2.colB
1524 # Bug#29205: truncation of UTF8 values when the UNION statement
1525 # forces collation to the binary charset
1528 SELECT
'н1234567890' UNION SELECT _binary
'1';
1529 SELECT
'н1234567890' UNION SELECT 1;
1531 SELECT
'1' UNION SELECT
'н1234567890';
1532 SELECT 1 UNION SELECT
'н1234567890';
1534 eval CREATE
TABLE t1 (c VARCHAR(11)) CHARACTER SET utf8mb4 ENGINE $engine;
1535 eval CREATE
TABLE t2 (b CHAR(1) CHARACTER SET binary, i INT) ENGINE $engine;
1537 INSERT INTO t1 (c) VALUES ('н1234567890');
1538 INSERT INTO t2 (b, i) VALUES ('1', 1);
1540 SELECT c FROM t1 UNION SELECT b FROM t2;
1541 SELECT c FROM t1 UNION SELECT i FROM t2;
1543 SELECT b FROM t2 UNION SELECT c FROM t1;
1544 SELECT i FROM t2 UNION SELECT c FROM t1;
1549 # Bug#30982: CHAR(..USING..) can return a not-well-formed string
1550 # Bug #30986: Character set introducer followed by a HEX string can return bad result
1552 set sql_mode=traditional;
1553 select hex(
char(0xFF
using utf8mb4));
1554 select hex(convert(0xFF
using utf8mb4));
1555 --error ER_INVALID_CHARACTER_STRING
1556 select hex(_utf8mb4 0x616263FF);
1557 --error ER_INVALID_CHARACTER_STRING
1558 select hex(_utf8mb4 X
'616263FF');
1559 --error ER_INVALID_CHARACTER_STRING
1560 select hex(_utf8mb4 B
'001111111111');
1561 --error ER_INVALID_CHARACTER_STRING
1562 select (_utf8mb4 X
'616263FF');
1563 set sql_mode=
default;
1564 select hex(
char(0xFF
using utf8mb4));
1565 select hex(convert(0xFF
using utf8mb4));
1566 --error ER_INVALID_CHARACTER_STRING
1567 select hex(_utf8mb4 0x616263FF);
1568 --error ER_INVALID_CHARACTER_STRING
1569 select hex(_utf8mb4 X
'616263FF');
1570 --error ER_INVALID_CHARACTER_STRING
1571 select hex(_utf8mb4 B
'001111111111');
1572 --error ER_INVALID_CHARACTER_STRING
1573 select (_utf8mb4 X
'616263FF');
1576 # Bug #36772: When using UTF8, CONVERT with GROUP BY returns truncated results
1578 eval CREATE
TABLE t1 (a INT NOT NULL, b INT NOT NULL) ENGINE $engine;
1579 INSERT INTO t1 VALUES (70000, 1092), (70001, 1085), (70002, 1065);
1581 SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1 GROUP BY b;
1583 SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1;
1584 ALTER
TABLE t1 ADD UNIQUE (b);
1586 SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1 GROUP BY b;
1589 SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1 GROUP BY b;
1590 ALTER
TABLE t1 ADD INDEX (b);
1592 SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) from t1 GROUP BY b;
1596 --echo # Bug#26474: Add Sinhala script (Sri Lanka) collation
to MySQL
1599 DROP
TABLE IF EXISTS t1;
1601 eval CREATE
TABLE t1 (
1602 predicted_order
int NOT NULL,
1603 utf8mb4_encoding VARCHAR(10) NOT NULL
1604 ) CHARACTER SET utf8mb4 ENGINE $engine;
1605 INSERT INTO t1 VALUES (19, x
'E0B696'), (30, x
'E0B69AE0B798'), (61, x
'E0B6AF'), (93, x
'E0B799'), (52, x
'E0B6A6'), (73, x
'E0B6BBE0B78AE2808D'), (3, x
'E0B686'), (56, x
'E0B6AA'), (55, x
'E0B6A9'), (70, x
'E0B6B9'), (94, x
'E0B79A'), (80, x
'E0B785'), (25, x
'E0B69AE0B791'), (48, x
'E0B6A2'), (13, x
'E0B690'), (86, x
'E0B793'), (91, x
'E0B79F'), (81, x
'E0B786'), (79, x
'E0B784'), (14, x
'E0B691'), (99, x
'E0B78A'), (8, x
'E0B68B'), (68, x
'E0B6B7'), (22, x
'E0B69A'), (16, x
'E0B693'), (33, x
'E0B69AE0B7B3'), (38, x
'E0B69AE0B79D'), (21, x
'E0B683'), (11, x
'E0B68E'), (77, x
'E0B782'), (40, x
'E0B69AE0B78A'), (101, x
'E0B78AE2808DE0B6BB'), (35, x
'E0B69AE0B79A'), (1, x
'E0B7B4'), (9, x
'E0B68C'), (96, x
'E0B79C'), (6, x
'E0B689'), (95, x
'E0B79B'), (88, x
'E0B796'), (64, x
'E0B6B3'), (26, x
'E0B69AE0B792'), (82, x
'E0B78F'), (28, x
'E0B69AE0B794'), (39, x
'E0B69AE0B79E'), (97, x
'E0B79D'), (2, x
'E0B685'), (75, x
'E0B780'), (34, x
'E0B69AE0B799'), (69, x
'E0B6B8'), (83, x
'E0B790'), (18, x
'E0B695'), (90, x
'E0B7B2'), (17, x
'E0B694'), (72, x
'E0B6BB'), (66, x
'E0B6B5'), (59, x
'E0B6AD'), (44, x
'E0B69E'), (15, x
'E0B692'), (23, x
'E0B69AE0B78F'), (65, x
'E0B6B4'), (42, x
'E0B69C'), (63, x
'E0B6B1'), (85, x
'E0B792'), (47, x
'E0B6A1'), (49, x
'E0B6A3'), (92, x
'E0B7B3'), (78, x
'E0B783'), (36, x
'E0B69AE0B79B'), (4, x
'E0B687'), (24, x
'E0B69AE0B790'), (87, x
'E0B794'), (37, x
'E0B69AE0B79C'), (32, x
'E0B69AE0B79F'), (29, x
'E0B69AE0B796'), (43, x
'E0B69D'), (62, x
'E0B6B0'), (100, x
'E0B78AE2808DE0B6BA'), (60, x
'E0B6AE'), (45, x
'E0B69F'), (12, x
'E0B68F'), (46, x
'E0B6A0'), (50, x
'E0B6A5'), (51, x
'E0B6A4'), (5, x
'E0B688'), (76, x
'E0B781'), (89, x
'E0B798'), (74, x
'E0B6BD'), (10, x
'E0B68D'), (57, x
'E0B6AB'), (71, x
'E0B6BA'), (58, x
'E0B6AC'), (27, x
'E0B69AE0B793'), (54, x
'E0B6A8'), (84, x
'E0B791'), (31, x
'E0B69AE0B7B2'), (98, x
'E0B79E'), (53, x
'E0B6A7'), (41, x
'E0B69B'), (67, x
'E0B6B6'), (7, x
'E0B68A'), (20, x
'E0B682');
1606 SELECT predicted_order, hex(utf8mb4_encoding) FROM t1
ORDER BY utf8mb4_encoding COLLATE utf8mb4_sinhala_ci;
1610 --echo # Bug#32914 Character sets: illegal characters in utf8mb4 and utf32 columns
1612 eval create
table t1 (utf8mb4
char(1) character
set utf8mb4) engine $engine;
1613 --echo Testing [F0][90..BF][80..BF][80..BF]
1614 insert into t1 values (0xF0908080);
1615 insert into t1 values (0xF0BFBFBF);
1616 insert into t1 values (0xF08F8080);
1618 select hex(utf8mb4) from t1;
1621 --echo Testing [F2..F3][80..BF][80..BF][80..BF]
1622 insert into t1 values (0xF2808080);
1623 insert into t1 values (0xF2BFBFBF);
1625 select hex(utf8mb4) from t1;
1628 --echo Testing [F4][80..8F][80..BF][80..BF]
1629 insert into t1 values (0xF4808080);
1630 insert into t1 values (0xF48F8080);
1631 insert into t1 values (0xF4908080);
1633 select hex(utf8mb4) from t1;
1638 --echo #
Check strnxfrm() with odd length
1640 set max_sort_length=5;
1641 select @@max_sort_length;
1642 eval create
table t1 (a varchar(128) character
set utf8mb4 collate utf8mb4_general_ci) engine $engine;
1643 insert into t1 values (
'a'),(
'b'),(
'c');
1644 select * from t1 order by a;
1645 alter
table t1 modify a varchar(128) character set utf8mb4 collate utf8mb4_bin;
1646 select * from t1 order by a;
1648 set max_sort_length=default;
1651 --echo # Bug#26180: Can
't add columns to tables created with utf8mb4 text indexes
1657 eval CREATE TABLE t1 (
1658 clipid INT NOT NULL,
1660 PRIMARY KEY (clipid),
1662 ) CHARACTER SET=utf8mb4 ENGINE $engine;
1663 ALTER TABLE t1 ADD mos TINYINT DEFAULT 0 AFTER clipid;
1664 SHOW CREATE TABLE t1;
1670 #--echo # Check that supplementary characters are not allowed in identifiers
1672 # TODO: activate this when system_charset_info is changed to utf8mb4
1674 #CREATE DATABASE `𐀀`;
1676 #CREATE TABLE `𐀀` (a int);
1678 #CREATE TABLE test.t1 SELECT '𐀀
';
1683 --echo # Testing 4-byte values.
1687 DROP TABLE IF EXISTS t1;
1689 eval CREATE TABLE t1 (
1690 u_decimal int NOT NULL,
1691 utf8mb4_encoding VARCHAR(10) NOT NULL
1692 ) CHARACTER SET utf8mb4 ENGINE $engine;
1693 # Source of the following values: http://www.fileformat.info/info/unicode/block/index.htm
1695 INSERT INTO t1 VALUES (119040, x'f09d8480
'),
1697 (119070, x'f09d849e
'),
1699 (119134, x'f09d859e
'),
1700 # MUSICAL SYMBOL CROIX
1701 (119247, x'f09d878f
'),
1702 # MATHEMATICAL BOLD ITALIC CAPITAL DELTA
1703 (120607, x'f09d9c9f
'),
1704 # SANS-SERIF BOLD ITALIC CAPITAL PI
1705 (120735, x'f09d9e9f
'),
1706 # <Plane 16 Private Use, Last> (last 4 byte character)
1707 (1114111, x'f48fbfbf
'),
1708 # VARIATION SELECTOR-256
1709 (917999, x'f3a087af
');
1710 # All from musical chars
1711 INSERT INTO t1 VALUES (119070, x'f09d849ef09d859ef09d859ef09d8480f09d859ff09d859ff09d859ff09d85a0f09d85a0f09d8480
');
1712 # Mix of 3-byte and 4-byte chars
1713 INSERT INTO t1 VALUES (65131, x'efb9abf09d849ef09d859ef09d859ef09d8480f09d859fefb9abefb9abf09d85a0efb9ab
');
1714 # All from musical chars, but 11 instead of 10 chars. truncated
1715 INSERT INTO t1 VALUES (119070, x'f09d849ef09d859ef09d859ef09d8480f09d859ff09d859ff09d859ff09d85a0f09d85a0f09d8480f09d85a0
');
1718 SELECT u_decimal, hex(utf8mb4_encoding) FROM t1 ORDER BY utf8mb4_encoding COLLATE utf8mb4_general_ci, BINARY utf8mb4_encoding;
1720 # First invalid 4 byte value
1721 INSERT INTO t1 VALUES (1114111, x'f5808080
');
1724 SELECT character_maximum_length, character_octet_length FROM information_schema.columns WHERE
1725 table_name= 't1
' AND column_name= 'utf8mb4_encoding
';
1728 DROP TABLE IF EXISTS t2;
1730 eval CREATE TABLE t2 (
1731 u_decimal int NOT NULL,
1732 utf8mb3_encoding VARCHAR(10) NOT NULL
1733 ) CHARACTER SET utf8mb3 ENGINE $engine;
1734 # LATIN CAPITAL LETTER VEND
1735 INSERT INTO t2 VALUES (42856, x'ea9da8
');
1736 # SMALL COMMERCIAL AT
1737 INSERT INTO t2 VALUES (65131, x'efb9ab
');
1738 # <Plane 16 Private Use, Last> (last 4 byte character)
1739 INSERT INTO t2 VALUES (1114111, x'f48fbfbf
');
1742 SELECT character_maximum_length, character_octet_length FROM information_schema.columns WHERE
1743 table_name= 't2
' AND column_name= 'utf8mb3_encoding
';
1745 # Update a 3-byte char col with a 4-byte char, error
1746 UPDATE t2 SET utf8mb3_encoding= x'f48fbfbd
' where u_decimal= 42856;
1748 # Update to a 3-byte char casted to 4-byte, error?
1749 UPDATE t2 SET utf8mb3_encoding= _utf8mb4 x'ea9da8
' where u_decimal= 42856;
1753 SELECT HEX(CONCAT(utf8mb4_encoding, _utf8 x'ea9da8
')) FROM t1;
1755 SELECT HEX(CONCAT(utf8mb4_encoding, utf8mb3_encoding)) FROM t1,t2;
1757 #--error ER_INVALID_CHARACTER_STRING
1758 #SELECT CONCAT(_utf8 utf8mb4_encoding, _utf8 '|
') FROM t1;
1759 #--error ER_INVALID_CHARACTER_STRING
1760 #SELECT CONCAT(_utf8mb3 utf8mb4_encoding, _utf8 '|
') FROM t1;
1762 SELECT count(*) FROM t1, t2
1763 WHERE t1.utf8mb4_encoding > t2.utf8mb3_encoding;
1765 # Alter from 4-byte charset to 3-byte charset, error
1767 ALTER TABLE t1 CONVERT TO CHARACTER SET utf8;
1769 SHOW CREATE TABLE t1;
1771 SELECT u_decimal,hex(utf8mb4_encoding),utf8mb4_encoding FROM t1;
1773 # Alter table from utf8 to utf8mb4
1774 ALTER TABLE t2 CONVERT TO CHARACTER SET utf8mb4;
1775 SHOW CREATE TABLE t2;
1777 SELECT u_decimal,hex(utf8mb3_encoding) FROM t2;
1779 # Alter table back from utf8mb4 to utf8
1780 ALTER TABLE t2 CONVERT TO CHARACTER SET utf8mb3;
1781 SHOW CREATE TABLE t2;
1783 SELECT u_decimal,hex(utf8mb3_encoding) FROM t2;
1785 # ALter of utf8mb4 column to utf8
1787 ALTER TABLE t1 MODIFY utf8mb4_encoding VARCHAR(10) CHARACTER SET utf8mb3;
1789 SHOW CREATE TABLE t1;
1791 SELECT u_decimal,hex(utf8mb4_encoding) FROM t1;
1793 # ALter of utf8 column to utf8mb4
1794 ALTER TABLE t1 MODIFY utf8mb4_encoding VARCHAR(10) CHARACTER SET utf8mb4;
1795 SHOW CREATE TABLE t1;
1797 SELECT u_decimal,hex(utf8mb4_encoding) FROM t1;
1799 # ALter of utf8 column to utf8mb4
1800 ALTER TABLE t2 MODIFY utf8mb3_encoding VARCHAR(10) CHARACTER SET utf8mb4;
1801 SHOW CREATE TABLE t2;
1803 SELECT u_decimal,hex(utf8mb3_encoding) FROM t2;
1806 DROP TABLE IF EXISTS t3;
1808 eval CREATE TABLE t3 (
1809 u_decimal int NOT NULL,
1810 utf8mb3_encoding VARCHAR(10) NOT NULL
1811 ) CHARACTER SET utf8 ENGINE $engine;
1813 # Insert select utf8mb4 (4-byte) into utf8 (3-byte), error
1814 #--error ER_INVALID_CHARACTER_STRING
1815 INSERT INTO t3 SELECT * FROM t1;
1818 DROP TABLE IF EXISTS t4;
1820 eval CREATE TABLE t4 (
1821 u_decimal int NOT NULL,
1822 utf8mb4_encoding VARCHAR(10) NOT NULL
1823 ) CHARACTER SET utf8mb4 ENGINE $engine;
1825 # Insert select utf8 (3-byte) into utf8mb4 (4-byte)
1826 INSERT INTO t3 SELECT * FROM t2;
1834 --echo # Testing that mixing utf8 and utf8mb4 collations returns utf8mb4
1836 SELECT CHARSET(CONCAT(_utf8mb4'a
',_utf8'b
'));
1838 eval CREATE TABLE t1 (utf8mb4 VARCHAR(10) CHARACTER SET utf8mb4 NOT NULL) ENGINE $engine;
1839 INSERT INTO t1 VALUES (x'ea9da8
'),(x'f48fbfbf
');
1840 SELECT CONCAT(utf8mb4, _utf8 x'ea9da8
') FROM t1 LIMIT 0;
1842 eval CREATE TABLE t2 (utf8mb3 VARCHAR(10) CHARACTER SET utf8mb3 NOT NULL) ENGINE $engine;
1843 INSERT INTO t2 VALUES (x'ea9da8
');
1845 SELECT HEX(CONCAT(utf8mb4, utf8mb3)) FROM t1,t2 ORDER BY 1;
1846 SELECT CHARSET(CONCAT(utf8mb4, utf8mb3)) FROM t1, t2 LIMIT 1;
1850 eval CREATE TEMPORARY TABLE t3 ENGINE $engine AS SELECT *, concat(utf8mb4,utf8mb3) FROM t1, t2;
1851 SHOW CREATE TABLE t3;
1852 DROP TEMPORARY TABLE t3;
1855 SELECT * FROM t1, t2 WHERE t1.utf8mb4 > t2.utf8mb3;
1856 SELECT * FROM t1, t2 WHERE t1.utf8mb4 = t2.utf8mb3;
1857 SELECT * FROM t1, t2 WHERE t1.utf8mb4 < t2.utf8mb3;
1863 --echo # Check that mixing utf8mb4 with an invalid utf8 constant returns error
1865 # This should perhaps be changed to return ER_INVALID_CHARACTER_STRING
1866 eval CREATE TABLE t1 (utf8mb4 VARCHAR(10) CHARACTER SET utf8mb4) ENGINE $engine;
1867 INSERT INTO t1 VALUES (x'f48fbfbf
');
1868 --error ER_CANT_AGGREGATE_2COLLATIONS
1869 SELECT CONCAT(utf8mb4, _utf8 '') FROM t1;
1870 --error ER_CANT_AGGREGATE_2COLLATIONS
1871 SELECT CONCAT('a
', _utf8 '') FROM t1;
1875 --echo # End of 5.5 tests
1879 --echo # End of tests