pingcap/tidb

"show warnings" result of decimal truncate differ to mysql

Open

#6,609 创建于 2018年5月22日

在 GitHub 查看
 (2 评论) (0 反应) (0 负责人)Go (40,090 star) (6,186 fork)batch import
help wantedpriority/P4type/compatibility

描述

  1. What did you do? If possible, provide a recipe for reproducing the error.
SET SQL_WARNINGS=1;
SET sql_mode = 'NO_ENGINE_SUBSTITUTION';
CREATE TABLE `t1` (
  `a` decimal(10,2) DEFAULT NULL
);
insert into t1 values ("+111111111.11"),("111111111.11"),("-11111111.11");
show warnings;
  1. What did you expect to see? like mysql
mysql> show warnings;
+---------+------+--------------------------------------------+
| Level   | Code | Message                                    |
+---------+------+--------------------------------------------+
| Warning | 1264 | Out of range value for column 'a' at row 1 |
| Warning | 1264 | Out of range value for column 'a' at row 2 |
+---------+------+--------------------------------------------+
2 rows in set (0.00 sec)
  1. What did you see instead?
mysql> show warnings;
+---------+------+--------------------------------------------+
| Level   | Code | Message                                    |
+---------+------+--------------------------------------------+
| Warning | 1690 | DECIMAL value is out of range in '(10, 2)' |
| Warning | 1690 | DECIMAL value is out of range in '(10, 2)' |
+---------+------+--------------------------------------------+
2 rows in set (0.00 sec)
  1. What version of TiDB are you using (tidb-server -V or run select tidb_version(); on TiDB)?
Release Version: v2.0.0-rc.4-215-gc3b006e4-dirty
Git Commit Hash: c3b006e4a4e64042d400909382861a5fd23d029c
Git Branch: dev/time-compare-tz-aware
UTC Build Time: 2018-05-22 02:11:55
GoVersion: go version go1.10.1 linux/amd64
Race Enabled: false
TiKV Min Version: 2.0.0-rc.4.1

贡献者指南