Commit c9914ac6 authored by unknown's avatar unknown

Bug#10253: compound index length and utf8 char set

produces invalid query results

mi_key.c:
  well_formed_length should be executed before space trimming, not after.
ctype_utf8.test:
ctype_utf8.result:
  adding test.


myisam/mi_key.c:
  Bug#10253: ompound index length and utf8 char set produces invalid query results
  well_formed_length should be executed before space trimming, not after.
mysql-test/r/ctype_utf8.result:
  adding test.
  adding test.
mysql-test/t/ctype_utf8.test:
  adding test.
parent e3dc3db6
......@@ -84,7 +84,8 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key,
pos= (byte*) record+keyseg->start;
if (keyseg->flag & HA_SPACE_PACK)
{
end=pos+length;
FIX_LENGTH(cs, pos, length, char_length);
end= pos + char_length;
if (type != HA_KEYTYPE_NUM)
{
while (end > pos && end[-1] == ' ')
......@@ -95,8 +96,7 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key,
while (pos < end && pos[0] == ' ')
pos++;
}
length=(uint) (end-pos);
FIX_LENGTH(cs, pos, length, char_length);
char_length= (uint) (end - pos);
store_key_length_inc(key,char_length);
memcpy((byte*) key,(byte*) pos,(size_t) char_length);
key+=char_length;
......
......@@ -891,3 +891,14 @@ string
create table t1 (a varchar(255)) default character set utf8;
insert into t1 values (1.0);
drop table t1;
create table t1 (
id int not null,
city varchar(20) not null,
key (city(7),id)
) character set=utf8;
insert into t1 values (1,'Durban North');
insert into t1 values (2,'Durban');
select * from t1 where city = 'Durban';
id city
2 Durban
drop table t1;
......@@ -731,3 +731,17 @@ select ifnull(NULL, _utf8'string');
create table t1 (a varchar(255)) default character set utf8;
insert into t1 values (1.0);
drop table t1;
#
# Bug#10253 compound index length and utf8 char set
# produces invalid query results
#
create table t1 (
id int not null,
city varchar(20) not null,
key (city(7),id)
) character set=utf8;
insert into t1 values (1,'Durban North');
insert into t1 values (2,'Durban');
select * from t1 where city = 'Durban';
drop table t1;
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