diff options
author | unknown <igor@rurik.mysql.com> | 2006-01-07 23:00:06 -0800 |
---|---|---|
committer | unknown <igor@rurik.mysql.com> | 2006-01-07 23:00:06 -0800 |
commit | 7bb07fd4c301ed67ed083febb2e0fcf4be2e6631 (patch) | |
tree | 4b770f750dd504114956bf8b90f322d623837a39 /mysql-test | |
parent | af13158ab844d131e8b7c41c4a50a93e3f6c83c0 (diff) | |
download | mariadb-git-7bb07fd4c301ed67ed083febb2e0fcf4be2e6631.tar.gz |
Fixed bug #14274: a query with a having clause containing only set function returned a wrong result set.
mysql-test/r/having.result:
Added a test case for bug #14274.
mysql-test/t/having.test:
Added a test case for bug #14274.
sql/sql_select.cc:
Fixed bug #14274: a query with a having clause containing only set function returned a wrong result set.
It happened because processing of the set functions in having started with a call of the split_sum_func
method, instead of the split_sum_func2 method.
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/having.result | 13 | ||||
-rw-r--r-- | mysql-test/t/having.test | 12 |
2 files changed, 25 insertions, 0 deletions
diff --git a/mysql-test/r/having.result b/mysql-test/r/having.result index 218276406b1..9730f9f81bf 100644 --- a/mysql-test/r/having.result +++ b/mysql-test/r/having.result @@ -128,3 +128,16 @@ id description c 1 test 0 2 test2 0 drop table t1,t2,t3; +CREATE TABLE t1 (a int); +INSERT INTO t1 VALUES (3), (4), (1), (3), (1); +SELECT SUM(a) FROM t1 GROUP BY a HAVING SUM(a)>0; +SUM(a) +2 +6 +4 +SELECT SUM(a) FROM t1 GROUP BY a HAVING SUM(a); +SUM(a) +2 +6 +4 +DROP TABLE t1; diff --git a/mysql-test/t/having.test b/mysql-test/t/having.test index 920a3b752ab..3dd9ace6a1b 100644 --- a/mysql-test/t/having.test +++ b/mysql-test/t/having.test @@ -123,4 +123,16 @@ group by a.id, a.description having (a.description is not null) and (c=0); drop table t1,t2,t3; +# +# Bug #14274: HAVING clause containing only set function +# + +CREATE TABLE t1 (a int); +INSERT INTO t1 VALUES (3), (4), (1), (3), (1); + +SELECT SUM(a) FROM t1 GROUP BY a HAVING SUM(a)>0; +SELECT SUM(a) FROM t1 GROUP BY a HAVING SUM(a); + +DROP TABLE t1; + # End of 4.1 tests |