Skip to content

Commit 3a438cf

Browse files
author
bar@mysql.com/bar.myoffice.izhnet.ru
committed
Bug#32510 LIKE search fails with indexed 'eucjpms' and 'ujis' char column
Problem: some collation handlers called incorrect version of my_like_range_xxx(), which led to wrong min_str and max_str, so like range optimizer threw away good records. Fix: changing the wrong handlers to call proper version of my_like_range_xxx().
1 parent afe8ac3 commit 3a438cf

26 files changed

+373
-7
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#
2+
# Bug#32510 LIKE search fails with indexed 'eucjpms' and 'ujis' char column
3+
#
4+
# Testing my_ctype_like_range_xxx
5+
# (used in LIKE optimization for an indexed column)
6+
#
7+
8+
# Create table using @@character_set_connection and @@collation_connection
9+
# for the string columns.
10+
11+
CREATE TABLE t1 AS
12+
SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d;
13+
ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b);
14+
15+
INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5));
16+
INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10));
17+
INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11));
18+
INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12));
19+
20+
# Check pattern (important for ucs2, utf16, utf32)
21+
SELECT hex(concat(repeat(0xF1F2, 10), '%'));
22+
23+
--echo 3 rows expected
24+
SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%');
25+
DROP TABLE t1;

mysql-test/r/ctype_big5.result

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,23 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
120120
c2h
121121
ab_def
122122
drop table t1;
123+
CREATE TABLE t1 AS
124+
SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d;
125+
ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b);
126+
INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5));
127+
INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10));
128+
INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11));
129+
INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12));
130+
SELECT hex(concat(repeat(0xF1F2, 10), '%'));
131+
hex(concat(repeat(0xF1F2, 10), '%'))
132+
F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225
133+
3 rows expected
134+
SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%');
135+
a hex(b) c
136+
2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
137+
3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
138+
4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
139+
DROP TABLE t1;
123140
SET collation_connection='big5_bin';
124141
create table t1 select repeat('a',4000) a;
125142
delete from t1;
@@ -170,6 +187,23 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
170187
c2h
171188
ab_def
172189
drop table t1;
190+
CREATE TABLE t1 AS
191+
SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d;
192+
ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b);
193+
INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5));
194+
INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10));
195+
INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11));
196+
INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12));
197+
SELECT hex(concat(repeat(0xF1F2, 10), '%'));
198+
hex(concat(repeat(0xF1F2, 10), '%'))
199+
F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225
200+
3 rows expected
201+
SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%');
202+
a hex(b) c
203+
2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
204+
3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
205+
4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
206+
DROP TABLE t1;
173207
SET NAMES big5;
174208
CREATE TABLE t1 (a text) character set big5;
175209
INSERT INTO t1 VALUES ('��');

mysql-test/r/ctype_cp932.result

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11325,6 +11325,23 @@ cp932_japanese_ci 6109
1132511325
cp932_japanese_ci 61
1132611326
cp932_japanese_ci 6120
1132711327
drop table t1;
11328+
CREATE TABLE t1 AS
11329+
SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d;
11330+
ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b);
11331+
INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5));
11332+
INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10));
11333+
INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11));
11334+
INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12));
11335+
SELECT hex(concat(repeat(0xF1F2, 10), '%'));
11336+
hex(concat(repeat(0xF1F2, 10), '%'))
11337+
F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225
11338+
3 rows expected
11339+
SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%');
11340+
a hex(b) c
11341+
2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
11342+
3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
11343+
4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
11344+
DROP TABLE t1;
1132811345
SET collation_connection='cp932_bin';
1132911346
create table t1 select repeat('a',4000) a;
1133011347
delete from t1;
@@ -11335,6 +11352,23 @@ cp932_bin 6109
1133511352
cp932_bin 61
1133611353
cp932_bin 6120
1133711354
drop table t1;
11355+
CREATE TABLE t1 AS
11356+
SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d;
11357+
ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b);
11358+
INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5));
11359+
INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10));
11360+
INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11));
11361+
INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12));
11362+
SELECT hex(concat(repeat(0xF1F2, 10), '%'));
11363+
hex(concat(repeat(0xF1F2, 10), '%'))
11364+
F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225
11365+
3 rows expected
11366+
SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%');
11367+
a hex(b) c
11368+
2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
11369+
3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
11370+
4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
11371+
DROP TABLE t1;
1133811372
create table t2 (a char(1));
1133911373
insert into t2 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7');
1134011374
insert into t2 values ('8'),('9'),('A'),('B'),('C'),('D'),('E'),('F');

mysql-test/r/ctype_eucjpms.result

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9809,6 +9809,23 @@ eucjpms_japanese_ci 6109
98099809
eucjpms_japanese_ci 61
98109810
eucjpms_japanese_ci 6120
98119811
drop table t1;
9812+
CREATE TABLE t1 AS
9813+
SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d;
9814+
ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b);
9815+
INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5));
9816+
INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10));
9817+
INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11));
9818+
INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12));
9819+
SELECT hex(concat(repeat(0xF1F2, 10), '%'));
9820+
hex(concat(repeat(0xF1F2, 10), '%'))
9821+
F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225
9822+
3 rows expected
9823+
SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%');
9824+
a hex(b) c
9825+
2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
9826+
3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
9827+
4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
9828+
DROP TABLE t1;
98129829
SET collation_connection='eucjpms_bin';
98139830
create table t1 select repeat('a',4000) a;
98149831
delete from t1;
@@ -9819,6 +9836,23 @@ eucjpms_bin 6109
98199836
eucjpms_bin 61
98209837
eucjpms_bin 6120
98219838
drop table t1;
9839+
CREATE TABLE t1 AS
9840+
SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d;
9841+
ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b);
9842+
INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5));
9843+
INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10));
9844+
INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11));
9845+
INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12));
9846+
SELECT hex(concat(repeat(0xF1F2, 10), '%'));
9847+
hex(concat(repeat(0xF1F2, 10), '%'))
9848+
F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225
9849+
3 rows expected
9850+
SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%');
9851+
a hex(b) c
9852+
2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
9853+
3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
9854+
4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
9855+
DROP TABLE t1;
98229856
select hex(convert(_eucjpms 0xA5FE41 using ucs2));
98239857
hex(convert(_eucjpms 0xA5FE41 using ucs2))
98249858
003F0041

mysql-test/r/ctype_euckr.result

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,23 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
120120
c2h
121121
ab_def
122122
drop table t1;
123+
CREATE TABLE t1 AS
124+
SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d;
125+
ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b);
126+
INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5));
127+
INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10));
128+
INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11));
129+
INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12));
130+
SELECT hex(concat(repeat(0xF1F2, 10), '%'));
131+
hex(concat(repeat(0xF1F2, 10), '%'))
132+
F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225
133+
3 rows expected
134+
SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%');
135+
a hex(b) c
136+
2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
137+
3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
138+
4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
139+
DROP TABLE t1;
123140
SET collation_connection='euckr_bin';
124141
create table t1 select repeat('a',4000) a;
125142
delete from t1;
@@ -170,6 +187,23 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
170187
c2h
171188
ab_def
172189
drop table t1;
190+
CREATE TABLE t1 AS
191+
SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d;
192+
ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b);
193+
INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5));
194+
INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10));
195+
INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11));
196+
INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12));
197+
SELECT hex(concat(repeat(0xF1F2, 10), '%'));
198+
hex(concat(repeat(0xF1F2, 10), '%'))
199+
F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225
200+
3 rows expected
201+
SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%');
202+
a hex(b) c
203+
2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
204+
3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
205+
4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
206+
DROP TABLE t1;
173207
SET NAMES euckr;
174208
CREATE TABLE t1 (a text) character set euckr;
175209
INSERT INTO t1 VALUES (0xA2E6),(0xFEF7);

mysql-test/r/ctype_gb2312.result

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,23 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
120120
c2h
121121
ab_def
122122
drop table t1;
123+
CREATE TABLE t1 AS
124+
SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d;
125+
ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b);
126+
INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5));
127+
INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10));
128+
INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11));
129+
INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12));
130+
SELECT hex(concat(repeat(0xF1F2, 10), '%'));
131+
hex(concat(repeat(0xF1F2, 10), '%'))
132+
F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225
133+
3 rows expected
134+
SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%');
135+
a hex(b) c
136+
2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
137+
3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
138+
4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
139+
DROP TABLE t1;
123140
SET collation_connection='gb2312_bin';
124141
create table t1 select repeat('a',4000) a;
125142
delete from t1;
@@ -170,6 +187,23 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
170187
c2h
171188
ab_def
172189
drop table t1;
190+
CREATE TABLE t1 AS
191+
SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d;
192+
ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b);
193+
INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5));
194+
INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10));
195+
INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11));
196+
INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12));
197+
SELECT hex(concat(repeat(0xF1F2, 10), '%'));
198+
hex(concat(repeat(0xF1F2, 10), '%'))
199+
F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225
200+
3 rows expected
201+
SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%');
202+
a hex(b) c
203+
2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
204+
3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
205+
4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
206+
DROP TABLE t1;
173207
SET NAMES gb2312;
174208
CREATE TABLE t1 (a text) character set gb2312;
175209
INSERT INTO t1 VALUES (0xA2A1),(0xD7FE);

mysql-test/r/ctype_gbk.result

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,23 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
120120
c2h
121121
ab_def
122122
drop table t1;
123+
CREATE TABLE t1 AS
124+
SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d;
125+
ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b);
126+
INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5));
127+
INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10));
128+
INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11));
129+
INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12));
130+
SELECT hex(concat(repeat(0xF1F2, 10), '%'));
131+
hex(concat(repeat(0xF1F2, 10), '%'))
132+
F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225
133+
3 rows expected
134+
SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%');
135+
a hex(b) c
136+
2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
137+
3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
138+
4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
139+
DROP TABLE t1;
123140
SET collation_connection='gbk_bin';
124141
create table t1 select repeat('a',4000) a;
125142
delete from t1;
@@ -170,6 +187,23 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
170187
c2h
171188
ab_def
172189
drop table t1;
190+
CREATE TABLE t1 AS
191+
SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d;
192+
ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b);
193+
INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5));
194+
INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10));
195+
INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11));
196+
INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12));
197+
SELECT hex(concat(repeat(0xF1F2, 10), '%'));
198+
hex(concat(repeat(0xF1F2, 10), '%'))
199+
F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225
200+
3 rows expected
201+
SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%');
202+
a hex(b) c
203+
2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
204+
3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
205+
4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
206+
DROP TABLE t1;
173207
SET NAMES gbk;
174208
CREATE TABLE t1 (a text) character set gbk;
175209
INSERT INTO t1 VALUES (0xA3A0),(0xA1A1);

mysql-test/r/ctype_sjis.result

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,23 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
121121
c2h
122122
ab_def
123123
drop table t1;
124+
CREATE TABLE t1 AS
125+
SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d;
126+
ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b);
127+
INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5));
128+
INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10));
129+
INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11));
130+
INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12));
131+
SELECT hex(concat(repeat(0xF1F2, 10), '%'));
132+
hex(concat(repeat(0xF1F2, 10), '%'))
133+
F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225
134+
3 rows expected
135+
SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%');
136+
a hex(b) c
137+
2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
138+
3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
139+
4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
140+
DROP TABLE t1;
124141
SET collation_connection='sjis_bin';
125142
create table t1 select repeat('a',4000) a;
126143
delete from t1;
@@ -171,6 +188,23 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
171188
c2h
172189
ab_def
173190
drop table t1;
191+
CREATE TABLE t1 AS
192+
SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d;
193+
ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b);
194+
INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5));
195+
INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10));
196+
INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11));
197+
INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12));
198+
SELECT hex(concat(repeat(0xF1F2, 10), '%'));
199+
hex(concat(repeat(0xF1F2, 10), '%'))
200+
F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225
201+
3 rows expected
202+
SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%');
203+
a hex(b) c
204+
2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
205+
3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
206+
4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
207+
DROP TABLE t1;
174208
SET NAMES sjis;
175209
SELECT HEX('�����@�\') FROM DUAL;
176210
HEX('�����@�\')

mysql-test/r/ctype_uca.result

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2811,5 +2811,22 @@ NULL
28112811
NULL
28122812
NULL
28132813
drop table t1;
2814+
CREATE TABLE t1 AS
2815+
SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d;
2816+
ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b);
2817+
INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5));
2818+
INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10));
2819+
INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11));
2820+
INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12));
2821+
SELECT hex(concat(repeat(0xF1F2, 10), '%'));
2822+
hex(concat(repeat(0xF1F2, 10), '%'))
2823+
F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F20025
2824+
3 rows expected
2825+
SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%');
2826+
a hex(b) c
2827+
2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
2828+
3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
2829+
4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
2830+
DROP TABLE t1;
28142831
set names utf8;
28152832
End for 5.0 tests

0 commit comments

Comments
 (0)