Skip to content

alter table modify column to a time type may generate incorrect value #56051

@lcwangchao

Description

@lcwangchao

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

My local time zone is Asia/Shanghai

> create table t(t int);
> insert into t values(NULL);
> set @@time_zone='UTC' --- set a different time zone with local
> alter table t modify column t timestamp not null;
> select now(),t from t;

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

The value of now() and t should not differs too much.

3. What did you see instead (Required)

These two columns differs two hours

> select t, now() from t
+---------------------+---------------------+
| t                   | now()               |
+---------------------+---------------------+
| 2024-09-12 04:09:36 | 2024-09-12 12:13:47 |
+---------------------+---------------------+

4. What is your TiDB version? (Required)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions