summaryrefslogtreecommitdiff
path: root/mysql-test/t/innodb_mrr_cpk.test
diff options
context:
space:
mode:
authorunknown <timour@askmonty.org>2013-01-28 15:13:39 +0200
committerunknown <timour@askmonty.org>2013-01-28 15:13:39 +0200
commitf65e5841d7c6ff0e7470d01fab27fd6b42c64c9f (patch)
tree8a7985df8c57c8c439cb44b2175444a3f8c4015c /mysql-test/t/innodb_mrr_cpk.test
parent87de27e46b889d86cd872adf8ce613128d379911 (diff)
downloadmariadb-git-f65e5841d7c6ff0e7470d01fab27fd6b42c64c9f.tar.gz
Fix for MDEV-3948, and backport of the following collection of fixes and backports
from MariaDB 10.0. The bug in mdev-3948 was an instance of the problem fixed by Sergey's patch in 10.0 - namely that the range optimizer could change table->[read | write]_set, and not restore it. revno: 3471 committer: Sergey Petrunya <psergey@askmonty.org> branch nick: 10.0-serg-fix-imerge timestamp: Sat 2012-11-03 12:24:36 +0400 message: # MDEV-3817: Wrong result with index_merge+index_merge_intersection, InnoDB table, join, AND and OR conditions Reconcile the fixes from: # # guilhem.bichot@oracle.com-20110805143029-ywrzuz15uzgontr0 # Fix for BUG#12698916 - "JOIN QUERY GIVES WRONG RESULT AT 2ND EXEC. OR # AFTER FLUSH TABLES [-INT VS NULL]" # # guilhem.bichot@oracle.com-20111209150650-tzx3ldzxe1yfwji6 # Fix for BUG#12912171 - ASSERTION FAILED: QUICK->HEAD->READ_SET == SAVE_READ_SET # and # and related fixes from: BUG#1006164, MDEV-376: Now, ROR-merged QUICK_RANGE_SELECT objects make no assumptions about the values of table->read_set and table->write_set. Each QUICK_ROR_SELECT has (and had before) its own column bitmap, but now, all QUICK_ROR_SELECT's functions that care: reset(), init_ror_merged_scan(), and get_next() will set table->read_set when invoked and restore it back to what it was before the call before they return. This allows to avoid the mess when somebody else modifies table->read_set for some reason.
Diffstat (limited to 'mysql-test/t/innodb_mrr_cpk.test')
-rw-r--r--mysql-test/t/innodb_mrr_cpk.test26
1 files changed, 26 insertions, 0 deletions
diff --git a/mysql-test/t/innodb_mrr_cpk.test b/mysql-test/t/innodb_mrr_cpk.test
index a157ddd792f..a7b2d9c0ddd 100644
--- a/mysql-test/t/innodb_mrr_cpk.test
+++ b/mysql-test/t/innodb_mrr_cpk.test
@@ -139,3 +139,29 @@ set storage_engine=@save_storage_engine;
set optimizer_switch=@innodb_mrr_cpk_tmp;
drop table t0;
+--echo #
+--echo # MDEV-3817: Wrong result with index_merge+index_merge_intersection, InnoDB table, join, AND and OR conditions
+--echo #
+
+set @tmp_mdev3817=@@optimizer_switch;
+SET optimizer_switch='index_merge=on,index_merge_intersection=on';
+
+CREATE TABLE t1 (
+ a INT PRIMARY KEY,
+ b INT,
+ c VARCHAR(1024) CHARACTER SET utf8,
+ d INT,
+ KEY (b)
+) ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES
+(1, 9, 'one', 11), (2, 6, 'two', 12), (3, 2, 'three', 13), (4, 5, 'four', 14);
+
+CREATE TABLE t2 (e INT, g INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1,9), (2,6) ;
+
+SELECT * FROM t1, t2 WHERE g = b AND ( a < 7 OR a > e );
+
+DROP TABLE t1, t2;
+set optimizer_switch=@tmp_mdev3817;
+