Bug #25365 Silent change in aggregate function behaviour in scalar context
Submitted: 2 Jan 2007 13:24 Modified: 6 Jan 2007 18:30
Reporter: Axel Schwenke Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:5.0.27 OS:Any (all)
Assigned to: CPU Architecture:Any

[2 Jan 2007 13:24] Axel Schwenke
Description:
The behaviour of the aggregate functions in scalar context (that is: without a result set) changed from 5.0.24a to 5.0.27. Before those functions behaved like with an empty result set, now they seem to assume there is a single row.

This change is not documented, neither in the changelog nor in the server documentation.

How to repeat:
5.0.24a:

mysql> select count(42);
0
mysql> select avg(42);
NULL

5.0.27:

mysql> select count(42);
1
mysql> select avg(42);
42.0000

Suggested fix:
Document the changed behaviour.
[2 Jan 2007 14:10] Hartmut Holzgraefe
Btw. ... even if this were documented ... shouldn't a behavior change like this in a GA version be considered a bug by itself? 
(Raising priority to P3 for now to make sure this doesn't get completely ignored ...)
[3 Jan 2007 20:46] Stefan Hinz
I agree that this looks like a change that was introduced inadvertently, thus changing the category to Server:General.
[6 Jan 2007 18:30] Sergei Golubchik
This was a fix for BUG#21540, documented at http://dev.mysql.com/doc/refman/5.0/en/news-5-0-26.html