summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.com>2019-04-28 10:53:07 +0400
committerAlexander Barkov <bar@mariadb.com>2019-04-28 11:05:50 +0400
commiteb9b03ab488d160aee487389605941a584e6074d (patch)
tree03b3461c56dcd5d06465f8662091a45365060338
parentd3534d5b45a419260d0292d72a6a21f2a2ba2582 (diff)
downloadmariadb-git-eb9b03ab488d160aee487389605941a584e6074d.tar.gz
MDEV-13335 UTF8 escape wildcard LIKE match has different behavior in different collations
The fix for MDEV-17064 addressed this problem. Adding tests only.
-rw-r--r--mysql-test/include/ctype_like_escape.inc6
-rw-r--r--mysql-test/r/ctype_big5.result12
-rw-r--r--mysql-test/r/ctype_euckr.result12
-rw-r--r--mysql-test/r/ctype_gb2312.result12
-rw-r--r--mysql-test/r/ctype_gbk.result12
-rw-r--r--mysql-test/r/ctype_latin1.result12
-rw-r--r--mysql-test/r/ctype_sjis.result12
-rw-r--r--mysql-test/r/ctype_tis620.result12
-rw-r--r--mysql-test/r/ctype_uca.result6
-rw-r--r--mysql-test/r/ctype_ucs.result12
-rw-r--r--mysql-test/r/ctype_ujis.result12
-rw-r--r--mysql-test/r/ctype_utf16.result12
-rw-r--r--mysql-test/r/ctype_utf16_uca.result6
-rw-r--r--mysql-test/r/ctype_utf16le.result12
-rw-r--r--mysql-test/r/ctype_utf32.result12
-rw-r--r--mysql-test/r/ctype_utf32_uca.result6
-rw-r--r--mysql-test/r/ctype_utf8.result12
-rw-r--r--mysql-test/r/ctype_utf8mb4.result12
-rw-r--r--mysql-test/r/ctype_utf8mb4_heap.result12
-rw-r--r--mysql-test/r/ctype_utf8mb4_innodb.result12
-rw-r--r--mysql-test/r/ctype_utf8mb4_myisam.result12
21 files changed, 228 insertions, 0 deletions
diff --git a/mysql-test/include/ctype_like_escape.inc b/mysql-test/include/ctype_like_escape.inc
index d4abc33c178..f817bc03e74 100644
--- a/mysql-test/include/ctype_like_escape.inc
+++ b/mysql-test/include/ctype_like_escape.inc
@@ -16,3 +16,9 @@ select c1 as c1u from t1 where c1 like 'ab\_def';
# should return ab_def
select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
drop table t1;
+
+#
+# MDEV-13335 UTF8 escape wildcard LIKE match has different behavior in different collations
+#
+SELECT @@collation_connection;
+SELECT '\%b' LIKE '%\%';
diff --git a/mysql-test/r/ctype_big5.result b/mysql-test/r/ctype_big5.result
index f97d060d26a..ee7494ded22 100644
--- a/mysql-test/r/ctype_big5.result
+++ b/mysql-test/r/ctype_big5.result
@@ -220,6 +220,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
c2h
ab_def
drop table t1;
+SELECT @@collation_connection;
+@@collation_connection
+big5_chinese_ci
+SELECT '\%b' LIKE '%\%';
+'\%b' LIKE '%\%'
+0
CREATE TABLE t1 AS
SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d;
ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b);
@@ -447,6 +453,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
c2h
ab_def
drop table t1;
+SELECT @@collation_connection;
+@@collation_connection
+big5_bin
+SELECT '\%b' LIKE '%\%';
+'\%b' LIKE '%\%'
+0
CREATE TABLE t1 AS
SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d;
ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b);
diff --git a/mysql-test/r/ctype_euckr.result b/mysql-test/r/ctype_euckr.result
index a23ced76df9..2fa19b2a7db 100644
--- a/mysql-test/r/ctype_euckr.result
+++ b/mysql-test/r/ctype_euckr.result
@@ -220,6 +220,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
c2h
ab_def
drop table t1;
+SELECT @@collation_connection;
+@@collation_connection
+euckr_korean_ci
+SELECT '\%b' LIKE '%\%';
+'\%b' LIKE '%\%'
+0
CREATE TABLE t1 AS
SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d;
ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b);
@@ -367,6 +373,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
c2h
ab_def
drop table t1;
+SELECT @@collation_connection;
+@@collation_connection
+euckr_bin
+SELECT '\%b' LIKE '%\%';
+'\%b' LIKE '%\%'
+0
CREATE TABLE t1 AS
SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d;
ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b);
diff --git a/mysql-test/r/ctype_gb2312.result b/mysql-test/r/ctype_gb2312.result
index f9f37c00a79..600f66a79d0 100644
--- a/mysql-test/r/ctype_gb2312.result
+++ b/mysql-test/r/ctype_gb2312.result
@@ -220,6 +220,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
c2h
ab_def
drop table t1;
+SELECT @@collation_connection;
+@@collation_connection
+gb2312_chinese_ci
+SELECT '\%b' LIKE '%\%';
+'\%b' LIKE '%\%'
+0
CREATE TABLE t1 AS
SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d;
ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b);
@@ -448,6 +454,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
c2h
ab_def
drop table t1;
+SELECT @@collation_connection;
+@@collation_connection
+gb2312_bin
+SELECT '\%b' LIKE '%\%';
+'\%b' LIKE '%\%'
+0
CREATE TABLE t1 AS
SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d;
ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b);
diff --git a/mysql-test/r/ctype_gbk.result b/mysql-test/r/ctype_gbk.result
index ac8de1e229c..9802f0ab85b 100644
--- a/mysql-test/r/ctype_gbk.result
+++ b/mysql-test/r/ctype_gbk.result
@@ -220,6 +220,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
c2h
ab_def
drop table t1;
+SELECT @@collation_connection;
+@@collation_connection
+gbk_chinese_ci
+SELECT '\%b' LIKE '%\%';
+'\%b' LIKE '%\%'
+0
CREATE TABLE t1 AS
SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d;
ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b);
@@ -448,6 +454,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
c2h
ab_def
drop table t1;
+SELECT @@collation_connection;
+@@collation_connection
+gbk_bin
+SELECT '\%b' LIKE '%\%';
+'\%b' LIKE '%\%'
+0
CREATE TABLE t1 AS
SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d;
ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b);
diff --git a/mysql-test/r/ctype_latin1.result b/mysql-test/r/ctype_latin1.result
index cfebfd163bb..db9ce63fb78 100644
--- a/mysql-test/r/ctype_latin1.result
+++ b/mysql-test/r/ctype_latin1.result
@@ -506,6 +506,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
c2h
ab_def
drop table t1;
+SELECT @@collation_connection;
+@@collation_connection
+latin1_swedish_ci
+SELECT '\%b' LIKE '%\%';
+'\%b' LIKE '%\%'
+0
#
# MDEV-4842 STR_TO_DATE does not work with UCS2/UTF16/UTF32
#
@@ -621,6 +627,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
c2h
ab_def
drop table t1;
+SELECT @@collation_connection;
+@@collation_connection
+latin1_bin
+SELECT '\%b' LIKE '%\%';
+'\%b' LIKE '%\%'
+0
CREATE TABLE a (a int);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'a (a int)' at line 1
SELECT 'a' as str;
diff --git a/mysql-test/r/ctype_sjis.result b/mysql-test/r/ctype_sjis.result
index 46686933298..a7dc5a0b8c3 100644
--- a/mysql-test/r/ctype_sjis.result
+++ b/mysql-test/r/ctype_sjis.result
@@ -189,6 +189,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
c2h
ab_def
drop table t1;
+SELECT @@collation_connection;
+@@collation_connection
+sjis_japanese_ci
+SELECT '\%b' LIKE '%\%';
+'_%b' LIKE '%_%'
+0
CREATE TABLE t1 AS
SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d;
ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b);
@@ -355,6 +361,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
c2h
ab_def
drop table t1;
+SELECT @@collation_connection;
+@@collation_connection
+sjis_bin
+SELECT '\%b' LIKE '%\%';
+'_%b' LIKE '%_%'
+0
CREATE TABLE t1 AS
SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d;
ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b);
diff --git a/mysql-test/r/ctype_tis620.result b/mysql-test/r/ctype_tis620.result
index 947aeb5ff5b..91e7beb1e7a 100644
--- a/mysql-test/r/ctype_tis620.result
+++ b/mysql-test/r/ctype_tis620.result
@@ -3033,6 +3033,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
c2h
ab_def
drop table t1;
+SELECT @@collation_connection;
+@@collation_connection
+tis620_thai_ci
+SELECT '\%b' LIKE '%\%';
+'\%b' LIKE '%\%'
+0
drop table if exists t1;
create table t1 select repeat('a',10) as c1;
delete from t1;
@@ -3331,6 +3337,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
c2h
ab_def
drop table t1;
+SELECT @@collation_connection;
+@@collation_connection
+tis620_bin
+SELECT '\%b' LIKE '%\%';
+'\%b' LIKE '%\%'
+0
#
# MDEV-7149 Constant condition propagation erroneously applied for LIKE
#
diff --git a/mysql-test/r/ctype_uca.result b/mysql-test/r/ctype_uca.result
index fa07b8a7ec3..04bb5f5e05d 100644
--- a/mysql-test/r/ctype_uca.result
+++ b/mysql-test/r/ctype_uca.result
@@ -6233,6 +6233,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
c2h
ab_def
drop table t1;
+SELECT @@collation_connection;
+@@collation_connection
+utf8_unicode_ci
+SELECT '\%b' LIKE '%\%';
+'\%b' LIKE '%\%'
+0
"BEGIN ctype_german.inc"
drop table if exists t1;
create table t1 as select repeat(' ', 64) as s1;
diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result
index 9c598780edf..c8354a96a87 100644
--- a/mysql-test/r/ctype_ucs.result
+++ b/mysql-test/r/ctype_ucs.result
@@ -839,6 +839,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
c2h
ab_def
drop table t1;
+SELECT @@collation_connection;
+@@collation_connection
+ucs2_general_ci
+SELECT '\%b' LIKE '%\%';
+'\%b' LIKE '%\%'
+0
"BEGIN ctype_german.inc"
drop table if exists t1;
create table t1 as select repeat(' ', 64) as s1;
@@ -1100,6 +1106,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
c2h
ab_def
drop table t1;
+SELECT @@collation_connection;
+@@collation_connection
+ucs2_bin
+SELECT '\%b' LIKE '%\%';
+'\%b' LIKE '%\%'
+0
CREATE TABLE t1 AS
SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d;
ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b);
diff --git a/mysql-test/r/ctype_ujis.result b/mysql-test/r/ctype_ujis.result
index 9146356b5f9..8b63de5c235 100644
--- a/mysql-test/r/ctype_ujis.result
+++ b/mysql-test/r/ctype_ujis.result
@@ -2327,6 +2327,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
c2h
ab_def
drop table t1;
+SELECT @@collation_connection;
+@@collation_connection
+ujis_japanese_ci
+SELECT '\%b' LIKE '%\%';
+'\%b' LIKE '%\%'
+0
CREATE TABLE t1 AS
SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d;
ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b);
@@ -2474,6 +2480,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
c2h
ab_def
drop table t1;
+SELECT @@collation_connection;
+@@collation_connection
+ujis_bin
+SELECT '\%b' LIKE '%\%';
+'\%b' LIKE '%\%'
+0
CREATE TABLE t1 AS
SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d;
ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b);
diff --git a/mysql-test/r/ctype_utf16.result b/mysql-test/r/ctype_utf16.result
index ba72a859351..c826a93809d 100644
--- a/mysql-test/r/ctype_utf16.result
+++ b/mysql-test/r/ctype_utf16.result
@@ -669,6 +669,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
c2h
ab_def
drop table t1;
+SELECT @@collation_connection;
+@@collation_connection
+utf16_general_ci
+SELECT '\%b' LIKE '%\%';
+'\%b' LIKE '%\%'
+0
SET NAMES latin1;
SET collation_connection='utf16_bin';
create table t1 select repeat('a',4000) a;
@@ -806,6 +812,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
c2h
ab_def
drop table t1;
+SELECT @@collation_connection;
+@@collation_connection
+utf16_bin
+SELECT '\%b' LIKE '%\%';
+'\%b' LIKE '%\%'
+0
select hex(substr(_utf16 0x00e400e50068,1));
hex(substr(_utf16 0x00e400e50068,1))
00E400E50068
diff --git a/mysql-test/r/ctype_utf16_uca.result b/mysql-test/r/ctype_utf16_uca.result
index 1e4c77ea83d..e32fc3822ee 100644
--- a/mysql-test/r/ctype_utf16_uca.result
+++ b/mysql-test/r/ctype_utf16_uca.result
@@ -2952,6 +2952,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
c2h
ab_def
drop table t1;
+SELECT @@collation_connection;
+@@collation_connection
+utf16_unicode_ci
+SELECT '\%b' LIKE '%\%';
+'\%b' LIKE '%\%'
+0
"BEGIN ctype_german.inc"
drop table if exists t1;
create table t1 as select repeat(' ', 64) as s1;
diff --git a/mysql-test/r/ctype_utf16le.result b/mysql-test/r/ctype_utf16le.result
index c7c8c210014..e1a71e02bb6 100644
--- a/mysql-test/r/ctype_utf16le.result
+++ b/mysql-test/r/ctype_utf16le.result
@@ -713,6 +713,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
c2h
ab_def
drop table t1;
+SELECT @@collation_connection;
+@@collation_connection
+utf16le_general_ci
+SELECT '\%b' LIKE '%\%';
+'\%b' LIKE '%\%'
+0
SET NAMES utf8, collation_connection='utf16le_bin';
create table t1 select repeat('a',4000) a;
delete from t1;
@@ -849,6 +855,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
c2h
ab_def
drop table t1;
+SELECT @@collation_connection;
+@@collation_connection
+utf16le_bin
+SELECT '\%b' LIKE '%\%';
+'\%b' LIKE '%\%'
+0
#
# Bug#10344 Some string functions fail for UCS2
#
diff --git a/mysql-test/r/ctype_utf32.result b/mysql-test/r/ctype_utf32.result
index 024f8aa7875..4a44147e945 100644
--- a/mysql-test/r/ctype_utf32.result
+++ b/mysql-test/r/ctype_utf32.result
@@ -668,6 +668,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
c2h
ab_def
drop table t1;
+SELECT @@collation_connection;
+@@collation_connection
+utf32_general_ci
+SELECT '\%b' LIKE '%\%';
+'\%b' LIKE '%\%'
+0
SET NAMES latin1;
SET collation_connection='utf32_bin';
create table t1 select repeat('a',4000) a;
@@ -805,6 +811,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
c2h
ab_def
drop table t1;
+SELECT @@collation_connection;
+@@collation_connection
+utf32_bin
+SELECT '\%b' LIKE '%\%';
+'\%b' LIKE '%\%'
+0
select hex(substr(_utf32 0x000000e4000000e500000068,1));
hex(substr(_utf32 0x000000e4000000e500000068,1))
000000E4000000E500000068
diff --git a/mysql-test/r/ctype_utf32_uca.result b/mysql-test/r/ctype_utf32_uca.result
index 234a01bb108..37fc76db294 100644
--- a/mysql-test/r/ctype_utf32_uca.result
+++ b/mysql-test/r/ctype_utf32_uca.result
@@ -2952,6 +2952,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
c2h
ab_def
drop table t1;
+SELECT @@collation_connection;
+@@collation_connection
+utf32_unicode_ci
+SELECT '\%b' LIKE '%\%';
+'\%b' LIKE '%\%'
+0
"BEGIN ctype_german.inc"
drop table if exists t1;
create table t1 as select repeat(' ', 64) as s1;
diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result
index 7b486f0f443..dbed2d7473f 100644
--- a/mysql-test/r/ctype_utf8.result
+++ b/mysql-test/r/ctype_utf8.result
@@ -1032,6 +1032,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
c2h
ab_def
drop table t1;
+SELECT @@collation_connection;
+@@collation_connection
+utf8_general_ci
+SELECT '\%b' LIKE '%\%';
+'\%b' LIKE '%\%'
+0
"BEGIN ctype_german.inc"
drop table if exists t1;
create table t1 as select repeat(' ', 64) as s1;
@@ -1263,6 +1269,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
c2h
ab_def
drop table t1;
+SELECT @@collation_connection;
+@@collation_connection
+utf8_bin
+SELECT '\%b' LIKE '%\%';
+'\%b' LIKE '%\%'
+0
CREATE TABLE t1 (
user varchar(255) NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
diff --git a/mysql-test/r/ctype_utf8mb4.result b/mysql-test/r/ctype_utf8mb4.result
index de9ba321ad9..fa1cf3b1d19 100644
--- a/mysql-test/r/ctype_utf8mb4.result
+++ b/mysql-test/r/ctype_utf8mb4.result
@@ -1032,6 +1032,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
c2h
ab_def
drop table t1;
+SELECT @@collation_connection;
+@@collation_connection
+utf8mb4_general_ci
+SELECT '\%b' LIKE '%\%';
+'\%b' LIKE '%\%'
+0
"BEGIN ctype_german.inc"
drop table if exists t1;
create table t1 as select repeat(' ', 64) as s1;
@@ -1284,6 +1290,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
c2h
ab_def
drop table t1;
+SELECT @@collation_connection;
+@@collation_connection
+utf8mb4_bin
+SELECT '\%b' LIKE '%\%';
+'\%b' LIKE '%\%'
+0
CREATE TABLE t1 (
user varchar(255) NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
diff --git a/mysql-test/r/ctype_utf8mb4_heap.result b/mysql-test/r/ctype_utf8mb4_heap.result
index 46b0cc3789f..ef134641ff8 100644
--- a/mysql-test/r/ctype_utf8mb4_heap.result
+++ b/mysql-test/r/ctype_utf8mb4_heap.result
@@ -971,6 +971,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
c2h
ab_def
drop table t1;
+SELECT @@collation_connection;
+@@collation_connection
+utf8mb4_general_ci
+SELECT '\%b' LIKE '%\%';
+'\%b' LIKE '%\%'
+0
"BEGIN ctype_german.inc"
drop table if exists t1;
create table t1 as select repeat(' ', 64) as s1;
@@ -1183,6 +1189,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
c2h
ab_def
drop table t1;
+SELECT @@collation_connection;
+@@collation_connection
+utf8mb4_bin
+SELECT '\%b' LIKE '%\%';
+'\%b' LIKE '%\%'
+0
CREATE TABLE t1 (
user varchar(255) NOT NULL default ''
) ENGINE=heap DEFAULT CHARSET=latin1;
diff --git a/mysql-test/r/ctype_utf8mb4_innodb.result b/mysql-test/r/ctype_utf8mb4_innodb.result
index cfd9bf969ad..9c58dc87126 100644
--- a/mysql-test/r/ctype_utf8mb4_innodb.result
+++ b/mysql-test/r/ctype_utf8mb4_innodb.result
@@ -1032,6 +1032,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
c2h
ab_def
drop table t1;
+SELECT @@collation_connection;
+@@collation_connection
+utf8mb4_general_ci
+SELECT '\%b' LIKE '%\%';
+'\%b' LIKE '%\%'
+0
"BEGIN ctype_german.inc"
drop table if exists t1;
create table t1 as select repeat(' ', 64) as s1;
@@ -1244,6 +1250,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
c2h
ab_def
drop table t1;
+SELECT @@collation_connection;
+@@collation_connection
+utf8mb4_bin
+SELECT '\%b' LIKE '%\%';
+'\%b' LIKE '%\%'
+0
CREATE TABLE t1 (
user varchar(255) NOT NULL default ''
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
diff --git a/mysql-test/r/ctype_utf8mb4_myisam.result b/mysql-test/r/ctype_utf8mb4_myisam.result
index 53ae410046f..18bec51358d 100644
--- a/mysql-test/r/ctype_utf8mb4_myisam.result
+++ b/mysql-test/r/ctype_utf8mb4_myisam.result
@@ -1032,6 +1032,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
c2h
ab_def
drop table t1;
+SELECT @@collation_connection;
+@@collation_connection
+utf8mb4_general_ci
+SELECT '\%b' LIKE '%\%';
+'\%b' LIKE '%\%'
+0
"BEGIN ctype_german.inc"
drop table if exists t1;
create table t1 as select repeat(' ', 64) as s1;
@@ -1244,6 +1250,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
c2h
ab_def
drop table t1;
+SELECT @@collation_connection;
+@@collation_connection
+utf8mb4_bin
+SELECT '\%b' LIKE '%\%';
+'\%b' LIKE '%\%'
+0
CREATE TABLE t1 (
user varchar(255) NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1;