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)