summaryrefslogtreecommitdiff
path: root/mysql-test/r/subselect.result
diff options
context:
space:
mode:
authorGeorgi Kodinov <joro@sun.com>2009-12-23 17:11:22 +0200
committerGeorgi Kodinov <joro@sun.com>2009-12-23 17:11:22 +0200
commitc968fd4818ddb4c72316a4f1b70f8755367aad7d (patch)
tree6ce703361253e286fb526ef5923033cf754fb8f5 /mysql-test/r/subselect.result
parentf79e182a9c15b2b26d3bd49af9d688b22fe4cb5a (diff)
downloadmariadb-git-c968fd4818ddb4c72316a4f1b70f8755367aad7d.tar.gz
Bug #49512 : subquery with aggregate function crash
subselect_single_select_engine::exec() When a subquery doesn't need to be evaluated because it returns only aggregate functions and these aggregates can be calculated from the metadata about the table it was not updating all the relevant members of the JOIN structure to reflect that this is a constant query. This caused problems to the enclosing subquery ('<> SOME' in the test case above) trying to read some data about the tables. Fixed by setting const_tables to the number of tables when the SELECT is optimized away.
Diffstat (limited to 'mysql-test/r/subselect.result')
-rw-r--r--mysql-test/r/subselect.result13
1 files changed, 13 insertions, 0 deletions
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index f446d8feec3..dc3cff68731 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -4602,4 +4602,17 @@ SELECT 1 FROM t1 GROUP BY
1
1
DROP TABLE t1;
+#
+# Bug #49512 : subquery with aggregate function crash
+# subselect_single_select_engine::exec()
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUES();
+# should not crash
+SELECT 1 FROM t1 WHERE a <> SOME
+(
+SELECT MAX((SELECT a FROM t1 LIMIT 1)) AS d
+FROM t1,t1 a
+);
+1
+DROP TABLE t1;
End of 5.1 tests.