mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
aggregate functions check during substitution made only for single row subselects (BUG#4400)
restoring current senect pointer before PS rexecution (backport from 5.0) removed spaces at lines ends mysql-test/r/subselect.result: Aggregate function comparation with ALL/ANY/SOME subselect test mysql-test/t/subselect.test: Aggregate function comparation with ALL/ANY/SOME subselect test sql/item_subselect.cc: removed spaces at lines ends aggregate functions check during substitution made only for single row subselects sql/item_subselect.h: removed spaces at lines ends sql/sql_prepare.cc: restoring current senect pointer before PS rexecution (backport from 5.0)
This commit is contained in:
@ -1891,3 +1891,11 @@ abc b
|
||||
3 4
|
||||
deallocate prepare stmt1;
|
||||
DROP TABLE t1, t2, t3;
|
||||
CREATE TABLE `t1` ( `a` int(11) default NULL) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
insert into t1 values (1);
|
||||
CREATE TABLE `t2` ( `b` int(11) default NULL, `a` int(11) default NULL) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
insert into t2 values (1,2);
|
||||
select t000.a, count(*) `C` FROM t1 t000 GROUP BY t000.a HAVING count(*) > ALL (SELECT count(*) FROM t2 t001 WHERE t001.a=1);
|
||||
a C
|
||||
1 1
|
||||
drop table t1,t2;
|
||||
|
@ -1212,3 +1212,13 @@ execute stmt1;
|
||||
select * from t3;
|
||||
deallocate prepare stmt1;
|
||||
DROP TABLE t1, t2, t3;
|
||||
|
||||
#
|
||||
# Aggregate function comparation with ALL/ANY/SOME subselect
|
||||
#
|
||||
CREATE TABLE `t1` ( `a` int(11) default NULL) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
insert into t1 values (1);
|
||||
CREATE TABLE `t2` ( `b` int(11) default NULL, `a` int(11) default NULL) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
insert into t2 values (1,2);
|
||||
select t000.a, count(*) `C` FROM t1 t000 GROUP BY t000.a HAVING count(*) > ALL (SELECT count(*) FROM t2 t001 WHERE t001.a=1);
|
||||
drop table t1,t2;
|
||||
|
Reference in New Issue
Block a user