summaryrefslogtreecommitdiff
path: root/mysql-test/r/func_group.result
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2011-12-27 19:13:53 -0800
committerIgor Babaev <igor@askmonty.org>2011-12-27 19:13:53 -0800
commit31805e621495e33d4dcf4e4b2180d42367f90894 (patch)
tree5cfb63dd4e1e319ec7dddac026d63e383958a321 /mysql-test/r/func_group.result
parentc9259f166bfcc757338c957f806e3d18637da17a (diff)
downloadmariadb-git-31805e621495e33d4dcf4e4b2180d42367f90894.tar.gz
Fixed LP bug #879860.
The MIN/MAX optimization cannot be applied to a subquery if its WHERE clause contains a conjunctive condition depending on an outer reference.
Diffstat (limited to 'mysql-test/r/func_group.result')
-rw-r--r--mysql-test/r/func_group.result23
1 files changed, 23 insertions, 0 deletions
diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result
index de5672941c7..3608f587572 100644
--- a/mysql-test/r/func_group.result
+++ b/mysql-test/r/func_group.result
@@ -1805,4 +1805,27 @@ MAX(a)
NULL
DROP TABLE t1,t2;
#
+# Bug #879860: MIN/MAX for subquery returning empty set
+#
+CREATE TABLE t1 (a int PRIMARY KEY);
+INSERT INTO t1 VALUES (1);
+CREATE TABLE t2 (a int NOT NULL);
+INSERT INTO t2 VALUES (10);
+CREATE TABLE t3 ( a int, b int);
+INSERT INTO t3 VALUES (19,1), (20,5);
+EXPLAIN EXTENDED
+SELECT (SELECT MIN(t1.a) FROM t1,t2 WHERE t2.a = t3.b) FROM t3;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t3 ALL NULL NULL NULL NULL 2 100.00
+2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 1 100.00
+2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 1 100.00
+Warnings:
+Note 1276 Field or reference 'test.t3.b' of SELECT #2 was resolved in SELECT #1
+Note 1003 select (select min('1') from `test`.`t1` join `test`.`t2` where ('10' = `test`.`t3`.`b`)) AS `(SELECT MIN(t1.a) FROM t1,t2 WHERE t2.a = t3.b)` from `test`.`t3`
+SELECT (SELECT MIN(t1.a) FROM t1,t2 WHERE t2.a = t3.b) FROM t3;
+(SELECT MIN(t1.a) FROM t1,t2 WHERE t2.a = t3.b)
+NULL
+NULL
+DROP TABLE t1,t2,t3;
+#
End of 5.2 tests