summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authormsvensson@msdesk.(none) <>2005-10-06 14:40:18 +0200
committermsvensson@msdesk.(none) <>2005-10-06 14:40:18 +0200
commit5da6a6c8a140a130f4c92d1af7517daed84c92f8 (patch)
tree734fdb74393f521e44d3e254c283586558f54ca4 /mysql-test
parent3af12c477662114f4e118bba6806af65f64b9793 (diff)
parent905c8b8c88838f29ce7a3dc8cd4275b768426c9c (diff)
downloadmariadb-git-5da6a6c8a140a130f4c92d1af7517daed84c92f8.tar.gz
Merge msdesk.(none):/home/msvensson/mysql-4.1
into msdesk.(none):/home/msvensson/mysql-5.0
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/include/ctype_like_escape.inc18
-rw-r--r--mysql-test/ndb/ndb_range_bounds.pl218
-rw-r--r--mysql-test/r/ctype_big5.result36
-rw-r--r--mysql-test/r/ctype_gbk.result36
-rw-r--r--mysql-test/r/ctype_latin1.result36
-rw-r--r--mysql-test/r/ctype_sjis.result36
-rw-r--r--mysql-test/r/ctype_tis620.result36
-rw-r--r--mysql-test/r/ctype_uca.result18
-rw-r--r--mysql-test/r/ctype_ucs.result36
-rw-r--r--mysql-test/r/ctype_ujis.result36
-rw-r--r--mysql-test/r/ctype_utf8.result36
-rw-r--r--mysql-test/t/ctype_big5.test2
-rw-r--r--mysql-test/t/ctype_gbk.test2
-rw-r--r--mysql-test/t/ctype_latin1.test2
-rw-r--r--mysql-test/t/ctype_sjis.test2
-rw-r--r--mysql-test/t/ctype_tis620.test2
-rw-r--r--mysql-test/t/ctype_uca.test1
-rw-r--r--mysql-test/t/ctype_ucs.test2
-rw-r--r--mysql-test/t/ctype_ujis.test2
-rw-r--r--mysql-test/t/ctype_utf8.test2
20 files changed, 341 insertions, 218 deletions
diff --git a/mysql-test/include/ctype_like_escape.inc b/mysql-test/include/ctype_like_escape.inc
new file mode 100644
index 00000000000..ac97fbaa1a0
--- /dev/null
+++ b/mysql-test/include/ctype_like_escape.inc
@@ -0,0 +1,18 @@
+#
+# Bugs: #13046:
+# LIKE pattern matching using prefix index doesn't return correct result
+#
+select @@collation_connection;
+create table t1 ROW_FORMAT=DYNAMIC select repeat('a',50) as c1 ;
+insert into t1 values('abcdef');
+insert into t1 values('_bcdef');
+insert into t1 values('a_cdef');
+insert into t1 values('ab_def');
+insert into t1 values('abc_ef');
+insert into t1 values('abcd_f');
+insert into t1 values('abcde_');
+-- should return ab_def
+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;
diff --git a/mysql-test/ndb/ndb_range_bounds.pl b/mysql-test/ndb/ndb_range_bounds.pl
deleted file mode 100644
index abe1ea28298..00000000000
--- a/mysql-test/ndb/ndb_range_bounds.pl
+++ /dev/null
@@ -1,218 +0,0 @@
-#
-# test range scan bounds
-# give option --all to test all cases
-# set MYSQL_HOME to installation top
-#
-
-use strict;
-use integer;
-use Getopt::Long;
-use DBI;
-
-my $opt_all = 0;
-my $opt_cnt = 5;
-my $opt_verbose = 0;
-GetOptions("all" => \$opt_all, "cnt=i" => \$opt_cnt, "verbose" => \$opt_verbose)
- or die "options are: --all --cnt=N --verbose";
-
-my $mysql_home = $ENV{MYSQL_HOME};
-defined($mysql_home) or die "no MYSQL_HOME";
-my $dsn = "dbi:mysql:database=test;host=localhost;mysql_read_default_file=$mysql_home/var/my.cnf";
-my $opts = { RaiseError => 0, PrintError => 0, AutoCommit => 1, };
-
-my $dbh;
-my $sth;
-my $sql;
-
-$dbh = DBI->connect($dsn, "root", undef, $opts) or die $DBI::errstr;
-
-my $table = 't';
-
-$sql = "drop table if exists $table";
-$dbh->do($sql) or die $DBI::errstr;
-
-sub cut ($$$) {
- my($op, $key, $val) = @_;
- $op = '==' if $op eq '=';
- my(@w) = @$val;
- eval "\@w = grep(\$_ $op $key, \@w)";
- $@ and die $@;
- return [ @w ];
-}
-
-sub mkdummy ($) {
- my ($val) = @_;
- return {
- 'dummy' => 1,
- 'exp' => '9 = 9',
- 'res' => $val,
- };
-}
-
-sub mkone ($$$$) {
- my($col, $op, $key, $val) = @_;
- my $res = cut($op, $key, $val);
- return {
- 'exp' => "$col $op $key",
- 'res' => $res,
- };
-}
-
-sub mktwo ($$$$$$) {
- my($col, $op1, $key1, $op2, $key2, $val) = @_;
- my $res = cut($op2, $key2, cut($op1, $key1, $val));
- return {
- 'exp' => "$col $op1 $key1 and $col $op2 $key2",
- 'res' => $res,
- };
-}
-
-sub mkall ($$$$) {
- my($col, $key1, $key2, $val) = @_;
- my @a = ();
- my $p = mkdummy($val);
- push(@a, $p) if $opt_all;
- my @ops = qw(< <= = >= >);
- for my $op (@ops) {
- my $p = mkone($col, $op, $key1, $val);
- push(@a, $p) if $opt_all || @{$p->{res}} != 0;
- }
- my @ops1 = $opt_all ? @ops : qw(= >= >);
- my @ops2 = $opt_all ? @ops : qw(<= <);
- for my $op1 (@ops1) {
- for my $op2 (@ops2) {
- my $p = mktwo($col, $op1, $key1, $op2, $key2, $val);
- push(@a, $p) if $opt_all || @{$p->{res}} != 0;
- }
- }
- warn scalar(@a)." cases\n" if $opt_verbose;
- return \@a;
-}
-
-my $casecnt = 0;
-
-sub verify ($$$) {
- my($sql, $ord, $res) = @_;
- warn "$sql\n" if $opt_verbose;
- $sth = $dbh->prepare($sql) or die "prepare: $sql: $DBI::errstr";
- $sth->execute() or die "execute: $sql: $DBI::errstr";
- #
- # BUG: execute can return success on error so check again
- #
- $sth->err and die "execute: $sql: $DBI::errstr";
- my @out = ();
- for my $b (@{$res->[0]}) {
- for my $c (@{$res->[1]}) {
- for my $d (@{$res->[2]}) {
- push(@out, [$b, $c, $d]);
- }
- }
- }
- if ($ord) {
- @out = sort {
- $ord * ($a->[0] - $b->[0]) ||
- $ord * ($a->[1] - $b->[1]) ||
- $ord * ($a->[2] - $b->[2]) ||
- 0
- } @out;
- }
- my $cnt = scalar @out;
- my $n = 0;
- while (1) {
- my $row = $sth->fetchrow_arrayref;
- $row || last;
- @$row == 3 or die "bad row: $sql: @$row";
- for my $v (@$row) {
- $v =~ s/^\s+|\s+$//g;
- $v =~ /^\d+$/ or die "bad value: $sql: $v";
- }
- if ($ord) {
- my $out = $out[$n];
- $row->[0] == $out->[0] &&
- $row->[1] == $out->[1] &&
- $row->[2] == $out->[2] or
- die "$sql: row $n: got row @$row != @$out";
- }
- $n++;
- }
- $sth->err and die "fetch: $sql: $DBI::errstr";
- $n == $cnt or die "verify: $sql: got row count $n != $cnt";
- $casecnt++;
-}
-
-for my $nn ("bcd", "") {
- my %nn;
- for my $x (qw(b c d)) {
- $nn{$x} = $nn =~ /$x/ ? "not null" : "null";
- }
- warn "create table\n";
- $sql = <<EOF;
-create table $table (
- a int primary key,
- b int $nn{b},
- c int $nn{c},
- d int $nn{d},
- index (b, c, d)
-) engine=ndb
-EOF
- $dbh->do($sql) or die $DBI::errstr;
- warn "insert\n";
- $sql = "insert into $table values(?, ?, ?, ?)";
- $sth = $dbh->prepare($sql) or die $DBI::errstr;
- my @val = (0..($opt_cnt-1));
- my $v0 = 0;
- for my $v1 (@val) {
- for my $v2 (@val) {
- for my $v3 (@val) {
- $sth->bind_param(1, $v0) or die $DBI::errstr;
- $sth->bind_param(2, $v1) or die $DBI::errstr;
- $sth->bind_param(3, $v2) or die $DBI::errstr;
- $sth->bind_param(4, $v3) or die $DBI::errstr;
- $sth->execute or die $DBI::errstr;
- $v0++;
- }
- }
- }
- warn "generate cases\n";
- my $key1 = 1;
- my $key2 = 3;
- my $a1 = mkall('b', $key1, $key2, \@val);
- my $a2 = mkall('c', $key1, $key2, \@val);
- my $a3 = mkall('d', $key1, $key2, \@val);
- warn "select\n";
- for my $ord (0, +1, -1) {
- my $orderby =
- $ord == 0 ? "" :
- $ord == +1 ? " order by b, c, d" :
- $ord == -1 ? " order by b desc, c desc, d desc" : die "not here";
- for my $p1 (@$a1) {
- my $res = [ $p1->{res}, \@val, \@val ];
- $sql = "select b, c, d from $table" .
- " where $p1->{exp}" .
- $orderby;
- verify($sql, $ord, $res);
- for my $p2 (@$a2) {
- my $res = [ $p1->{res}, $p2->{res}, \@val ];
- $sql = "select b, c, d from $table" .
- " where $p1->{exp} and $p2->{exp}" .
- $orderby;
- verify($sql, $ord, $res);
- for my $p3 (@$a3) {
- my $res = [ $p1->{res}, $p2->{res}, $p3->{res} ];
- $sql = "select b, c, d from $table" .
- " where $p1->{exp} and $p2->{exp} and $p3->{exp}" .
- $orderby;
- verify($sql, $ord, $res);
- }
- }
- }
- }
- warn "drop table\n";
- $sql = "drop table $table";
- $dbh->do($sql) or die $DBI::errstr;
-}
-
-warn "verified $casecnt cases\n";
-warn "done\n";
-
-# vim: set sw=2:
diff --git a/mysql-test/r/ctype_big5.result b/mysql-test/r/ctype_big5.result
index 01b59b93b52..a31289775fe 100644
--- a/mysql-test/r/ctype_big5.result
+++ b/mysql-test/r/ctype_big5.result
@@ -89,6 +89,24 @@ select c1 from t1 where c1 like 'abcde111%' order by c1;
c1
abcde111
drop table t1;
+select @@collation_connection;
+@@collation_connection
+big5_chinese_ci
+create table t1 ROW_FORMAT=DYNAMIC select repeat('a',50) as c1 ;
+insert into t1 values('abcdef');
+insert into t1 values('_bcdef');
+insert into t1 values('a_cdef');
+insert into t1 values('ab_def');
+insert into t1 values('abc_ef');
+insert into t1 values('abcd_f');
+insert into t1 values('abcde_');
+select c1 as c1u from t1 where c1 like 'ab\_def';
+c1u
+ab_def
+select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
+c2h
+ab_def
+drop table t1;
SET collation_connection='big5_bin';
create table t1 select repeat('a',4000) a;
delete from t1;
@@ -121,6 +139,24 @@ select c1 from t1 where c1 like 'abcde111%' order by c1;
c1
abcde111
drop table t1;
+select @@collation_connection;
+@@collation_connection
+big5_bin
+create table t1 ROW_FORMAT=DYNAMIC select repeat('a',50) as c1 ;
+insert into t1 values('abcdef');
+insert into t1 values('_bcdef');
+insert into t1 values('a_cdef');
+insert into t1 values('ab_def');
+insert into t1 values('abc_ef');
+insert into t1 values('abcd_f');
+insert into t1 values('abcde_');
+select c1 as c1u from t1 where c1 like 'ab\_def';
+c1u
+ab_def
+select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
+c2h
+ab_def
+drop table t1;
SET NAMES big5;
CREATE TABLE t1 (a text) character set big5;
INSERT INTO t1 VALUES ('');
diff --git a/mysql-test/r/ctype_gbk.result b/mysql-test/r/ctype_gbk.result
index 1a9dea28429..aaffe692126 100644
--- a/mysql-test/r/ctype_gbk.result
+++ b/mysql-test/r/ctype_gbk.result
@@ -89,6 +89,24 @@ select c1 from t1 where c1 like 'abcde111%' order by c1;
c1
abcde111
drop table t1;
+select @@collation_connection;
+@@collation_connection
+gbk_chinese_ci
+create table t1 ROW_FORMAT=DYNAMIC select repeat('a',50) as c1 ;
+insert into t1 values('abcdef');
+insert into t1 values('_bcdef');
+insert into t1 values('a_cdef');
+insert into t1 values('ab_def');
+insert into t1 values('abc_ef');
+insert into t1 values('abcd_f');
+insert into t1 values('abcde_');
+select c1 as c1u from t1 where c1 like 'ab\_def';
+c1u
+ab_def
+select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
+c2h
+ab_def
+drop table t1;
SET collation_connection='gbk_bin';
create table t1 select repeat('a',4000) a;
delete from t1;
@@ -121,6 +139,24 @@ select c1 from t1 where c1 like 'abcde111%' order by c1;
c1
abcde111
drop table t1;
+select @@collation_connection;
+@@collation_connection
+gbk_bin
+create table t1 ROW_FORMAT=DYNAMIC select repeat('a',50) as c1 ;
+insert into t1 values('abcdef');
+insert into t1 values('_bcdef');
+insert into t1 values('a_cdef');
+insert into t1 values('ab_def');
+insert into t1 values('abc_ef');
+insert into t1 values('abcd_f');
+insert into t1 values('abcde_');
+select c1 as c1u from t1 where c1 like 'ab\_def';
+c1u
+ab_def
+select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
+c2h
+ab_def
+drop table t1;
SET NAMES gbk;
CREATE TABLE t1 (a text) character set gbk;
INSERT INTO t1 VALUES (0xA3A0),(0xA1A1);
diff --git a/mysql-test/r/ctype_latin1.result b/mysql-test/r/ctype_latin1.result
index 95fca1575ef..0fbdc8ac63c 100644
--- a/mysql-test/r/ctype_latin1.result
+++ b/mysql-test/r/ctype_latin1.result
@@ -315,6 +315,24 @@ latin1_swedish_ci 6109
latin1_swedish_ci 61
latin1_swedish_ci 6120
drop table t1;
+select @@collation_connection;
+@@collation_connection
+latin1_swedish_ci
+create table t1 ROW_FORMAT=DYNAMIC select repeat('a',50) as c1 ;
+insert into t1 values('abcdef');
+insert into t1 values('_bcdef');
+insert into t1 values('a_cdef');
+insert into t1 values('ab_def');
+insert into t1 values('abc_ef');
+insert into t1 values('abcd_f');
+insert into t1 values('abcde_');
+select c1 as c1u from t1 where c1 like 'ab\_def';
+c1u
+ab_def
+select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
+c2h
+ab_def
+drop table t1;
SET collation_connection='latin1_bin';
create table t1 select repeat('a',4000) a;
delete from t1;
@@ -325,6 +343,24 @@ latin1_bin 6109
latin1_bin 61
latin1_bin 6120
drop table t1;
+select @@collation_connection;
+@@collation_connection
+latin1_bin
+create table t1 ROW_FORMAT=DYNAMIC select repeat('a',50) as c1 ;
+insert into t1 values('abcdef');
+insert into t1 values('_bcdef');
+insert into t1 values('a_cdef');
+insert into t1 values('ab_def');
+insert into t1 values('abc_ef');
+insert into t1 values('abcd_f');
+insert into t1 values('abcde_');
+select c1 as c1u from t1 where c1 like 'ab\_def';
+c1u
+ab_def
+select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
+c2h
+ab_def
+drop table t1;
CREATE TABLE a (a int);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL 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 e6669c63621..d1976a516d2 100644
--- a/mysql-test/r/ctype_sjis.result
+++ b/mysql-test/r/ctype_sjis.result
@@ -103,6 +103,24 @@ select c1 from t1 where c1 like 'abcde111%' order by c1;
c1
abcde111
drop table t1;
+select @@collation_connection;
+@@collation_connection
+sjis_japanese_ci
+create table t1 ROW_FORMAT=DYNAMIC select repeat('a',50) as c1 ;
+insert into t1 values('abcdef');
+insert into t1 values('_bcdef');
+insert into t1 values('a_cdef');
+insert into t1 values('ab_def');
+insert into t1 values('abc_ef');
+insert into t1 values('abcd_f');
+insert into t1 values('abcde_');
+select c1 as c1u from t1 where c1 like 'ab\_def';
+c1u
+ab_def
+select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
+c2h
+ab_def
+drop table t1;
SET collation_connection='sjis_bin';
create table t1 select repeat('a',4000) a;
delete from t1;
@@ -135,6 +153,24 @@ select c1 from t1 where c1 like 'abcde111%' order by c1;
c1
abcde111
drop table t1;
+select @@collation_connection;
+@@collation_connection
+sjis_bin
+create table t1 ROW_FORMAT=DYNAMIC select repeat('a',50) as c1 ;
+insert into t1 values('abcdef');
+insert into t1 values('_bcdef');
+insert into t1 values('a_cdef');
+insert into t1 values('ab_def');
+insert into t1 values('abc_ef');
+insert into t1 values('abcd_f');
+insert into t1 values('abcde_');
+select c1 as c1u from t1 where c1 like 'ab\_def';
+c1u
+ab_def
+select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
+c2h
+ab_def
+drop table t1;
SET NAMES sjis;
SELECT HEX('@\\') FROM DUAL;
HEX('@_\')
diff --git a/mysql-test/r/ctype_tis620.result b/mysql-test/r/ctype_tis620.result
index 5734f7cac86..dae694cf3d5 100644
--- a/mysql-test/r/ctype_tis620.result
+++ b/mysql-test/r/ctype_tis620.result
@@ -2947,6 +2947,24 @@ tis620_thai_ci 6109
tis620_thai_ci 61
tis620_thai_ci 6120
drop table t1;
+select @@collation_connection;
+@@collation_connection
+tis620_thai_ci
+create table t1 ROW_FORMAT=DYNAMIC select repeat('a',50) as c1 ;
+insert into t1 values('abcdef');
+insert into t1 values('_bcdef');
+insert into t1 values('a_cdef');
+insert into t1 values('ab_def');
+insert into t1 values('abc_ef');
+insert into t1 values('abcd_f');
+insert into t1 values('abcde_');
+select c1 as c1u from t1 where c1 like 'ab\_def';
+c1u
+ab_def
+select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
+c2h
+ab_def
+drop table t1;
SET collation_connection='tis620_bin';
create table t1 select repeat('a',4000) a;
delete from t1;
@@ -2957,3 +2975,21 @@ tis620_bin 6109
tis620_bin 61
tis620_bin 6120
drop table t1;
+select @@collation_connection;
+@@collation_connection
+tis620_bin
+create table t1 ROW_FORMAT=DYNAMIC select repeat('a',50) as c1 ;
+insert into t1 values('abcdef');
+insert into t1 values('_bcdef');
+insert into t1 values('a_cdef');
+insert into t1 values('ab_def');
+insert into t1 values('abc_ef');
+insert into t1 values('abcd_f');
+insert into t1 values('abcde_');
+select c1 as c1u from t1 where c1 like 'ab\_def';
+c1u
+ab_def
+select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
+c2h
+ab_def
+drop table t1;
diff --git a/mysql-test/r/ctype_uca.result b/mysql-test/r/ctype_uca.result
index e2805e41f3a..4b245c69d2a 100644
--- a/mysql-test/r/ctype_uca.result
+++ b/mysql-test/r/ctype_uca.result
@@ -2506,6 +2506,24 @@ utf8_unicode_ci 6109
utf8_unicode_ci 61
utf8_unicode_ci 6120
drop table t1;
+select @@collation_connection;
+@@collation_connection
+utf8_unicode_ci
+create table t1 ROW_FORMAT=DYNAMIC select repeat('a',50) as c1 ;
+insert into t1 values('abcdef');
+insert into t1 values('_bcdef');
+insert into t1 values('a_cdef');
+insert into t1 values('ab_def');
+insert into t1 values('abc_ef');
+insert into t1 values('abcd_f');
+insert into t1 values('abcde_');
+select c1 as c1u from t1 where c1 like 'ab\_def';
+c1u
+ab_def
+select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
+c2h
+ab_def
+drop table t1;
CREATE TABLE t1 (id int, a varchar(30) character set utf8);
INSERT INTO t1 VALUES (1, _ucs2 0x01310069), (2, _ucs2 0x01310131);
INSERT INTO t1 VALUES (3, _ucs2 0x00690069), (4, _ucs2 0x01300049);
diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result
index 4bc2ed0fdc8..65b5a1cbba8 100644
--- a/mysql-test/r/ctype_ucs.result
+++ b/mysql-test/r/ctype_ucs.result
@@ -595,6 +595,24 @@ ucs2_general_ci 00610009
ucs2_general_ci 0061
ucs2_general_ci 00610020
drop table t1;
+select @@collation_connection;
+@@collation_connection
+ucs2_general_ci
+create table t1 ROW_FORMAT=DYNAMIC select repeat('a',50) as c1 ;
+insert into t1 values('abcdef');
+insert into t1 values('_bcdef');
+insert into t1 values('a_cdef');
+insert into t1 values('ab_def');
+insert into t1 values('abc_ef');
+insert into t1 values('abcd_f');
+insert into t1 values('abcde_');
+select c1 as c1u from t1 where c1 like 'ab\_def';
+c1u
+ab_def
+select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
+c2h
+ab_def
+drop table t1;
SET NAMES latin1;
SET collation_connection='ucs2_bin';
create table t1 select repeat('a',4000) a;
@@ -606,6 +624,24 @@ ucs2_bin 00610009
ucs2_bin 0061
ucs2_bin 00610020
drop table t1;
+select @@collation_connection;
+@@collation_connection
+ucs2_bin
+create table t1 ROW_FORMAT=DYNAMIC select repeat('a',50) as c1 ;
+insert into t1 values('abcdef');
+insert into t1 values('_bcdef');
+insert into t1 values('a_cdef');
+insert into t1 values('ab_def');
+insert into t1 values('abc_ef');
+insert into t1 values('abcd_f');
+insert into t1 values('abcde_');
+select c1 as c1u from t1 where c1 like 'ab\_def';
+c1u
+ab_def
+select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
+c2h
+ab_def
+drop table t1;
select hex(substr(_ucs2 0x00e400e50068,1));
hex(substr(_ucs2 0x00e400e50068,1))
00E400E50068
diff --git a/mysql-test/r/ctype_ujis.result b/mysql-test/r/ctype_ujis.result
index 0fee6fc3456..15de93440fc 100644
--- a/mysql-test/r/ctype_ujis.result
+++ b/mysql-test/r/ctype_ujis.result
@@ -2239,6 +2239,24 @@ select c1 from t1 where c1 like 'abcde111%' order by c1;
c1
abcde111
drop table t1;
+select @@collation_connection;
+@@collation_connection
+ujis_japanese_ci
+create table t1 ROW_FORMAT=DYNAMIC select repeat('a',50) as c1 ;
+insert into t1 values('abcdef');
+insert into t1 values('_bcdef');
+insert into t1 values('a_cdef');
+insert into t1 values('ab_def');
+insert into t1 values('abc_ef');
+insert into t1 values('abcd_f');
+insert into t1 values('abcde_');
+select c1 as c1u from t1 where c1 like 'ab\_def';
+c1u
+ab_def
+select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
+c2h
+ab_def
+drop table t1;
SET collation_connection='ujis_bin';
create table t1 select repeat('a',4000) a;
delete from t1;
@@ -2271,6 +2289,24 @@ select c1 from t1 where c1 like 'abcde111%' order by c1;
c1
abcde111
drop table t1;
+select @@collation_connection;
+@@collation_connection
+ujis_bin
+create table t1 ROW_FORMAT=DYNAMIC select repeat('a',50) as c1 ;
+insert into t1 values('abcdef');
+insert into t1 values('_bcdef');
+insert into t1 values('a_cdef');
+insert into t1 values('ab_def');
+insert into t1 values('abc_ef');
+insert into t1 values('abcd_f');
+insert into t1 values('abcde_');
+select c1 as c1u from t1 where c1 like 'ab\_def';
+c1u
+ab_def
+select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
+c2h
+ab_def
+drop table t1;
DROP TABLE IF EXISTS t1, t2;
DROP PROCEDURE IF EXISTS sp1;
set names ujis;
diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result
index 8e10e97d49d..1695f1c67e8 100644
--- a/mysql-test/r/ctype_utf8.result
+++ b/mysql-test/r/ctype_utf8.result
@@ -842,6 +842,24 @@ utf8_general_ci 6109
utf8_general_ci 61
utf8_general_ci 6120
drop table t1;
+select @@collation_connection;
+@@collation_connection
+utf8_general_ci
+create table t1 ROW_FORMAT=DYNAMIC select repeat('a',50) as c1 ;
+insert into t1 values('abcdef');
+insert into t1 values('_bcdef');
+insert into t1 values('a_cdef');
+insert into t1 values('ab_def');
+insert into t1 values('abc_ef');
+insert into t1 values('abcd_f');
+insert into t1 values('abcde_');
+select c1 as c1u from t1 where c1 like 'ab\_def';
+c1u
+ab_def
+select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
+c2h
+ab_def
+drop table t1;
SET collation_connection='utf8_bin';
create table t1 select repeat('a',4000) a;
delete from t1;
@@ -852,6 +870,24 @@ utf8_bin 6109
utf8_bin 61
utf8_bin 6120
drop table t1;
+select @@collation_connection;
+@@collation_connection
+utf8_bin
+create table t1 ROW_FORMAT=DYNAMIC select repeat('a',50) as c1 ;
+insert into t1 values('abcdef');
+insert into t1 values('_bcdef');
+insert into t1 values('a_cdef');
+insert into t1 values('ab_def');
+insert into t1 values('abc_ef');
+insert into t1 values('abcd_f');
+insert into t1 values('abcde_');
+select c1 as c1u from t1 where c1 like 'ab\_def';
+c1u
+ab_def
+select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
+c2h
+ab_def
+drop table t1;
CREATE TABLE t1 (
user varchar(255) NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
diff --git a/mysql-test/t/ctype_big5.test b/mysql-test/t/ctype_big5.test
index 73d9f06042c..1788dce755b 100644
--- a/mysql-test/t/ctype_big5.test
+++ b/mysql-test/t/ctype_big5.test
@@ -15,9 +15,11 @@ SET NAMES big5;
SET collation_connection='big5_chinese_ci';
-- source include/ctype_filesort.inc
-- source include/ctype_innodb_like.inc
+-- source include/ctype_like_escape.inc
SET collation_connection='big5_bin';
-- source include/ctype_filesort.inc
-- source include/ctype_innodb_like.inc
+-- source include/ctype_like_escape.inc
#
# Bugs#9357: TEXT columns break string with special word in BIG5 charset.
diff --git a/mysql-test/t/ctype_gbk.test b/mysql-test/t/ctype_gbk.test
index 2210891454e..5eeade96186 100644
--- a/mysql-test/t/ctype_gbk.test
+++ b/mysql-test/t/ctype_gbk.test
@@ -15,9 +15,11 @@ SET NAMES gbk;
SET collation_connection='gbk_chinese_ci';
-- source include/ctype_filesort.inc
-- source include/ctype_innodb_like.inc
+-- source include/ctype_like_escape.inc
SET collation_connection='gbk_bin';
-- source include/ctype_filesort.inc
-- source include/ctype_innodb_like.inc
+-- source include/ctype_like_escape.inc
#
# Bug#11987 mysql will truncate the text when
diff --git a/mysql-test/t/ctype_latin1.test b/mysql-test/t/ctype_latin1.test
index 1b83373da29..8953aaecaf8 100644
--- a/mysql-test/t/ctype_latin1.test
+++ b/mysql-test/t/ctype_latin1.test
@@ -64,8 +64,10 @@ select 'a' regexp 'A' collate latin1_bin;
SET collation_connection='latin1_swedish_ci';
-- source include/ctype_filesort.inc
+-- source include/ctype_like_escape.inc
SET collation_connection='latin1_bin';
-- source include/ctype_filesort.inc
+-- source include/ctype_like_escape.inc
#
# Bug#8041
diff --git a/mysql-test/t/ctype_sjis.test b/mysql-test/t/ctype_sjis.test
index 252f0a0b6c8..1d807b5e9a8 100644
--- a/mysql-test/t/ctype_sjis.test
+++ b/mysql-test/t/ctype_sjis.test
@@ -67,9 +67,11 @@ drop table t1;
SET collation_connection='sjis_japanese_ci';
-- source include/ctype_filesort.inc
-- source include/ctype_innodb_like.inc
+-- source include/ctype_like_escape.inc
SET collation_connection='sjis_bin';
-- source include/ctype_filesort.inc
-- source include/ctype_innodb_like.inc
+-- source include/ctype_like_escape.inc
# Check parsing of string literals in SJIS with multibyte characters that
# have an embedded \ in them. (Bug #8303)
diff --git a/mysql-test/t/ctype_tis620.test b/mysql-test/t/ctype_tis620.test
index d649828eda3..c49540de24b 100644
--- a/mysql-test/t/ctype_tis620.test
+++ b/mysql-test/t/ctype_tis620.test
@@ -155,7 +155,9 @@ DROP TABLE t1;
SET collation_connection='tis620_thai_ci';
-- source include/ctype_filesort.inc
+-- source include/ctype_like_escape.inc
SET collation_connection='tis620_bin';
-- source include/ctype_filesort.inc
+-- source include/ctype_like_escape.inc
# End of 4.1 tests
diff --git a/mysql-test/t/ctype_uca.test b/mysql-test/t/ctype_uca.test
index 43ef0cc8755..6d8713f4910 100644
--- a/mysql-test/t/ctype_uca.test
+++ b/mysql-test/t/ctype_uca.test
@@ -456,6 +456,7 @@ drop table t1;
SET collation_connection='utf8_unicode_ci';
-- source include/ctype_filesort.inc
+-- source include/ctype_like_escape.inc
# End of 4.1 tests
diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test
index 668edb3fafe..626c7e0e1b6 100644
--- a/mysql-test/t/ctype_ucs.test
+++ b/mysql-test/t/ctype_ucs.test
@@ -372,9 +372,11 @@ drop table t1;
SET collation_connection='ucs2_general_ci';
-- source include/ctype_filesort.inc
+-- source include/ctype_like_escape.inc
SET NAMES latin1;
SET collation_connection='ucs2_bin';
-- source include/ctype_filesort.inc
+-- source include/ctype_like_escape.inc
#
# Bug#10344 Some string functions fail for UCS2
diff --git a/mysql-test/t/ctype_ujis.test b/mysql-test/t/ctype_ujis.test
index 7730fd0db6d..c1d6c67387b 100644
--- a/mysql-test/t/ctype_ujis.test
+++ b/mysql-test/t/ctype_ujis.test
@@ -1146,9 +1146,11 @@ DROP TABLE t1;
SET collation_connection='ujis_japanese_ci';
-- source include/ctype_filesort.inc
-- source include/ctype_innodb_like.inc
+-- source include/ctype_like_escape.inc
SET collation_connection='ujis_bin';
-- source include/ctype_filesort.inc
-- source include/ctype_innodb_like.inc
+-- source include/ctype_like_escape.inc
# End of 4.1 tests
--disable_warnings
diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test
index b009e13874f..8194dbdb438 100644
--- a/mysql-test/t/ctype_utf8.test
+++ b/mysql-test/t/ctype_utf8.test
@@ -685,8 +685,10 @@ drop table t1;
SET collation_connection='utf8_general_ci';
-- source include/ctype_filesort.inc
+-- source include/ctype_like_escape.inc
SET collation_connection='utf8_bin';
-- source include/ctype_filesort.inc
+-- source include/ctype_like_escape.inc
#
# Bug #7874 CONCAT() gives wrong results mixing