summaryrefslogtreecommitdiff
path: root/mysql-test/suite/heap
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2012-09-10 16:46:33 +0300
committerMichael Widenius <monty@askmonty.org>2012-09-10 16:46:33 +0300
commit1539f91267a8ca11b137444a4cb87c61febfb05c (patch)
treeac292658ad82cfd53891f8fdd0f7a2f209a62c4f /mysql-test/suite/heap
parent7fbd2de8b8bba2ed27bebbdba99ed4f345b83fa5 (diff)
downloadmariadb-git-1539f91267a8ca11b137444a4cb87c61febfb05c.tar.gz
Fixed Bug#1002564: Wrong result for a lookup query from a heap table
mysql-test/suite/heap/heap_hash.result: Added test case mysql-test/suite/heap/heap_hash.test: Added test case storage/heap/hp_hash.c: Limit key data length to max key length
Diffstat (limited to 'mysql-test/suite/heap')
-rw-r--r--mysql-test/suite/heap/heap_hash.result19
-rw-r--r--mysql-test/suite/heap/heap_hash.test13
2 files changed, 32 insertions, 0 deletions
diff --git a/mysql-test/suite/heap/heap_hash.result b/mysql-test/suite/heap/heap_hash.result
index 453bfc0c165..ac62427c81c 100644
--- a/mysql-test/suite/heap/heap_hash.result
+++ b/mysql-test/suite/heap/heap_hash.result
@@ -427,4 +427,23 @@ INDEX(col_int_key) USING HASH) ENGINE = HEAP;
INSERT INTO t1 (col_int_nokey, col_int_key) VALUES (3, 0), (4, 0), (3, 1);
DELETE FROM t1 WHERE col_int_nokey = 5 ORDER BY col_int_key LIMIT 2;
DROP TABLE t1;
+#
+# Bug #1002564: Wrong result for a lookup query from a heap table
+#
+CREATE TABLE t1 (c1 VARCHAR(10) NOT NULL, KEY i1 (c1(3))) ENGINE=MEMORY DEFAULT CHARSET=latin1;
+INSERT INTO t1 VALUES ('foo1'), ('bar2'), ('baz3');
+explain SELECT * FROM t1 WHERE c1='bar2';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref i1 i1 5 const 2 Using where
+SELECT * FROM t1 WHERE c1='bar2';
+c1
+bar2
+ALTER TABLE t1 DROP KEY i1, ADD KEY il (c1(3)) using btree;
+explain SELECT * FROM t1 WHERE c1='bar2';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref il il 5 const 1 Using where
+SELECT * FROM t1 WHERE c1='bar2';
+c1
+bar2
+DROP TABLE t1;
End of 5.5 tests
diff --git a/mysql-test/suite/heap/heap_hash.test b/mysql-test/suite/heap/heap_hash.test
index 80ae01e9547..80d6ef9c8f2 100644
--- a/mysql-test/suite/heap/heap_hash.test
+++ b/mysql-test/suite/heap/heap_hash.test
@@ -316,4 +316,17 @@ DELETE FROM t1 WHERE col_int_nokey = 5 ORDER BY col_int_key LIMIT 2;
DROP TABLE t1;
+--echo #
+--echo # Bug #1002564: Wrong result for a lookup query from a heap table
+--echo #
+
+CREATE TABLE t1 (c1 VARCHAR(10) NOT NULL, KEY i1 (c1(3))) ENGINE=MEMORY DEFAULT CHARSET=latin1;
+INSERT INTO t1 VALUES ('foo1'), ('bar2'), ('baz3');
+explain SELECT * FROM t1 WHERE c1='bar2';
+SELECT * FROM t1 WHERE c1='bar2';
+ALTER TABLE t1 DROP KEY i1, ADD KEY il (c1(3)) using btree;
+explain SELECT * FROM t1 WHERE c1='bar2';
+SELECT * FROM t1 WHERE c1='bar2';
+DROP TABLE t1;
+
--echo End of 5.5 tests