Bug #115476 | BIT query wrong result | ||
---|---|---|---|
Submitted: | 1 Jul 2024 16:22 | Modified: | 3 Oct 2024 0:23 |
Reporter: | Pedro Ferreira | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Optimizer | Severity: | S3 (Non-critical) |
Version: | 8.0 | OS: | Any |
Assigned to: | CPU Architecture: | Any | |
Tags: | bit, distinct, sum |
[1 Jul 2024 16:22]
Pedro Ferreira
[1 Jul 2024 17:18]
MySQL Verification Team
HI MR. Ferreira, Thank you for your bug report. We managed to repeat the behaviour in 8.0, 8.4 and 9.0. Verified for all versions 8.0 and higher.
[3 Oct 2024 0:23]
Jon Stephens
Documented fix as follows in the MySQL 9.1.0 changelog: SUM() yielded a different result in some cases for the same value when DISTINCT was also used. This was because, when using DISTINCT, a temporary table is used to hold the values so that in the end only the unique values are returned to the user. When creating such table while setting up DISTINCT, we did not take into consideration that the data type and length had been determined and use these, recalculating them instead. Now we use the data type and length already determined. Closed.
[3 Oct 2024 8:57]
MySQL Verification Team
Thank you, Jon.