Bug #39079 Truncating incorrect DECIMAL value at the wrong place
Submitted: 27 Aug 2008 19:13 Modified: 27 Aug 2008 20:16
Reporter: Nicklas Westerlund (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: DML Severity:S3 (Non-critical)
Version:5.x, 6.x OS:Any (Mac OSX, Linux)
Assigned to: CPU Architecture:Any

[27 Aug 2008 19:13] Nicklas Westerlund
Description:
So, after 5.0.3, DECIMAL(65,0) is the largest DECIMAL value, however, when dealing with larger numbers (i.e. when selecting LENGTH()) the truncation does not happen >65, but rather at >81, and then gives a warning about "Truncated incorrect DECIMAL value: ''" Which would have been incorrect already >65

How to repeat:
5067 (blogs) > SELECT LENGTH(999999999999999999999999999999999999999999999999999999999999999999999999999999999);
+-------------------------------------------------------------------------------------------+
| LENGTH(999999999999999999999999999999999999999999999999999999999999999999999999999999999) |
+-------------------------------------------------------------------------------------------+
|                                                                                        81 | 
+-------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

5067 (blogs) > SELECT LENGTH(9999999999999999999999999999999999999999999999999999999999999999999999999999999999);
+--------------------------------------------------------------------------------------------+
| LENGTH(9999999999999999999999999999999999999999999999999999999999999999999999999999999999) |
+--------------------------------------------------------------------------------------------+
|                                                                                         65 | 
+--------------------------------------------------------------------------------------------+
1 row in set, 1 warning (0.00 sec)

5067 (blogs) > SHOW WARNINGS;
+-------+------+---------------------------------------+
| Level | Code | Message                               |
+-------+------+---------------------------------------+
| Error | 1292 | Truncated incorrect DECIMAL value: '' | 
+-------+------+---------------------------------------+
1 row in set (0.02 sec)
[27 Aug 2008 20:16] Sveta Smirnova
Thank you for the report.

Verified as described.