Commit f9e48efb authored by Mattias Jonsson's avatar Mattias Jonsson

Recommit of patch for bug#49028 for 5.1.

Includes both patch from bug#48737 (without test,
which should go to next-mr) and test for
bug#49028.
parent f0ef4105
...@@ -116,6 +116,26 @@ select binary 'a a' > 'a', binary 'a \0' > 'a', binary 'a\0' > 'a'; ...@@ -116,6 +116,26 @@ select binary 'a a' > 'a', binary 'a \0' > 'a', binary 'a\0' > 'a';
binary 'a a' > 'a' binary 'a \0' > 'a' binary 'a\0' > 'a' binary 'a a' > 'a' binary 'a \0' > 'a' binary 'a\0' > 'a'
1 1 1 1 1 1
SET CHARACTER SET koi8r; SET CHARACTER SET koi8r;
create table t1 (a varchar(2) character set ucs2 collate ucs2_bin, key(a));
insert into t1 values ('A'),('A'),('B'),('C'),('D'),('A\t');
insert into t1 values ('A\0'),('A\0'),('A\0'),('A\0'),('AZ');
select hex(a) from t1 where a like 'A_' order by a;
hex(a)
00410000
00410000
00410000
00410000
00410009
0041005A
select hex(a) from t1 ignore key(a) where a like 'A_' order by a;
hex(a)
00410000
00410000
00410000
00410000
00410009
0041005A
drop table t1;
CREATE TABLE t1 (word VARCHAR(64) CHARACTER SET ucs2, word2 CHAR(64) CHARACTER SET ucs2); CREATE TABLE t1 (word VARCHAR(64) CHARACTER SET ucs2, word2 CHAR(64) CHARACTER SET ucs2);
INSERT INTO t1 VALUES (_koi8r'',_koi8r''), (X'2004',X'2004'); INSERT INTO t1 VALUES (_koi8r'',_koi8r''), (X'2004',X'2004');
SELECT hex(word) FROM t1 ORDER BY word; SELECT hex(word) FROM t1 ORDER BY word;
......
...@@ -14,6 +14,16 @@ SET character_set_connection=ucs2; ...@@ -14,6 +14,16 @@ SET character_set_connection=ucs2;
SET CHARACTER SET koi8r; SET CHARACTER SET koi8r;
#
# BUG#49028, error in LIKE with ucs2
#
create table t1 (a varchar(2) character set ucs2 collate ucs2_bin, key(a));
insert into t1 values ('A'),('A'),('B'),('C'),('D'),('A\t');
insert into t1 values ('A\0'),('A\0'),('A\0'),('A\0'),('AZ');
select hex(a) from t1 where a like 'A_' order by a;
select hex(a) from t1 ignore key(a) where a like 'A_' order by a;
drop table t1;
# #
# Check that 0x20 is only trimmed when it is # Check that 0x20 is only trimmed when it is
# a part of real SPACE character, not just a part # a part of real SPACE character, not just a part
......
...@@ -1602,16 +1602,6 @@ my_bool my_like_range_ucs2(CHARSET_INFO *cs, ...@@ -1602,16 +1602,6 @@ my_bool my_like_range_ucs2(CHARSET_INFO *cs,
*min_str++= *max_str++ = ptr[1]; *min_str++= *max_str++ = ptr[1];
} }
/* Temporary fix for handling w_one at end of string (key compression) */
{
char *tmp;
for (tmp= min_str ; tmp-1 > min_org && tmp[-1] == '\0' && tmp[-2]=='\0';)
{
*--tmp=' ';
*--tmp='\0';
}
}
*min_length= *max_length = (size_t) (min_str - min_org); *min_length= *max_length = (size_t) (min_str - min_org);
while (min_str + 1 < min_end) while (min_str + 1 < min_end)
{ {
......
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