Bug #114550 | ROUND(1.2345, 2) and ROUND(1.2345, @TWO) unexpected different results | ||
---|---|---|---|
Submitted: | 4 Apr 2024 11:31 | Modified: | 4 Apr 2024 20:27 |
Reporter: | Eimantas Jatkonis | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: DML | Severity: | S3 (Non-critical) |
Version: | 8.0.35, 8.0.36 | OS: | Any |
Assigned to: | CPU Architecture: | Any | |
Tags: | regression |
[4 Apr 2024 11:31]
Eimantas Jatkonis
[4 Apr 2024 11:53]
MySQL Verification Team
Hello Eimantas Jatkonis, Thank you for the report and test case. Thanks, Umesh
[4 Apr 2024 20:05]
Roy Lyseng
Posted by developer: This is not a bug. Metadata, such as number of decimals, is calculated based on literal values. But a user variable may change between executions, so metadata is calculated as a conservative large value. The actual result is still rounded according to the value of the user variable at runtime.
[4 Apr 2024 20:27]
Eimantas Jatkonis
If code is not bug, then manual seems to be misleading. Any ideas how to achieve OLD results for ROUND(1.23456, @TWO) = 1.23 ROUND(1.00007, @TWO) = 1.00 ? I know FORMAT(X, @TWO), but unfortunately it adds thousands separator. And CAST(ROUND(...) AS DECIMAL(12, @TWO)) doesn't works either.