summaryrefslogtreecommitdiff
path: root/mysql-test/t/subselect_sj2.test
diff options
context:
space:
mode:
authorSergey Petrunya <psergey@askmonty.org>2012-03-25 18:31:35 +0400
committerSergey Petrunya <psergey@askmonty.org>2012-03-25 18:31:35 +0400
commitd0547098271fc1b52f92dbc34b6dfca405e5882a (patch)
treeb502dd128d40046b7aeafc392f8d31edb6026411 /mysql-test/t/subselect_sj2.test
parentf72e0e686b2f3688fe98685107a293de5012be03 (diff)
downloadmariadb-git-d0547098271fc1b52f92dbc34b6dfca405e5882a.tar.gz
BUG#962667: Assertion `0' failed in QUICK_INDEX_SORT_SELECT::need_sorted_output()
- The problem was that = we've picked a LooseScan that used full index scan (tab->type==JT_ALL) on certain index. = there was also a quick select (tab->quick!=NULL), that used other indexes. = some old code assumes that (tab->type==JT_ALL && tab->quick) -> means that the quick select should be used, which is not true. Fixed by discarding the quick select as soon as we know we're using LooseScan without using the quick select.
Diffstat (limited to 'mysql-test/t/subselect_sj2.test')
-rw-r--r--mysql-test/t/subselect_sj2.test38
1 files changed, 38 insertions, 0 deletions
diff --git a/mysql-test/t/subselect_sj2.test b/mysql-test/t/subselect_sj2.test
index 30dc20087d1..861ed0386d9 100644
--- a/mysql-test/t/subselect_sj2.test
+++ b/mysql-test/t/subselect_sj2.test
@@ -1090,5 +1090,43 @@ SELECT * FROM t1, t2 WHERE c IN (SELECT c FROM t1, t2 WHERE a = b);
DROP TABLE t1,t2;
+--echo #
+--echo # BUG#962667: Assertion `0' failed in QUICK_INDEX_SORT_SELECT::need_sorted_output()
+--echo # with index_merge+index_merge_sort_union+loosescan+semijoin
+--echo #
+CREATE TABLE t1 (
+ a INT, b VARCHAR(1), c INT,
+ KEY(a), KEY(b)
+) ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES
+(1,'v',9),(2,'v',8),(3,'c',7),(4,'m',6),(5,'x',5),
+(6,'i',4),(7,'e',3),(8,'p',2),(9,'s',1),(10,'j',9),
+(11,'z',8),(12,'c',7),(13,'a',6),(14,'q',5),(15,'y',4),
+(16,'n',3),(17,'r',2),(18,'v',1),(19,'p',0);
+
+CREATE TABLE t2 (
+ pk INT, d VARCHAR(1), e INT,
+ PRIMARY KEY(pk), KEY(d,e)
+) ENGINE=InnoDB;
+
+INSERT INTO t2 VALUES
+(1,'x',1),(2,'d',2),(3,'r',3),(4,'f',4),(5,'y',5),
+(6,'u',6),(7,'m',7),(8,'k',8),(9,'o',9),(10,'w',1),
+(11,'m',2),(12,'q',3),(13,'m',4),(14,'d',5),
+(15,'g',6),(16,'x',7),(17,'f',8);
+
+explain
+SELECT * FROM t1 WHERE b IN (
+ SELECT d FROM t2, t1
+ WHERE a = d AND ( pk < 2 OR d = 'z' )
+);
+SELECT * FROM t1 WHERE b IN (
+ SELECT d FROM t2, t1
+ WHERE a = d AND ( pk < 2 OR d = 'z' )
+);
+
+DROP TABLE t1, t2;
+
--echo # This must be the last in the file:
set optimizer_switch=@subselect_sj2_tmp;