diff options
author | unknown <sergefp@mysql.com> | 2007-07-13 19:13:40 +0400 |
---|---|---|
committer | unknown <sergefp@mysql.com> | 2007-07-13 19:13:40 +0400 |
commit | 38f4c6137a64192a962ad9d357055ced0f9150fa (patch) | |
tree | 43caf9fae0d0688c4a442074f90b0e358be91ea5 /mysql-test/t/index_merge.test | |
parent | db84ffa351e43f431eb944200d8e96f8226b84d2 (diff) | |
download | mariadb-git-38f4c6137a64192a962ad9d357055ced0f9150fa.tar.gz |
BUG#29740: Wrong query results for index_merge/union over HEAP table.
- return HA_KEY_SCAN_NOT_ROR flag for HASH indexes;
- Fix ha_heap::cmp_ref() to work with BTREE index scans.
mysql-test/r/index_merge.result:
BUG#29740: testcase
mysql-test/t/index_merge.test:
BUG#29740: testcase
sql/ha_heap.h:
BUG#29740: Wrong query results for index_merge/union over HEAP table.
- make HEAP table engine return HA_KEY_SCAN_NOT_ROR flag for HASH
indexes,as HASH index does not guarantee any ordering for rows
within the hash bucket.
- Fix BTREE indexes: make ha_heap::cmp_ref() compare the rowids in the
same way as ha_key_cmp() does.
sql/opt_range.cc:
BUG#29740: Fix comment about ROR scans.
Diffstat (limited to 'mysql-test/t/index_merge.test')
-rw-r--r-- | mysql-test/t/index_merge.test | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/mysql-test/t/index_merge.test b/mysql-test/t/index_merge.test index 30eb0b40fca..7d9a4340b0f 100644 --- a/mysql-test/t/index_merge.test +++ b/mysql-test/t/index_merge.test @@ -415,3 +415,46 @@ INSERT INTO t2(a,b) VALUES(1,2); SELECT t2.a FROM t1,t2 WHERE t2.b=2 AND t2.a=1; UNLOCK TABLES; DROP TABLE t1, t2; + +# +# BUG#29740: HA_KEY_SCAN_NOT_ROR wasn't set for HEAP engine +# +CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `filler` char(200) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + KEY `a` (`a`), + KEY `b` (`b`) +) ENGINE=MEMORY DEFAULT CHARSET=latin1; + +insert into t1 values +(0, 'filler', 0), (1, 'filler', 1), (2, 'filler', 2), (3, 'filler', 3), +(4, 'filler', 4), (5, 'filler', 5), (6, 'filler', 6), (7, 'filler', 7), +(8, 'filler', 8), (9, 'filler', 9), (0, 'filler', 0), (1, 'filler', 1), +(2, 'filler', 2), (3, 'filler', 3), (4, 'filler', 4), (5, 'filler', 5), +(6, 'filler', 6), (7, 'filler', 7), (8, 'filler', 8), (9, 'filler', 9), +(10, 'filler', 10), (11, 'filler', 11), (12, 'filler', 12), (13, 'filler', 13), +(14, 'filler', 14), (15, 'filler', 15), (16, 'filler', 16), (17, 'filler', 17), +(18, 'filler', 18), (19, 'filler', 19), (4, '5 ', 0), (5, '4 ', 0), +(4, '4 ', 0), (4, 'qq ', 5), (5, 'qq ', 4), (4, 'zz ', 4); + +create table t2( + `a` int(11) DEFAULT NULL, + `filler` char(200) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + KEY USING BTREE (`a`), + KEY USING BTREE (`b`) +) ENGINE=MEMORY DEFAULT CHARSET=latin1; +insert into t2 select * from t1; + +--echo must use sort-union rather than union: +explain select * from t1 where a=4 or b=4; +select * from t1 where a=4 or b=4; +select * from t1 ignore index(a,b) where a=4 or b=4; + +--echo must use union, not sort-union: +explain select * from t2 where a=4 or b=4; +select * from t2 where a=4 or b=4; + +drop table t1, t2; + |