Bug #8426 Precision math: Unable to SELECT a DEC(38,38) value correctly
Submitted: 10 Feb 2005 23:14 Modified: 29 Sep 2008 21:24
Reporter: Trudy Pelzer Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.15-rc-debug OS:Linux (SuSE 9.1)
Assigned to: MySQL Verification Team CPU Architecture:Any

[10 Feb 2005 23:14] Trudy Pelzer
Description:
It should be possible to define a DECIMAL or NUMERIC column
with up to 38 digits precision either before or after the decimal 
point. Any number which is inserted, if it's within the range, 
should be exactly the same as the number that gets selected.

But if I define a column as DECIMAL(38,38), MySQL allows
me to INSERT a value with 38 post-decimal digits, but
won't display the same number when I SELECT it.

How to repeat:
mysql> create table t1 (col1 decimal(38,38));
Query OK, 0 rows affected (0.01 sec)

mysql> insert into t1 values (.12345678901234567890123456789012345678);
Query OK, 1 row affected, 1 warning (0.00 sec)

mysql> select * from t1;
+----------------------------------+
| col1                             |
+----------------------------------+
| 0.123456789012345678901234567890 |
+----------------------------------+
1 row in set (0.00 sec)
-- This is the incorrect result; the last 8 digits of the inserted
value are not shown in the display. The result should be:
+------------------------------------------+
| col1                                     |
+------------------------------------------+
| 0.12345678901234567890123456789012345678 |
+------------------------------------------+
[10 Feb 2005 23:39] MySQL Verification Team
Thank you for the bug report.
[2 Apr 2005 11:33] Alexey Botchkov
Unfortunately this only can be fixed in 5.1
Now 30 digits after decimal point is the limit.
[29 Sep 2005 22:30] Brian Aker
reverify
[30 Sep 2005 0:27] MySQL Verification Team
The current behavior is how was already reported by Alexey:

mysql> create table t1 (col1 decimal(38,38));
ERROR 1425 (42000): Too big scale 38 specified for column 'col1'. Maximum is 30.
mysql> select version();
+-----------------+
| version()       |
+-----------------+
| 5.0.14-rc-debug |
+-----------------+
1 row in set (0.00 sec)
[30 Sep 2005 0:39] MySQL Verification Team
Thank you for your bug report. This issue has already been fixed
in the latest released version of that product, which you can download at 
http://www.mysql.com/downloads/
[29 Sep 2008 21:24] Konstantin Osipov
This has been fixed at some point by yielding an error message at create:

mysql> create table t1 (col1 decimal(38,38));
ERROR 1425 (42000): Too big scale 38 specified for column 'col1'. Maximum is 30