| Bug #113171 | sum(distinct substring()) does not give warnings, while sum(substring() does | ||
|---|---|---|---|
| Submitted: | 22 Nov 2023 0:20 | Modified: | 11 Jun 2024 17:22 |
| Reporter: | Mattias Jonsson | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server: DML | Severity: | S3 (Non-critical) |
| Version: | 8.0.35-0ubuntu0.22.04.1 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
[22 Nov 2023 5:30]
MySQL Verification Team
Hello Mattias, Thank you for the report and test case. regards, Umesh
[11 Jun 2024 17:22]
Jon Stephens
Documented fix as follows in the MySQL 9.0.0 changelog:
SUM(SUBSTRING()) returned a warning as expected, but
SUM(DISTINCT SUBSTRING()) did not.
Closed.

Description: This does not give warnings: select sum(distinct substring("text", 1, 3)) from dual; while this does: select sum(substring("text", 1, 3)) from dual; I would expect both returning the same warning. How to repeat: mysql> select sum(substring("text", 1, 3)) from dual; +------------------------------+ | sum(substring("text", 1, 3)) | +------------------------------+ | 0 | +------------------------------+ 1 row in set, 1 warning (0,00 sec) mysql> select sum(distinct substring("text", 1, 3)) from dual; +---------------------------------------+ | sum(distinct substring("text", 1, 3)) | +---------------------------------------+ | 0 | +---------------------------------------+ 1 row in set (0,00 sec)