Decimal(65,0)数据类型支持的范围

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

目前来看是已知问题,相关 PR :https://github.com/pingcap/tidb/pull/11989 。会在下一个 release 里面带出去,2.1 和 3.0 都会带上。

nice,赞fix 速度。

此话题已在最后回复的 1 分钟后被自动关闭。不再允许新回复。