Commit 1a72e219 authored by unknown's avatar unknown

Fix for BUG#8560: Set max_sort_char for any 8-bit charset with binary...

Fix for BUG#8560: Set max_sort_char for any 8-bit charset with binary collation. max_sort_char is needed by
my_like_range_simple to produce upper bound constants for LIKE "str_%" and similar expressions.


mysql-test/r/ctype_cp1251.result:
  Test for BUG#8560
mysql-test/t/ctype_cp1251.test:
  Test for BUG#8560
parent 46a8c522
......@@ -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;
......@@ -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;
......@@ -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 @@ uint my_instr_bin(CHARSET_INFO *cs __attribute__((unused)),
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,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment