You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: mysql-test/r/func_group.result
+35Lines changed: 35 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -2397,5 +2397,40 @@ Note 1276 Field or reference 'test.t10.b' of SELECT #3 was resolved in SELECT #1
2397
2397
Note 1003 select `test`.`t10`.`a` AS `a` from `test`.`t10` where ((`test`.`t10`.`c` < 3) or <expr_cache><`test`.`t10`.`a`,`test`.`t10`.`b`>(<in_optimizer>(`test`.`t10`.`a`,<exists>(select `test`.`t12`.`c` from `test`.`t12` where (<cache>(`test`.`t10`.`a`) = `test`.`t12`.`c`) union select max(`test`.`t10`.`b`) from `test`.`t11` group by `test`.`t11`.`c` having (<cache>(`test`.`t10`.`a`) = <ref_null_helper>(max(`test`.`t10`.`b`)))))))
2398
2398
drop table t10,t11,t12;
2399
2399
#
2400
+
# MDEV-10017: Get unexpected `Empty Set` for correlated subquery
2401
+
# with aggregate functions
2402
+
#
2403
+
create table t1(c1 int, c2 int, c3 int);
2404
+
insert into t1 values(1,1,1),(2,2,2),(3,3,3);
2405
+
select * from t1;
2406
+
c1 c2 c3
2407
+
1 1 1
2408
+
2 2 2
2409
+
3 3 3
2410
+
create table t2(c1 int, c2 int);
2411
+
insert into t2 values(2,2);
2412
+
select * from t2;
2413
+
c1 c2
2414
+
2 2
2415
+
explain extended
2416
+
select c1 from t1 having c1 >= (select t.c1 as c from t2 t order by (select min(t1.c1+c) from t2 tt));
2417
+
ERROR HY000: Invalid use of group function
2418
+
select c1 from t1 having c1 >= (select t.c1 as c from t2 t order by (select min(t1.c1+c) from t2 tt));
2419
+
ERROR HY000: Invalid use of group function
2420
+
explain extended
2421
+
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));
2422
+
id select_type table type possible_keys key key_len ref rows filtered Extra
2423
+
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00
2424
+
2 DEPENDENT SUBQUERY t system NULL NULL NULL NULL 1 100.00
Note 1276 Field or reference 'test.t1.c1' of SELECT #3 was resolved in SELECT #1
2428
+
Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` having (`test`.`t1`.`c1` >= <expr_cache><`test`.`t1`.`c1`>((select 2 AS `c` from dual order by (select min((`test`.`t1`.`c1` + 2)) from dual))))
2429
+
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));
0 commit comments