summaryrefslogtreecommitdiff
path: root/mysql-test/t/heap_btree.test
diff options
context:
space:
mode:
authorunknown <ramil/ram@mysql.com/ramil.myoffice.izhnet.ru>2007-10-05 16:33:15 +0500
committerunknown <ramil/ram@mysql.com/ramil.myoffice.izhnet.ru>2007-10-05 16:33:15 +0500
commit01b3b7785b6d8cf7190594dbcee235771b9a4092 (patch)
treed198975d5c9aa6d5f23d7d347392a59ffaffd7fe /mysql-test/t/heap_btree.test
parent78348d4ed10a3a77870d956ad861c3fdcadd96a5 (diff)
downloadmariadb-git-01b3b7785b6d8cf7190594dbcee235771b9a4092.tar.gz
Fix for bug #30885: MEMORY returns incorrect data if BTREE index is used for NULL lookup
Problem: creating an rb-tree key we store length (2 bytes) before the actual data for varchar key parts. The fact was missed for NULL key parts, when we set NULL byte and skip the rest. Fix: take into account the length of the varchar key parts for NULLs. heap/hp_hash.c: Fix for bug #30885: MEMORY returns incorrect data if BTREE index is used for NULL lookup - skip varchar key parts length (2 byte) for null key parts. mysql-test/r/heap_btree.result: Fix for bug #30885: MEMORY returns incorrect data if BTREE index is used for NULL lookup -test result. mysql-test/t/heap_btree.test: Fix for bug #30885: MEMORY returns incorrect data if BTREE index is used for NULL lookup - test case.
Diffstat (limited to 'mysql-test/t/heap_btree.test')
-rw-r--r--mysql-test/t/heap_btree.test9
1 files changed, 9 insertions, 0 deletions
diff --git a/mysql-test/t/heap_btree.test b/mysql-test/t/heap_btree.test
index d5a4fb7a734..5a238fc32c8 100644
--- a/mysql-test/t/heap_btree.test
+++ b/mysql-test/t/heap_btree.test
@@ -235,5 +235,14 @@ CREATE TABLE t1 (a INT, UNIQUE USING BTREE(a)) ENGINE=MEMORY;
INSERT INTO t1 VALUES(NULL),(NULL);
DROP TABLE t1;
+#
+# Bug #30885: MEMORY returns incorrect data if BTREE index is used for NULL lookup
+#
+create table t1(a varchar(255), b varchar(255),
+ key using btree (a,b)) engine=memory;
+insert into t1 values (1, 1), (3, 3), (2, 2), (NULL, 1), (NULL, NULL), (0, 0);
+select * from t1 where a is null;
+drop table t1;
+
--echo End of 5.0 tests