Bug #60213 | Possible bug in string to decimal conversion | ||
---|---|---|---|
Submitted: | 22 Feb 2011 22:21 | Modified: | 23 Feb 2011 4:20 |
Reporter: | Carlos Vicente | Email Updates: | |
Status: | Duplicate | Impact on me: | |
Category: | MySQL Server: Data Types | Severity: | S2 (Serious) |
Version: | 5.1.41 | OS: | Linux (Ubuntu 10.04) |
Assigned to: | CPU Architecture: | Any |
[22 Feb 2011 22:21]
Carlos Vicente
[22 Feb 2011 22:23]
Carlos Vicente
Detailed steps to reproduce
Attachment: mysql-string-decimal-bug.txt (text/plain), 8.18 KiB.
[23 Feb 2011 4:18]
Alexey Kishkin
Hi Carlos. If you use quote around numeric, mysql converts this value to float (not to decimal), and in case of big enough numbers (as it's in the your testcase), you have to cast explicitly numbers to avoid errors. Formally it's not a bug. It's documented here: http://dev.mysql.com/doc/refman/5.1/en/precision-math-expressions.html "If a numeric expression contains any strings, they are converted to double-precision floating-point values and the expression is approximate. "
[23 Feb 2011 4:20]
Alexey Kishkin
you can look at http://bugs.mysql.com/bug.php?id=23260