pingcap / pingcap/tidb

Timestamp in Daylight Saving Time transition backwards, is interpreted differently from MySQL

Open
#61,368 1 comment 0 reactions 1 assignee Claimed by @mjonss View on GitHub
compatibility-mysql8 may-affects-6.1 may-affects-6.5 may-affects-7.1 may-affects-7.5 may-affects-8.1 may-affects-8.5 severity/major sig/sql-infra type/bug
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Bug Report

Please answer these questions before submitting your issue. Thanks!

### 1. Minimal reproduce step (Required)

```mysql
drop table if exists t;
create table t (a serial, b timestamp);
set time_zone='Europe/Amsterdam';
insert into t (b) values ('2025-10-26 02:30:00');
set time_zone = 'UTC';
select * from t;
```

Note that when '2025-10-26 02:59:59' end the first time, the time transitions back to 02:00:00 (going from "summer time" to "normal time") so if just specified a DST time zone, and not a specific time zone offset, 02:30:00 in 'Europe/Amsterdam' can be either UTC 00:30:00 or UTC 01:30:00.

Also see various MySQL bugs, like [this](https://bugs.mysql.com/bug.php?id=83852) which lead to the addition of explicit time zone offsets.

### 2. What did you expect to see? (Required)
Same result as in MySQL:
```mysql
mysql> select * from t;
+---+---------------------+
| a | b |
+---+---------------------+
| 1 | 2025-10-26 00:30:00 |
+---+---------------------+
1 row in set (0.00 sec)
```

### 3. What did you see instead (Required)
Difference of one hour:
```mysql
tidb> select * from t;
+---+---------------------+
| a | b |
+---+---------------------+
| 1 | 2025-10-26 01:30:00 |
+---+---------------------+
1 row in set (0.00 sec)
```

Which is still correct, but incompatible with MySQL.

I would also like to have at least a warning when inserting/updating/querying a non-deterministic timestamp value :)

### 4. What is your TiDB version? (Required)

v8.5.1

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.