summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/r/ctype_cp1251.result16
-rw-r--r--mysql-test/t/ctype_cp1251.test14
-rw-r--r--strings/ctype-bin.c9
3 files changed, 38 insertions, 1 deletions
diff --git a/mysql-test/r/ctype_cp1251.result b/mysql-test/r/ctype_cp1251.result
index 3793e962d40..647f8c6236c 100644
--- a/mysql-test/r/ctype_cp1251.result
+++ b/mysql-test/r/ctype_cp1251.result
@@ -54,3 +54,19 @@ select collation(a), collation(b), collation(binary 'ccc') from t1 limit 1;
collation(a) collation(b) collation(binary 'ccc')
cp1251_bin binary binary
drop table t1;
+create table t1 (
+a varchar(16) character set cp1251 collate cp1251_bin not null,
+b int(10) default null,
+primary key(a)
+) charset=cp1251;
+insert into t1 (a) values ('air'),
+('we'),('g'),('we_toshko'), ('s0urce'),('we_ivo'),('we_iliyan'),
+('we_martin'),('vw_grado'),('vw_vasko'),('tn_vili'),('tn_kalina'),
+('tn_fakira'),('vw_silvia'),('vw_starshi'),('vw_geo'),('vw_b0x1');
+select * from t1 where a like 'we_%';
+a b
+we_iliyan NULL
+we_ivo NULL
+we_martin NULL
+we_toshko NULL
+drop table t1;
diff --git a/mysql-test/t/ctype_cp1251.test b/mysql-test/t/ctype_cp1251.test
index 66a8a5aa909..2d670ec3607 100644
--- a/mysql-test/t/ctype_cp1251.test
+++ b/mysql-test/t/ctype_cp1251.test
@@ -32,3 +32,17 @@ select * from t1 where lower(b)='bbb';
select charset(a), charset(b), charset(binary 'ccc') from t1 limit 1;
select collation(a), collation(b), collation(binary 'ccc') from t1 limit 1;
drop table t1;
+
+# Test for BUG#8560
+create table t1 (
+ a varchar(16) character set cp1251 collate cp1251_bin not null,
+ b int(10) default null,
+ primary key(a)
+) charset=cp1251;
+insert into t1 (a) values ('air'),
+ ('we'),('g'),('we_toshko'), ('s0urce'),('we_ivo'),('we_iliyan'),
+ ('we_martin'),('vw_grado'),('vw_vasko'),('tn_vili'),('tn_kalina'),
+ ('tn_fakira'),('vw_silvia'),('vw_starshi'),('vw_geo'),('vw_b0x1');
+
+select * from t1 where a like 'we_%';
+drop table t1;
diff --git a/strings/ctype-bin.c b/strings/ctype-bin.c
index 618879607ec..425985e6bc1 100644
--- a/strings/ctype-bin.c
+++ b/strings/ctype-bin.c
@@ -67,6 +67,13 @@ static uchar bin_char_array[] =
};
+static my_bool
+my_coll_init_8bit_bin(CHARSET_INFO *cs,
+ void *(*alloc)(uint) __attribute__((unused)))
+{
+ cs->max_sort_char=255;
+ return FALSE;
+}
static int my_strnncoll_binary(CHARSET_INFO * cs __attribute__((unused)),
const uchar *s, uint slen,
@@ -428,7 +435,7 @@ skip:
MY_COLLATION_HANDLER my_collation_8bit_bin_handler =
{
- NULL, /* init */
+ my_coll_init_8bit_bin,
my_strnncoll_8bit_bin,
my_strnncollsp_8bit_bin,
my_strnxfrm_8bit_bin,