Обсуждение: Please clarify that Timestamp with Timezone doesn't preserve the timezone.
Please clarify that Timestamp with Timezone doesn't preserve the timezone.
От
PG Doc comments form
Дата:
The following documentation comment has been logged on the website: Page: https://www.postgresql.org/docs/18/datatype-datetime.html Description: Hi, Just a small bit of feedback on this page: https://www.postgresql.org/docs/current/datatype-datetime.html There is a gotcha for the unwary, in that it does not preserve the original timezone after the data is recorded. The user needs to understand that timestamp with timezone is performing implicit conversion for them, but it does not save the TZ value. One might, naively, expect it to do the "obvious" thing, storing the original timezone alongside the timestamp, and therefore allow you to query the data and discover what the timezone was when the data was input. (i.e. the on-disk representation of "17th May at 4pm New York" should be different from "17th May at 1pm in Los Angeles", and that a query should be able to do something like not just the UTC value in the local timezone, but also the fact that this date was recorded from the perspective of a New Yorker). Or in other words, one might expect that: SELECT EXTRACT (timezone FROM '2026-04-16 13:00:00+09'::timestamptz); should be able to tell me the "+09", regardless of my own local time. May I suggest adding a "Caution" to draw greater attention to this fact, and recommending an alternative if there is one. Thanks - Richard