Skip to content

mysql mode timestamp type field data reading exception #11

@shawn0915

Description

@shawn0915

test case:

drop table if exists t;
create table if not exists t(c timestamp(6));

set time_zone='+08:00';
insert t select now(6);
insert t select utc_timestamp(6);
table t;

mysql 输出:

+----------------------------+
| c                          |
+----------------------------+
| 2025-04-02 15:33:08.110326 |
| 2025-04-02 07:33:08.758054 |
+----------------------------+
2 rows in set (0.00 sec)

openHalo 输出:

+----------------------------+
| c                          |
+----------------------------+
| 2025-04-02 15:34:24.749217 |
| 2025-04-02 07:34:24.749784 |
+----------------------------+
2 rows in set (0.00 sec)

当前时间:

mysql> \! timedatectl
               Local time: Wed 2025-04-02 15:34:02 CST
           Universal time: Wed 2025-04-02 07:34:02 UTC
                 RTC time: Wed 2025-04-02 16:33:59
                Time zone: Asia/Shanghai (CST, +0800)
System clock synchronized: no
              NTP service: active
          RTC in local TZ: no
mysql>

设定时区为 +0,再次读取数据:

set time_zone='+00:00';

mysql 输出:

+----------------------------+
| c                          |
+----------------------------+
| 2025-04-02 07:33:08.110326 |
| 2025-04-01 23:33:08.758054 |
+----------------------------+
2 rows in set (0.00 sec)

openHalo:

+----------------------------+
| c                          |
+----------------------------+
| 2025-04-02 15:34:24.749217 |
| 2025-04-02 07:34:24.749784 |
+----------------------------+
2 rows in set (0.00 sec)

此时,发现mysql与openhalo输出不一致。

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions