diff options
author | Igor Babaev <igor@askmonty.org> | 2011-08-19 21:02:05 -0700 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2011-08-19 21:02:05 -0700 |
commit | aab970f5e16a1dbb308cfc13d47d3b863143811f (patch) | |
tree | 72806d24280d7824838d9b210fb56dae5ea4ad67 /mysql-test/t/subselect.test | |
parent | 6b70cc538b91afa31bf1d90d1c75714092cba815 (diff) | |
download | mariadb-git-aab970f5e16a1dbb308cfc13d47d3b863143811f.tar.gz |
Fixed LP bug #826279.
When the WHERE/HAVING condition of a subquery has been transformed
by the optimizer the pointer stored the 'where'/'having' field
of the SELECT_LEX structure used for the subquery must be updated
accordingly. Otherwise the pointer may refer to an invalid item.
This can lead to the reported assertion failure for some queries
with correlated subqueries
Diffstat (limited to 'mysql-test/t/subselect.test')
-rw-r--r-- | mysql-test/t/subselect.test | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index 895707597fb..6c460af6ae5 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -4590,4 +4590,30 @@ eval explain $query; DROP TABLE t1,t2; +--echo # +--echo # LP bug #826279: assertion failure with GROUP BY a result of subquery +--echo # + +CREATE TABLE t1 (a int); +INSERT INTO t1 VALUES (0), (0); + +CREATE TABLE t2 (a int, b int, c int); +INSERT INTO t2 VALUES (10,7,0), (0,7,0); + +CREATE TABLE t3 (a int, b int); +INSERT INTO t3 VALUES (10,7), (0,7); + +SELECT SUM(DISTINCT b), + (SELECT t2.a FROM t1 JOIN t2 ON t2.c != 0 + WHERE t.a != 0 AND t2.a != 0) + FROM (SELECT * FROM t3) AS t +GROUP BY 2; + +SELECT SUM(DISTINCT b), + (SELECT t2.a FROM t1,t2 WHERE t.a != 0 or 1=2 LIMIT 1) + FROM (SELECT * FROM t3) AS t +GROUP BY 2; + +DROP TABLE t1,t2,t3; + set optimizer_switch=@subselect_tmp; |