Bug #13667 Inconsistency for decimal(m,d) specification

Submitted: 30 Sep 2005 18:17 Modified: 27 Oct 2005 2:46
Reporter: Paul DuBois Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.14-rc BK source OS:
Assigned to: Alexey Botchkov CPU Architecture:Any

[30 Sep 2005 18:17] Paul DuBois
Description:
See Bug#12694, which is about float/double.

I find a similar problem for decimal, but it depends on the
value of D.  For decimal(0,11), and error occurs, but for
D < 11, the column specification is accepted, and changed
silently without even a warning.

How to repeat:
Test script:

set sql_mode='';
drop table if exists t;
create table t (d decimal(0,11));
show warnings;
desc t;
drop table if exists t;
create table t (d decimal(0,10));
show warnings;
desc t;

Result:

mysql> set sql_mode='';
Query OK, 0 rows affected (0.00 sec)

mysql> drop table if exists t;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> create table t (d decimal(0,11));
ERROR 1427 (42000): For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 'd').
mysql> show warnings;
+-------+------+---------------------------------------------------------------------------+
| Level | Code | Message                                                                   |
+-------+------+---------------------------------------------------------------------------+
| Error | 1427 | For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 'd'). |
+-------+------+---------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> desc t;
ERROR 1146 (42S02): Table 'test.t' doesn't exist
mysql> drop table if exists t;
Query OK, 0 rows affected, 1 warning (0.01 sec)

mysql> create table t (d decimal(0,10));
Query OK, 0 rows affected (0.01 sec)

mysql> show warnings;
Empty set (0.01 sec)

mysql> desc t;
+-------+----------------+------+-----+---------+-------+
| Field | Type           | Null | Key | Default | Extra |
+-------+----------------+------+-----+---------+-------+
| d     | decimal(10,10) | YES  |     | NULL    |       |
+-------+----------------+------+-----+---------+-------+
1 row in set (0.02 sec)
[11 Oct 2005 16:06] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/30924
[17 Oct 2005 13:41] Alexander Barkov
Ok to push.
[27 Oct 2005 2:46] Paul DuBois
Noted in 5.0.16 changelog.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.040 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.