Please answer these questions before submitting your issue. Thanks!
drop table if exists t;
create table t (a double(5, 3));
insert into t values (1);
select * from t;
Result of MySQL 8.0 and 5.7:
mysql> select * from t;
+-------+
| a |
+-------+
| 1.000 |
+-------+
| a |
+---+
| 1 |
+---+
master, cec1a926583b008f919430b35a032a38098ddcbc
According to MySQL's doc, https://dev.mysql.com/doc/refman/8.0/en/floating-point-types.html ,
As of MySQL 8.0.17, the nonstandard FLOAT(M,D) and DOUBLE(M,D) syntax is deprecated and you should expect support for it to be removed in a future version of MySQL.
using double with specified precision is deprecated, the user should use decimal if wanted, and TiDB works in this case
drop table if exists t;
create table t (a decimal(5, 3));
insert into t values (1);
select * from t;
TiDB [test]> select * from t;
+-------+
| a |
+-------+
| 1.000 |
+-------+
1 row in set (0.001 sec)
@jebter can we close this issue?
We should document it here: https://docs.pingcap.com/tidb/stable/mysql-compatibility#type-system-differences
/assign @ichn-hu
Most helpful comment
According to MySQL's doc, https://dev.mysql.com/doc/refman/8.0/en/floating-point-types.html ,
using double with specified precision is deprecated, the user should use decimal if wanted, and TiDB works in this case