Skip to content

INSERT with timestamp in DST non-existent range results in '0000-00-00' instead as adjusted to next valid time, as in MySQL #61334

@kissmydb

Description

@kissmydb

Bug Report

Please answer these questions before submitting your issue. Thanks!

During Daylight Saving Time, DST, the time '2025-03-30 02:00:00'~'2025-03-30 02:59:00' does not exist. When I insert such a invalid data into TiDB , the result is '0000-00-00' and different compared with MySQL 8.0.39, which adjusts it to the next valid time.

1. Minimal reproduce step (Required)

SET time_zone = 'Europe/Stockholm';
set sql_mode='';
CREATE TABLE `t1` (
   id int,
  `created` timestamp NULL DEFAULT NULL
);
insert into t1 values(1,'2025-03-30 01:59:00');
insert into t1 values(2,'2025-03-30 02:00:00');
insert into t1 values(3,'2025-03-30 02:59:00');
insert into t1 values(4,'2025-03-30 03:00:00');
select * from t1;

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

mysql> select * from t1;
+------+---------------------+
| id   | created             |
+------+---------------------+
|    1 | 2025-03-30 01:59:00 |
|    2 | 2025-03-30 03:00:00 |
|    3 | 2025-03-30 03:00:00 |
|    4 | 2025-03-30 03:00:00 |
+------+---------------------+
4 rows in set (0.01 sec)

3. What did you see instead (Required)

mysql> select * from t1;
+------+---------------------+
| id   | created             |
+------+---------------------+
|    1 | 2025-03-30 01:59:00 |
|    2 | 0000-00-00 00:00:00 |
|    3 | 0000-00-00 00:00:00 |
|    4 | 2025-03-30 03:00:00 |
+------+---------------------+
4 rows in set (0.01 sec)

4. What is your TiDB version? (Required)

v8.5.1

Metadata

Metadata

Assignees

Labels

affects-6.1This bug affects the 6.1.x(LTS) versions.affects-6.5This bug affects the 6.5.x(LTS) versions.affects-7.1This bug affects the 7.1.x(LTS) versions.affects-7.5This bug affects the 7.5.x(LTS) versions.affects-8.1This bug affects the 8.1.x(LTS) versions.affects-8.5This bug affects the 8.5.x(LTS) versions.compatibility-mysql8This is a compatibility issue with MySQL 8.0(but NOT 5.7)severity/majorsig/sql-infraSIG: SQL Infratype/bugThe issue is confirmed as a bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions