Commit 7c7e4f6d authored by Sergey Petrunya's avatar Sergey Petrunya

BUG#623300: Query with join_cache_level = 6 returns extra rows in maria-5.3-dsmrr-cpk

- Testcase (the bug itself was fixed by development on BKA side)
parent 1c7c67d5
...@@ -433,3 +433,97 @@ col_varchar_key ...@@ -433,3 +433,97 @@ col_varchar_key
DROP TABLE t1; DROP TABLE t1;
set join_cache_level=@save_join_cache_level; set join_cache_level=@save_join_cache_level;
set optimizer_switch=@save_optimizer_switch; set optimizer_switch=@save_optimizer_switch;
#
# BUG#623300: Query with join_cache_level = 6 returns extra rows in maria-5.3-dsmrr-cpk
#
CREATE TABLE t1 (
pk int(11) NOT NULL AUTO_INCREMENT,
col_int_nokey int(11) DEFAULT NULL,
PRIMARY KEY (pk)
) ENGINE=InnoDB;
INSERT INTO t1 VALUES (10,7);
INSERT INTO t1 VALUES (11,1);
INSERT INTO t1 VALUES (12,5);
INSERT INTO t1 VALUES (13,3);
INSERT INTO t1 VALUES (14,6);
INSERT INTO t1 VALUES (15,92);
INSERT INTO t1 VALUES (16,7);
INSERT INTO t1 VALUES (17,NULL);
INSERT INTO t1 VALUES (18,3);
INSERT INTO t1 VALUES (19,5);
INSERT INTO t1 VALUES (20,1);
INSERT INTO t1 VALUES (21,2);
INSERT INTO t1 VALUES (22,NULL);
INSERT INTO t1 VALUES (23,1);
INSERT INTO t1 VALUES (24,0);
INSERT INTO t1 VALUES (25,210);
INSERT INTO t1 VALUES (26,8);
INSERT INTO t1 VALUES (27,7);
INSERT INTO t1 VALUES (28,5);
INSERT INTO t1 VALUES (29,NULL);
CREATE TABLE t2 (
pk int(11) NOT NULL AUTO_INCREMENT,
col_int_nokey int(11) DEFAULT NULL,
PRIMARY KEY (pk)
) ENGINE=InnoDB;
INSERT INTO t2 VALUES (1,NULL);
INSERT INTO t2 VALUES (2,7);
INSERT INTO t2 VALUES (3,9);
INSERT INTO t2 VALUES (4,7);
INSERT INTO t2 VALUES (5,4);
INSERT INTO t2 VALUES (6,2);
INSERT INTO t2 VALUES (7,6);
INSERT INTO t2 VALUES (8,8);
INSERT INTO t2 VALUES (9,NULL);
INSERT INTO t2 VALUES (10,5);
INSERT INTO t2 VALUES (11,NULL);
INSERT INTO t2 VALUES (12,6);
INSERT INTO t2 VALUES (13,188);
INSERT INTO t2 VALUES (14,2);
INSERT INTO t2 VALUES (15,1);
INSERT INTO t2 VALUES (16,1);
INSERT INTO t2 VALUES (17,0);
INSERT INTO t2 VALUES (18,9);
INSERT INTO t2 VALUES (19,NULL);
INSERT INTO t2 VALUES (20,4);
set @my_save_join_cache_level= @@join_cache_level;
SET join_cache_level = 0;
SELECT table2.col_int_nokey
FROM t1 table1 JOIN t2 table2 ON table2.pk = table1.col_int_nokey
WHERE table1.pk ;
col_int_nokey
2
4
4
4
6
6
6
7
8
9
9
NULL
NULL
NULL
SET join_cache_level = 6;
SELECT table2.col_int_nokey
FROM t1 table1 JOIN t2 table2 ON table2.pk = table1.col_int_nokey
WHERE table1.pk ;
col_int_nokey
2
4
4
4
6
6
6
7
8
9
9
NULL
NULL
NULL
set join_cache_level= @my_save_join_cache_level;
drop table t1, t2;
...@@ -154,3 +154,78 @@ DROP TABLE t1; ...@@ -154,3 +154,78 @@ DROP TABLE t1;
set join_cache_level=@save_join_cache_level; set join_cache_level=@save_join_cache_level;
set optimizer_switch=@save_optimizer_switch; set optimizer_switch=@save_optimizer_switch;
--echo #
--echo # BUG#623300: Query with join_cache_level = 6 returns extra rows in maria-5.3-dsmrr-cpk
--echo #
CREATE TABLE t1 (
pk int(11) NOT NULL AUTO_INCREMENT,
col_int_nokey int(11) DEFAULT NULL,
PRIMARY KEY (pk)
) ENGINE=InnoDB;
INSERT INTO t1 VALUES (10,7);
INSERT INTO t1 VALUES (11,1);
INSERT INTO t1 VALUES (12,5);
INSERT INTO t1 VALUES (13,3);
INSERT INTO t1 VALUES (14,6);
INSERT INTO t1 VALUES (15,92);
INSERT INTO t1 VALUES (16,7);
INSERT INTO t1 VALUES (17,NULL);
INSERT INTO t1 VALUES (18,3);
INSERT INTO t1 VALUES (19,5);
INSERT INTO t1 VALUES (20,1);
INSERT INTO t1 VALUES (21,2);
INSERT INTO t1 VALUES (22,NULL);
INSERT INTO t1 VALUES (23,1);
INSERT INTO t1 VALUES (24,0);
INSERT INTO t1 VALUES (25,210);
INSERT INTO t1 VALUES (26,8);
INSERT INTO t1 VALUES (27,7);
INSERT INTO t1 VALUES (28,5);
INSERT INTO t1 VALUES (29,NULL);
CREATE TABLE t2 (
pk int(11) NOT NULL AUTO_INCREMENT,
col_int_nokey int(11) DEFAULT NULL,
PRIMARY KEY (pk)
) ENGINE=InnoDB;
INSERT INTO t2 VALUES (1,NULL);
INSERT INTO t2 VALUES (2,7);
INSERT INTO t2 VALUES (3,9);
INSERT INTO t2 VALUES (4,7);
INSERT INTO t2 VALUES (5,4);
INSERT INTO t2 VALUES (6,2);
INSERT INTO t2 VALUES (7,6);
INSERT INTO t2 VALUES (8,8);
INSERT INTO t2 VALUES (9,NULL);
INSERT INTO t2 VALUES (10,5);
INSERT INTO t2 VALUES (11,NULL);
INSERT INTO t2 VALUES (12,6);
INSERT INTO t2 VALUES (13,188);
INSERT INTO t2 VALUES (14,2);
INSERT INTO t2 VALUES (15,1);
INSERT INTO t2 VALUES (16,1);
INSERT INTO t2 VALUES (17,0);
INSERT INTO t2 VALUES (18,9);
INSERT INTO t2 VALUES (19,NULL);
INSERT INTO t2 VALUES (20,4);
set @my_save_join_cache_level= @@join_cache_level;
SET join_cache_level = 0;
--sorted_result
SELECT table2.col_int_nokey
FROM t1 table1 JOIN t2 table2 ON table2.pk = table1.col_int_nokey
WHERE table1.pk ;
SET join_cache_level = 6;
--sorted_result
SELECT table2.col_int_nokey
FROM t1 table1 JOIN t2 table2 ON table2.pk = table1.col_int_nokey
WHERE table1.pk ;
set join_cache_level= @my_save_join_cache_level;
drop table t1, t2;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment