pingcap/tidb

"show warnings" result of decimal truncate differ to mysql

Open

#6 609 ouverte le 22 mai 2018

Voir sur GitHub
 (2 commentaires) (0 réactions) (0 assignés)Go (6 186 forks)batch import
help wantedpriority/P4type/compatibility

Métriques du dépôt

Stars
 (40 090 stars)
Métriques de merge PR
 (Merge moyen 14j 4h) (346 PRs mergées en 30 j)

Description

  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

Guide contributeur