Bug #10719 | Inconsistent behavior of DECIMAL(M,D) with higher precision input | ||
---|---|---|---|
Submitted: | 18 May 2005 18:19 | Modified: | 28 Jul 2005 11:20 |
Reporter: | Michael Stassen | Email Updates: | |
Status: | Won't fix | Impact on me: | |
Category: | MySQL Server | Severity: | S3 (Non-critical) |
Version: | 4.1.11 | OS: | |
Assigned to: | Alexey Botchkov | CPU Architecture: | Any |
[18 May 2005 18:19]
Michael Stassen
[19 May 2005 18:19]
Michael Stassen
I should add that I get the same results with 4.0.20. I'm guessing that because mysql 4.x stores DECIMALs as strings, it handles the string case with a simple string copy, hence the truncation. Gordon reports on the mailing list <http://lists.mysql.com/mysql/184274>, however, that 5.0.4 always rounds . I'm guessing that since DECIMAL is no longer internally a string as of 5.0.3, a simple string copy is not possible, so the input string is converted to a number first, which means it gets rounded before it is assigned. Finally, in cases where the value is rounded, mysql currently does not issue a warning that the value was rounded. I believe we should warn whenever data is changed.
[28 Jul 2005 11:20]
Alexey Botchkov
Thank you for taking the time to report a problem. Unfortunately you are not using a current version of the product your reported a problem with -- the problem might already be fixed. Please download a new version from http://www.mysql.com/downloads/ If you are able to reproduce the bug with one of the latest versions, please change the version on this bug report to the version you tested and change the status back to "Open". Again, thank you for your continued support of MySQL. Additional info: Sorry, but this bug can't be fixed in 4.x DECIMAL fieldtype works correctly since 5.0.