Bug #113578 | AVG calculation bug | ||
---|---|---|---|
Submitted: | 8 Jan 2024 13:06 | Modified: | 10 Jan 2024 7:14 |
Reporter: | Ye Shiyang | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: DML | Severity: | S3 (Non-critical) |
Version: | 5.7.44, 8.0.35 | OS: | Any |
Assigned to: | CPU Architecture: | Any | |
Tags: | AVG calculation average |
[8 Jan 2024 13:06]
Ye Shiyang
[8 Jan 2024 13:42]
MySQL Verification Team
Hi Mr. eric, Thank you for your bug report. However, this is not a bug. The reason for that is that HAVING clause can be used ONLY when GROUP BY clause is used. When GROUP BY is not used, you should use the reserved word WHERE ....... Hence, this is not a bug.
[10 Jan 2024 7:14]
MySQL Verification Team
Hello Ye Shiyang, Thank you for the report and feedback regards, Umesh
[21 May 2024 9:07]
Jack Dong
mysql> select f1 from (SELECT AVG(-1.7E308) AS f1 FROM t1) as tmp_1; +-------------------------+ | f1 | +-------------------------+ | -1.7976931348623157e308 | +-------------------------+ 1 row in set (0.00 sec) mysql> select f1 from (SELECT AVG(1.7E308) AS f1 FROM t1) as tmp_1; +------------------------+ | f1 | +------------------------+ | 1.7976931348623157e308 | +------------------------+ 1 row in set (0.01 sec) mysql> SELECT AVG(-1.7E308) AS f1 from t1; +------+ | f1 | +------+ | 0 | +------+ 1 row in set (0.01 sec) mysql> SELECT AVG(1.7E308) AS f1 from t1; +------+ | f1 | +------+ | 0 | +------+ 1 row in set (0.00 sec) mysql> I think this problem may be related to the precision of floating point.