Commit 6fb94c3e authored by Sergei Petrunia's avatar Sergei Petrunia

MDEV-11320: MariaRocks: rocksdb.type_text_indexes fails

Backport the fix for BUG#81810 from facebook/mysql-5.6 tree.
Added the original testcase.

rocksdb.type_text_indexes still fails due to another problem.
parent 3876f461
......@@ -719,3 +719,38 @@ DROP FUNCTION getText;
DROP DATABASE test1;
USE test;
SET NAMES latin1;
#
# MDEV-11320, MySQL BUG#81810: Inconsistent sort order for blob/text between InnoDB and filesort
#
CREATE TABLE t1 (
b LONGTEXT CHARACTER SET "latin1" COLLATE "latin1_bin",
KEY b (b(32))
);
INSERT INTO t1 (b) VALUES ('a'), (_binary 0x1), (_binary 0x0), ('');
drop table t1;
CREATE TABLE t1 (
b LONGTEXT CHARACTER SET "latin1" COLLATE "latin1_bin",
PRIMARY KEY b (b(32))
);
INSERT INTO t1 (b) VALUES ('a'), (_binary 0x1), (_binary 0x0), ('');
explain
select hex(b) from t1 force index (PRIMARY) where b<'zzz';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range PRIMARY PRIMARY 34 NULL 4 Using where
select hex(b) from t1 force index (PRIMARY) where b<'zzz';
hex(b)
00
01
61
explain
select hex(b) from t1 where b<'zzz' order by b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 4 Using where; Using filesort
select hex(b) from t1 where b<'zzz' order by b;
hex(b)
00
01
61
drop table t1;
......@@ -1108,8 +1108,8 @@ length(c1) c1
0
SELECT DISTINCT length(c1), c1 FROM t1 ORDER BY c1;
length(c1) c1
0
2 A
0
2 B
DROP TABLE t1;
End of 4.1 tests
......
......@@ -308,3 +308,34 @@ DROP FUNCTION getText;
DROP DATABASE test1;
USE test;
SET NAMES latin1;
--echo #
--echo # MDEV-11320, MySQL BUG#81810: Inconsistent sort order for blob/text between InnoDB and filesort
--echo #
CREATE TABLE t1 (
b LONGTEXT CHARACTER SET "latin1" COLLATE "latin1_bin",
KEY b (b(32))
);
INSERT INTO t1 (b) VALUES ('a'), (_binary 0x1), (_binary 0x0), ('');
drop table t1;
CREATE TABLE t1 (
b LONGTEXT CHARACTER SET "latin1" COLLATE "latin1_bin",
PRIMARY KEY b (b(32))
);
INSERT INTO t1 (b) VALUES ('a'), (_binary 0x1), (_binary 0x0), ('');
explain
select hex(b) from t1 force index (PRIMARY) where b<'zzz';
select hex(b) from t1 force index (PRIMARY) where b<'zzz';
explain
select hex(b) from t1 where b<'zzz' order by b;
select hex(b) from t1 where b<'zzz' order by b;
drop table t1;
......@@ -8259,7 +8259,7 @@ void Field_blob::sort_string(uchar *to,uint length)
uchar *blob;
uint blob_length=get_length();
if (!blob_length)
if (!blob_length && field_charset->pad_char == 0)
bzero(to,length);
else
{
......
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