Bug #79410 | "coalesce(0, 1.2345)" is not returning 0.0000 with aggregate func in select list | ||
---|---|---|---|
Submitted: | 25 Nov 2015 13:13 | Modified: | 25 Nov 2015 14:50 |
Reporter: | Su Dylan | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: DML | Severity: | S3 (Non-critical) |
Version: | 5.7.8 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[25 Nov 2015 13:13]
Su Dylan
[25 Nov 2015 14:00]
MySQL Verification Team
Thank you for the bug report. Not repeatable anymore with source server build: mysql> select coalesce(0, 1.2345); +---------------------+ | coalesce(0, 1.2345) | +---------------------+ | 0.0000 | +---------------------+ 1 row in set (0.00 sec) mysql> select coalesce(0, 1.2345), sum(coalesce(0, 1.2345)), sum(1) from t1 as t2, t1 as t3 where t2.c1=t3.c1; +---------------------+--------------------------+--------+ | coalesce(0, 1.2345) | sum(coalesce(0, 1.2345)) | sum(1) | +---------------------+--------------------------+--------+ | 0 | 0.0000 | 1 | +---------------------+--------------------------+--------+ 1 row in set (0.00 sec) mysql> show variables like "%version%"; +-------------------------+------------------------------+ | Variable_name | Value | +-------------------------+------------------------------+ | innodb_version | 5.7.9 | | protocol_version | 10 | | slave_type_conversions | | | version | 5.7.9 | | version_comment | MySQL Community Server (GPL) | | version_compile_machine | x86_64 | | version_compile_os | Win64 | +-------------------------+------------------------------+ 7 rows in set (0.00 sec) mysql 5.7 > select coalesce(0, 1.2345); +---------------------+ | coalesce(0, 1.2345) | +---------------------+ | 0.0000 | +---------------------+ 1 row in set (0.02 sec) mysql 5.7 > select coalesce(0, 1.2345), sum(coalesce(0, 1.2345)), sum(1) from t1 as t2, t1 as t3 where t2.c1=t3.c1; +---------------------+--------------------------+--------+ | coalesce(0, 1.2345) | sum(coalesce(0, 1.2345)) | sum(1) | +---------------------+--------------------------+--------+ | 0.0000 | 0.0000 | 1 | +---------------------+--------------------------+--------+ 1 row in set (0.02 sec) mysql 5.7 > show variables like "%version%"; +-------------------------+---------------------------------------+ | Variable_name | Value | +-------------------------+---------------------------------------+ | innodb_version | 5.7.10 | | protocol_version | 10 | | slave_type_conversions | | | version | 5.7.10 | | version_comment | Source distribution PULL: 2015-NOV-07 | | version_compile_machine | x86_64 | | version_compile_os | Win64 | +-------------------------+---------------------------------------+ 7 rows in set (0.00 sec)
[25 Nov 2015 14:50]
Su Dylan
Hi Miguel, From the result you provided with 5.7.9 and 5.7.10, it seems that 5.7.9 result has this bug, and it is fixed in 5.7.10.