Commit f928e0b0 authored by Alexander Nozdrin's avatar Alexander Nozdrin

Auto-merge from mysql-trunk-merge.

parents 547269cf d2f61748
...@@ -4873,4 +4873,17 @@ SELECT 1 FROM t1 GROUP BY ...@@ -4873,4 +4873,17 @@ SELECT 1 FROM t1 GROUP BY
1 1
1 1
DROP TABLE t1; 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. End of 5.1 tests.
...@@ -3805,4 +3805,19 @@ SELECT 1 FROM t1 GROUP BY ...@@ -3805,4 +3805,19 @@ SELECT 1 FROM t1 GROUP BY
(SELECT LAST_INSERT_ID() FROM t1 ORDER BY MIN(a) ASC LIMIT 1); (SELECT LAST_INSERT_ID() FROM t1 ORDER BY MIN(a) ASC LIMIT 1);
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # Bug #49512 : subquery with aggregate function crash
--echo # subselect_single_select_engine::exec()
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES();
--echo # should not crash
SELECT 1 FROM t1 WHERE a <> SOME
(
SELECT MAX((SELECT a FROM t1 LIMIT 1)) AS d
FROM t1,t1 a
);
DROP TABLE t1;
--echo End of 5.1 tests. --echo End of 5.1 tests.
...@@ -945,6 +945,7 @@ JOIN::optimize() ...@@ -945,6 +945,7 @@ JOIN::optimize()
DBUG_PRINT("info",("Select tables optimized away")); DBUG_PRINT("info",("Select tables optimized away"));
zero_result_cause= "Select tables optimized away"; zero_result_cause= "Select tables optimized away";
tables_list= 0; // All tables resolved tables_list= 0; // All tables resolved
const_tables= tables;
/* /*
Extract all table-independent conditions and replace the WHERE Extract all table-independent conditions and replace the WHERE
clause with them. All other conditions were computed by opt_sum_query clause with them. All other conditions were computed by opt_sum_query
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment