summaryrefslogtreecommitdiff
path: root/mysql-test/t
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2016-08-29 16:44:46 +0200
committerOleksandr Byelkin <sanja@mariadb.com>2016-08-31 19:12:35 +0200
commita322651b8aa702e58d473edfae26606f10a089fb (patch)
tree221f6a2eed2d54fb31bb3fa1546ff23be6113e49 /mysql-test/t
parentf6e47c00314b05f2b179e9e63f0e7b0062598cdc (diff)
downloadmariadb-git-a322651b8aa702e58d473edfae26606f10a089fb.tar.gz
MDEV-10017: Get unexpected `Empty Set` for correlated subquery with aggregate functions
take into account all arguments of aggregate function
Diffstat (limited to 'mysql-test/t')
-rw-r--r--mysql-test/t/func_group.test22
1 files changed, 22 insertions, 0 deletions
diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test
index 69a4dc1fddc..7e342928ef8 100644
--- a/mysql-test/t/func_group.test
+++ b/mysql-test/t/func_group.test
@@ -1658,5 +1658,27 @@ create table t12 as select * from t10;
explain extended select a from t10 where c<3 or a in (select c from t12 union select max(t10.b) from t11 group by t11.c);
drop table t10,t11,t12;
--echo #
+--echo # MDEV-10017: Get unexpected `Empty Set` for correlated subquery
+--echo # with aggregate functions
+--echo #
+
+create table t1(c1 int, c2 int, c3 int);
+insert into t1 values(1,1,1),(2,2,2),(3,3,3);
+select * from t1;
+create table t2(c1 int, c2 int);
+insert into t2 values(2,2);
+select * from t2;
+--error ER_INVALID_GROUP_FUNC_USE
+explain extended
+select c1 from t1 having c1 >= (select t.c1 as c from t2 t order by (select min(t1.c1+c) from t2 tt));
+--error ER_INVALID_GROUP_FUNC_USE
+select c1 from t1 having c1 >= (select t.c1 as c from t2 t order by (select min(t1.c1+c) from t2 tt));
+
+explain extended
+select c1 from t1 having c1 >= (select t.c1 as c from t2 t order by (select min(t1.c1+tt.c1) from t2 tt));
+select c1 from t1 having c1 >= (select t.c1 as c from t2 t order by (select min(t1.c1+tt.c1) from t2 tt));
+drop table t1,t2;
+
+--echo #
--echo # End of 10.1 tests
--echo #