summaryrefslogtreecommitdiff
path: root/mysql-test/suite/heap/heap.test
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2013-02-15 20:25:27 +0200
committerMichael Widenius <monty@askmonty.org>2013-02-15 20:25:27 +0200
commit7042dd38c6bed80bbb7e8ac2c75e5fd689f19836 (patch)
tree58c5fcb4e6a5d16156bc863ae61a3df9f8eea2c7 /mysql-test/suite/heap/heap.test
parenta555ceb2fb75c9958e39c963ca2a83e615629711 (diff)
downloadmariadb-git-7042dd38c6bed80bbb7e8ac2c75e5fd689f19836.tar.gz
Fixed BUG#51763 Can't delete rows from MEMORY table with HASH key
mysql-test/suite/heap/heap.result: Added test case mysql-test/suite/heap/heap.test: Added test case storage/heap/hp_delete.c: Fixed that we don't change order of keys for the current key when we delete them from the hash table. Fixed that 'current_hash_ptr' is correct after heap_delete_key(). Don't "reset current_hash_ptr" on delete; This will improve time a lot for delete of rows when not all rows matches the search criteria.
Diffstat (limited to 'mysql-test/suite/heap/heap.test')
-rw-r--r--mysql-test/suite/heap/heap.test24
1 files changed, 24 insertions, 0 deletions
diff --git a/mysql-test/suite/heap/heap.test b/mysql-test/suite/heap/heap.test
index 6f5046af139..a421304d6d8 100644
--- a/mysql-test/suite/heap/heap.test
+++ b/mysql-test/suite/heap/heap.test
@@ -537,3 +537,27 @@ insert into t1 select rand(100000000) from t1;
--replace_result 40512 81024 60512 121024
select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1";
drop table t1;
+
+#
+# BUG#51763 Can't delete rows from MEMORY table with HASH key
+#
+
+CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ color enum('GREEN', 'WHITE') DEFAULT NULL,
+ ts int,
+ PRIMARY KEY (id),
+ KEY color (color) USING HASH
+) ENGINE=MEMORY DEFAULT CHARSET=utf8;
+
+INSERT INTO t1 VALUES("1","GREEN",1);
+INSERT INTO t1 VALUES("2","GREEN",1);
+INSERT INTO t1 VALUES("3","GREEN",1);
+INSERT INTO t1 VALUES("4","GREEN",1);
+INSERT INTO t1 VALUES("5","GREEN",1);
+INSERT INTO t1 VALUES("6","GREEN",1);
+DELETE FROM t1 WHERE id = 1;
+INSERT INTO t1 VALUES("7","GREEN", 2);
+DELETE FROM t1 WHERE ts = 1 AND color = 'GREEN';
+SELECT * from t1 WHERE ts = 1 AND color = 'GREEN';
+DROP TABLE t1;