TiDB 版本v3.0
CREATE TABLE `foo` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`amount` decimal(65,0) DEFAULT '0',
PRIMARY KEY (`id`)
)
简单插入两条数据,正常。
mysql> select * from foo;
+----+---------+--------+
| id | user_id | amount |
+----+---------+--------+
| 1 | 1 | 0 |
| 2 | 2 | -1 |
+----+---------+--------+
插入一个很大的负数,出现问题,还在decimal(65,0)的范围内:
insert into foo(user_id, amount) values(3,-17000000000000000000);
ERROR 1264 (22003): Out of range value for column 'amount' at row 1