From: Date: January 8 2006 8:00am Subject: bk commit into 4.1 tree (igor:1.2472) BUG#14274 List-Archive: http://lists.mysql.com/commits/749 X-Bug: 14274 Message-Id: <20060108070013.1C193224463@rurik.mysql.com> Below is the list of changes that have just been committed into a local 4.1 repository of igor. When igor does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet 1.2472 06/01/07 23:00:06 igor@stripped +3 -0 Fixed bug #14274: a query with a having clause containing only set function returned a wrong result set. sql/sql_select.cc 1.445 06/01/07 22:59:56 igor@stripped +1 -1 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. mysql-test/t/having.test 1.13 06/01/07 22:59:56 igor@stripped +12 -0 Added a test case for bug #14274. mysql-test/r/having.result 1.14 06/01/07 22:59:56 igor@stripped +13 -0 Added a test case for bug #14274. # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: igor # Host: rurik.mysql.com # Root: /home/igor/dev/mysql-4.1-0 --- 1.444/sql/sql_select.cc 2005-11-15 07:07:02 -08:00 +++ 1.445/sql/sql_select.cc 2006-01-07 22:59:56 -08:00 @@ -287,7 +287,7 @@ if (having_fix_rc || thd->net.report_error) DBUG_RETURN(-1); /* purecov: inspected */ if (having->with_sum_func) - having->split_sum_func(thd, ref_pointer_array, all_fields); + having->split_sum_func2(thd, ref_pointer_array, all_fields, &having); } // Is it subselect --- 1.13/mysql-test/r/having.result 2004-08-26 08:26:34 -07:00 +++ 1.14/mysql-test/r/having.result 2006-01-07 22:59:56 -08:00 @@ -128,3 +128,16 @@ 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; --- 1.12/mysql-test/t/having.test 2005-07-27 17:21:43 -07:00 +++ 1.13/mysql-test/t/having.test 2006-01-07 22:59:56 -08:00 @@ -123,4 +123,16 @@ 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