mirror of
https://github.com/MariaDB/server.git
synced 2025-06-01 19:42:01 +03:00
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.
This commit is contained in:
parent
09212cc790
commit
093573b6b7
@ -84,7 +84,8 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key,
|
|||||||
pos= (byte*) record+keyseg->start;
|
pos= (byte*) record+keyseg->start;
|
||||||
if (keyseg->flag & HA_SPACE_PACK)
|
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)
|
if (type != HA_KEYTYPE_NUM)
|
||||||
{
|
{
|
||||||
while (end > pos && end[-1] == ' ')
|
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] == ' ')
|
while (pos < end && pos[0] == ' ')
|
||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
length=(uint) (end-pos);
|
char_length= (uint) (end - pos);
|
||||||
FIX_LENGTH(cs, pos, length, char_length);
|
|
||||||
store_key_length_inc(key,char_length);
|
store_key_length_inc(key,char_length);
|
||||||
memcpy((byte*) key,(byte*) pos,(size_t) char_length);
|
memcpy((byte*) key,(byte*) pos,(size_t) char_length);
|
||||||
key+=char_length;
|
key+=char_length;
|
||||||
|
@ -891,3 +891,14 @@ string
|
|||||||
create table t1 (a varchar(255)) default character set utf8;
|
create table t1 (a varchar(255)) default character set utf8;
|
||||||
insert into t1 values (1.0);
|
insert into t1 values (1.0);
|
||||||
drop table t1;
|
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;
|
create table t1 (a varchar(255)) default character set utf8;
|
||||||
insert into t1 values (1.0);
|
insert into t1 values (1.0);
|
||||||
drop table t1;
|
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;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user