pingcap/tidb

invalid year value cast incorrect

Open

#25,993 创建于 2021年7月6日

在 GitHub 查看
 (1 评论) (0 反应) (1 负责人)Go (6,186 fork)batch import
help wantedseverity/moderatesig/executiontype/bug

仓库指标

Star
 (40,090 star)
PR 合并指标
 (平均合并 14天 4小时) (30 天内合并 346 个 PR)

描述

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

set sql_mode = '';
CREATE TABLE t1 (a int, y YEAR);
insert ignore t1 values (1, 1900), (2, 2156), (3, '1900'), (4, '2156');

2. What did you expect to see? (Required)

As described in doc

Invalid YEAR value is automatically converted to 0000

mysql> select * from t1;
+------+------+
| a    | y    |
+------+------+
|    1 | 0000 |
|    2 | 0000 |
|    3 | 0000 |
|    4 | 0000 |
+------+------+

3. What did you see instead (Required)

mysql> select * from t1;
+------+------+
| a    | y    |
+------+------+
|    1 | 1901 |
|    2 | 2155 |
|    3 | 1901 |
|    4 | 2155 |
+------+------+

4. What is your TiDB version? (Required)

 Release Version: v5.2.0-alpha-206-gcb06e116c
Edition: Community
Git Commit Hash: cb06e116c1bfb1089c2e1df5072e889a3b7decd3
Git Branch: master
UTC Build Time: 2021-07-05 10:33:48
GoVersion: go1.16.2
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false |

贡献者指南