Bug #10013 precision math, column definition, strange server behaviour
Submitted: 19 Apr 2005 21:03 Modified: 20 Apr 2005 8:02
Reporter: Matthias Leich Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0 OS:
Assigned to: CPU Architecture:Any

[19 Apr 2005 21:03] Matthias Leich
Description:
Lets start with the example:

sql_mode='traditional';

CREATE TABLE t1 (f1 DECIMAL (2,5),f2 DECIMAL (64,253));
DESCRIBE t1;
Field	Type	Null	Key	Default	Extra
f1	decimal(6,5)	YES		NULL	
f2	decimal(64,30)	YES		NULL

1. The server does not follow my SQL statement and silent
    changes the column definition ( scale 30 instead of 253).
    Such a silent change is not allowed by the manual and 
    especially not acceptable within the sql mode traditional.

2. According to the manual 11.1.1. Overview of Numeric Types
    DECIMAL[(M[,D])] [UNSIGNED] [ZEROFILL]
  ...
  For MySQL 5.0.3 and above:
   ...
  The maximum number of supported decimals (D) is 30.

  my scale of 253 for the column f2 is illegal.

3. The manual says within 23.2. DECIMAL Data Type Changes 
    ...
    D is the number of digits to the right of the decimal point 
(the scale). It has a range of 0 to 30 and must be no larger than M.

   My scales are bigger than my precisions. Therefore both column
   definitions violate this rule.

My environment:
   - Intel PC with Linux(SuSE 9.1)
   - MySQL compiled from source
        Version 5.0 ChangeSet@1.1853.1.1, 2005-04-18

How to repeat:
Please execute the statements above.
[20 Apr 2005 8:02] Matthias Leich
This is a duplicate of Bug#8449.