summaryrefslogtreecommitdiff
path: root/mysql-test/r/subselect_no_semijoin.result
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2011-08-19 21:02:05 -0700
committerIgor Babaev <igor@askmonty.org>2011-08-19 21:02:05 -0700
commitaab970f5e16a1dbb308cfc13d47d3b863143811f (patch)
tree72806d24280d7824838d9b210fb56dae5ea4ad67 /mysql-test/r/subselect_no_semijoin.result
parent6b70cc538b91afa31bf1d90d1c75714092cba815 (diff)
downloadmariadb-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/r/subselect_no_semijoin.result')
-rw-r--r--mysql-test/r/subselect_no_semijoin.result25
1 files changed, 25 insertions, 0 deletions
diff --git a/mysql-test/r/subselect_no_semijoin.result b/mysql-test/r/subselect_no_semijoin.result
index 1feaee69bc1..17a4c16531d 100644
--- a/mysql-test/r/subselect_no_semijoin.result
+++ b/mysql-test/r/subselect_no_semijoin.result
@@ -5339,5 +5339,30 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY table2 index NULL f1_key 4 NULL 10 Using where; Using index; Using join buffer (flat, BNL join)
2 DEPENDENT SUBQUERY t2 range f1_key f1_key 4 NULL 6 Range checked for each record (index map: 0x1); Using temporary
DROP TABLE t1,t2;
+#
+# LP bug #826279: assertion failure with GROUP BY a result of subquery
+#
+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;
+SUM(DISTINCT b) (SELECT t2.a FROM t1 JOIN t2 ON t2.c != 0
+WHERE t.a != 0 AND t2.a != 0)
+7 NULL
+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;
+SUM(DISTINCT b) (SELECT t2.a FROM t1,t2 WHERE t.a != 0 or 1=2 LIMIT 1)
+7 NULL
+7 10
+DROP TABLE t1,t2,t3;
set optimizer_switch=@subselect_tmp;
set @optimizer_switch_for_subselect_test=null;