You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

PostgreSQL 14中UTC与PST春季夏令时转换异常问题排查

PostgreSQL 14夏令时切换期间DBeaver客户端时区转换显示异常问题

问题现象

使用PostgreSQL 14为无时区时间戳添加时区时,在春季夏令时切换阶段出现异常:原本唯一的PST时间戳转换为UTC后,出现03:00重复、02:00缺失的情况。

执行查询:

SELECT 
     start_ppt::timestamp,
     start_ppt::timestamp at time zone 'US/Pacific' as start_tz,
     start_ppt::timestamp at time zone 'US/Pacific' at time zone 'UTC' as start_utc2
from table

查询结果显示2019-03-10 03:00:00.000 UTC重复出现。

进一步测试查询:

select 
    '2019-03-10 02:00:00.000'::timestamp at time zone 'UTC' at time zone 'US/Pacific' as sample_utc_2019,
    '2019-03-09 18:00:00.000'::timestamp at time zone 'US/Pacific' at time zone 'UTC' as sample_pst_2019,
    '2023-03-12 02:00:00.000'::timestamp at time zone 'UTC' at time zone 'US/Pacific' as sample_utc_2023,
    '2023-03-11 18:00:00.000'::timestamp at time zone 'US/Pacific' at time zone 'UTC' as sample_pst_2023;

实际结果与预期不符:预期sample_pst_2019应为2019-03-10 02:00:00.000,实际显示为03:00。

排查过程

  • 尝试手动设置会话时区为UTC或US/Pacific,问题依旧存在。
  • 切换至psql、psycopg、pgAdmin等客户端执行相同查询,结果完全符合预期,无异常。

结论

该异常为DBeaver客户端的显示层问题,疑似DBeaver在处理夏令时切换时段的时间戳时,错误地自动调整了时区偏移,导致显示结果失真。

内容的提问来源于stack exchange,提问作者Jar

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.19 20:57:17