pingcap/tidb

invalid year value cast incorrect

Open

#25.993 aperta il 6 lug 2021

Vedi su GitHub
 (1 commento) (0 reazioni) (1 assegnatario)Go (6186 fork)batch import
help wantedseverity/moderatesig/executiontype/bug

Metriche repository

Star
 (40.090 star)
Metriche merge PR
 (Merge medio 14g 4h) (346 PR mergiate in 30 g)

Descrizione

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 |

Guida contributor