Bug #10013 precision math, column definition, strange server behaviour
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.
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.048 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.
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.