diff options
author | Sergei Golubchik <sergii@pisem.net> | 2012-03-28 20:25:31 +0200 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2012-03-28 20:25:31 +0200 |
commit | 867296c3edc4502093f7b706e7ac4c1670aa9515 (patch) | |
tree | afcc8157b0b71a28edbcca6b862e6ca854fc743c /mysql-test/r/subselect_sj2_jcl6.result | |
parent | 0d5adca0de0a51b1f0bd49045fc4062eac7d1d25 (diff) | |
parent | 6131d708e889cd4f93490c22bfee00d0728edfd2 (diff) | |
download | mariadb-git-867296c3edc4502093f7b706e7ac4c1670aa9515.tar.gz |
5.3 merge
Diffstat (limited to 'mysql-test/r/subselect_sj2_jcl6.result')
-rw-r--r-- | mysql-test/r/subselect_sj2_jcl6.result | 204 |
1 files changed, 199 insertions, 5 deletions
diff --git a/mysql-test/r/subselect_sj2_jcl6.result b/mysql-test/r/subselect_sj2_jcl6.result index 073f1619b91..c4c8a858b68 100644 --- a/mysql-test/r/subselect_sj2_jcl6.result +++ b/mysql-test/r/subselect_sj2_jcl6.result @@ -914,6 +914,200 @@ a b c 3 1 1 4 1 1 DROP TABLE t1,t2; +# +# BUG#962667: Assertion `0' failed in QUICK_INDEX_SORT_SELECT::need_sorted_output() +# with index_merge+index_merge_sort_union+loosescan+semijoin +# +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' ) +); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL b NULL NULL NULL 19 +1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t2 index PRIMARY,d d 9 NULL 17 Using where; Using index +2 MATERIALIZED t1 ref a a 5 test.t2.d 1 Using where; Using index +SELECT * FROM t1 WHERE b IN ( +SELECT d FROM t2, t1 +WHERE a = d AND ( pk < 2 OR d = 'z' ) +); +a b c +DROP TABLE t1, t2; +# +# BUG#951937: Wrong result (missing rows) with semijoin+materialization, IN subquery, InnoDB, TEMPTABLE view +# +CREATE TABLE t1 ( +a VARCHAR(1), +b VARCHAR(1) NOT NULL, +KEY(a) +) ENGINE=InnoDB; +INSERT INTO t1 VALUES +('j','j'),('v','v'),('c','c'),('m','m'),('d','d'), +('y','y'),('t','t'),('d','d'),('s','s'),('r','r'), +('m','m'),('b','b'),('x','x'),('g','g'),('p','p'), +('q','q'),('w','w'),('d','d'),('e','e'); +CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; +# This query returned 6 rows instead of 19 +SELECT * FROM v1 +WHERE ( a, a ) IN ( +SELECT alias2.b, alias2.a +FROM t1 AS alias1, t1 AS alias2 +WHERE alias2.b = alias1.a +AND ( alias1.b >= alias1.a OR alias2.b = 'z' ) +); +a b +b b +c c +d d +d d +d d +e e +g g +j j +m m +m m +p p +q q +r r +s s +t t +v v +w w +x x +y y +# Another testcase, without the VIEW: +CREATE TABLE t2 (a VARCHAR(1), b VARCHAR(1) NOT NULL, KEY(a)) ENGINE=InnoDB; +INSERT INTO t2 SELECT * FROM t1; +INSERT INTO t2 SELECT * FROM t1; +EXPLAIN +SELECT * FROM t2 +WHERE (a, a) IN (SELECT alias2.b, alias2.a FROM t1 AS alias1, t1 AS alias2 +WHERE +alias2.b = alias1.a AND +(alias1.b >= alias1.a OR alias2.b = 'z')); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 19 +1 PRIMARY t2 ref a a 4 test.alias1.a 1 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +2 MATERIALIZED alias1 ALL a NULL NULL NULL 19 Using where +2 MATERIALIZED alias2 ref a a 4 test.alias1.a 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +SELECT * FROM t2 +WHERE (a, a) IN (SELECT alias2.b, alias2.a FROM t1 AS alias1, t1 AS alias2 +WHERE +alias2.b = alias1.a AND +(alias1.b >= alias1.a OR alias2.b = 'z')); +a b +b b +b b +c c +c c +d d +d d +d d +d d +d d +d d +e e +e e +g g +g g +j j +j j +m m +m m +m m +m m +p p +p p +q q +q q +r r +r r +s s +s s +t t +t t +v v +v v +w w +w w +x x +x x +y y +y y +DROP VIEW v1; +DROP TABLE t1, t2; +# +# BUG#965872: Server crashes in embedding_sjm on a simple 1-table select with AND and OR +# (this is a regression caused by the fix for BUG#951937) +CREATE TABLE t1 ( a INT, b INT, c INT, d INT ); +INSERT INTO t1 VALUES (4,2,8,9),(4,2,7,8); +SELECT * FROM t1 +WHERE a = d AND ( b = 50 AND b = d OR a = c ); +a b c d +DROP TABLE t1; +# +# BUG#951283: Wrong result (missing rows) with semijoin+firstmatch, IN/ANY subquery +# +set @tmp_951283=@@optimizer_prune_level; +SET optimizer_prune_level=0; +CREATE TABLE t1 ( a INT ) ENGINE=InnoDB; +INSERT INTO t1 VALUES +(10),(11),(12),(13),(14),(15),(16), +(17),(18),(19),(20),(21),(22),(23); +CREATE TABLE t2 ( +b INT PRIMARY KEY, +c VARCHAR(1), +d VARCHAR(1), +KEY(c) +) ENGINE=InnoDB; +INSERT INTO t2 VALUES +(1,'j','j'),(2,'v','v'),(3,'c','c'),(4,'m','m'), +(5,'d','d'),(6,'d','d'),(7,'y','y'),(8,'t','t'), +(9,'d','d'),(10,'s','s'),(11,'r','r'),(12,'m','m'), +(13,'b','b'),(14,'x','x'),(15,'g','g'),(16,'p','p'), +(17,'q','q'),(18,'w','w'),(19,'d','d'); +EXPLAIN +SELECT COUNT(*) FROM t1 AS alias1, t1 AS alias2, t2 AS alias3 +WHERE alias3.d IN ( +SELECT alias4.c FROM t2 AS alias4, t2 AS alias5 +WHERE alias5.b = alias4.b +AND ( alias5.b >= alias3.b OR alias5.c != alias3.c ) +); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY alias3 ALL PRIMARY NULL NULL NULL 19 Using where +1 PRIMARY alias4 ref PRIMARY,c c 4 test.alias3.d 1 Using index +1 PRIMARY alias5 eq_ref PRIMARY PRIMARY 4 test.alias4.b 1 Using where; FirstMatch(alias3) +1 PRIMARY alias2 ALL NULL NULL NULL NULL 14 Using join buffer (flat, BNL join) +1 PRIMARY alias1 ALL NULL NULL NULL NULL 14 Using join buffer (incremental, BNL join) +SELECT COUNT(*) FROM t1 AS alias1, t1 AS alias2, t2 AS alias3 +WHERE alias3.d IN ( +SELECT alias4.c FROM t2 AS alias4, t2 AS alias5 +WHERE alias5.b = alias4.b +AND ( alias5.b >= alias3.b OR alias5.c != alias3.c ) +); +COUNT(*) +3724 +set optimizer_prune_level=@tmp_951283; +DROP TABLE t1,t2; # This must be the last in the file: set optimizer_switch=@subselect_sj2_tmp; # @@ -935,9 +1129,9 @@ SELECT t3.* FROM t1 JOIN t3 ON t3.b = t1.b WHERE c IN (SELECT t4.b FROM t4 JOIN t2); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 1 Using where -1 PRIMARY t2 ALL NULL NULL NULL NULL 1 FirstMatch(t3) +1 PRIMARY t2 ALL NULL NULL NULL NULL 1 Using join buffer (flat, BNL join) +1 PRIMARY t4 ALL NULL NULL NULL NULL 2 Using where; FirstMatch(t3); Using join buffer (incremental, BNL join) 1 PRIMARY t1 ref b b 4 test.t3.b 1 Using index -1 PRIMARY t4 ALL NULL NULL NULL NULL 2 Using where; FirstMatch(t1) SELECT t3.* FROM t1 JOIN t3 ON t3.b = t1.b WHERE c IN (SELECT t4.b FROM t4 JOIN t2); b c @@ -963,9 +1157,9 @@ EXPLAIN SELECT * FROM t1, t2 WHERE b IN (SELECT a FROM t3, t4 WHERE b = pk); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t2 ALL NULL NULL NULL NULL 1 -1 PRIMARY t4 ALL NULL NULL NULL NULL 1 Using where; FirstMatch(t2) -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -1 PRIMARY t3 eq_ref PRIMARY PRIMARY 4 test.t4.b 1 Using where; FirstMatch(t1) +1 PRIMARY t4 ALL NULL NULL NULL NULL 1 Using where +1 PRIMARY t3 eq_ref PRIMARY PRIMARY 4 test.t4.b 1 Using where; FirstMatch(t2) +1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) SELECT * FROM t1, t2 WHERE b IN (SELECT a FROM t3, t4 WHERE b = pk); pk a b 1 6 8 |