有一个简单的 SQL 查询:
SELECT '06:00:00 +0600'::timetz at time zone '-05:00',
'06:00:00 +0600'::timetz at time zone '+05:00'
我希望收到回复
+---------------+---------------+
|timezone |timezone |
+---------------+---------------+
|19:00:00 -05:00|05:00:00 +05:00|
+---------------+---------------+
但 PostgreSQL 产生相反的结果:
+---------------+---------------+
|timezone |timezone |
+---------------+---------------+
|05:00:00 +05:00|19:00:00 -05:00|
+---------------+---------------+
请告诉我这个问题的原因是什么。谢谢。
https://www.postgresql.org/docs/current/datetime-posix-timezone-specs.html
将时区指定为时间间隔使用 POSIX 规则。其中正偏移和负偏移的含义相对于 ISO-8601 中更为熟悉的命名约定是相反的。
我无法给出“到底是怎么回事”、“为什么会这样”的历史信息。