summaryrefslogtreecommitdiff
path: root/mysql-test/r
diff options
context:
space:
mode:
authorSergey Petrunya <psergey@askmonty.org>2011-02-11 13:27:35 +0300
committerSergey Petrunya <psergey@askmonty.org>2011-02-11 13:27:35 +0300
commit21fdc910918caf7fa673ae51d57469ddca64b33a (patch)
treefa4b7fdfb0900a267ad1fe7e964dcddc45724fad /mysql-test/r
parent38bc3bba430dd8ea5bb3623b0ee1dd579a82fd03 (diff)
parente431f106b95d6a7fc83fbe0d4187297340293085 (diff)
downloadmariadb-git-21fdc910918caf7fa673ae51d57469ddca64b33a.tar.gz
Merge: BUG#716293: "Range checked for each record" is not used if condition refers to outside of subquery
Diffstat (limited to 'mysql-test/r')
-rw-r--r--mysql-test/r/subselect4.result20
1 files changed, 19 insertions, 1 deletions
diff --git a/mysql-test/r/subselect4.result b/mysql-test/r/subselect4.result
index 12585d490a6..e188eb5a30c 100644
--- a/mysql-test/r/subselect4.result
+++ b/mysql-test/r/subselect4.result
@@ -51,7 +51,7 @@ FROM t3 WHERE 1 = 0 GROUP BY 1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 DEPENDENT SUBQUERY t1 index NULL PRIMARY 4 NULL 2 Using index
-2 DEPENDENT SUBQUERY t2 index b b 5 NULL 2 Using where; Using index; Using join buffer (flat, BNL join)
+2 DEPENDENT SUBQUERY t2 ALL b NULL NULL NULL 2 Range checked for each record (index map: 0x2)
# should return 0 rows
SELECT
(SELECT 1 FROM t1,t2 WHERE t2.b > t3.b)
@@ -671,3 +671,21 @@ DEALLOCATE PREPARE stmt;
SET SESSION optimizer_switch = @old_optimizer_switch;
SET SESSION join_cache_level = @old_join_cache_level;
DROP TABLE t1, t2, t3;
+#
+# BUG#716293: "Range checked for each record" is not used if condition refers to outside of subquery
+#
+create table t1 (a int);
+insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t2 (a int, b int, `filler` char(200), key(a), key (b));
+insert into t2
+select A.a + 10*B.a + 100 * C.a, A.a + 10*B.a + 100 * C.a, 'filler' from t1 A, t1 B, t1 C;
+# The following must use "Range checked for each record" for table B
+explain
+select a,
+(select sum(X.a+B.b) from t1 X, t2 B where B.a=A.a or B.b=A.a)
+from t1 A;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY A ALL NULL NULL NULL NULL 10
+2 DEPENDENT SUBQUERY X ALL NULL NULL NULL NULL 10
+2 DEPENDENT SUBQUERY B ALL a,b NULL NULL NULL 1000 Range checked for each record (index map: 0x3)
+drop table t1, t2;