-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix at_timezone(TIME WITH TIME ZONE)
AT TIME ZONE does not take into account the fact, that TIME WITH TIME ZONE does not represent real millisecond UTC in millisUtc field. In fact, this field contains millisUtc assuming offset of TIME ZONE that was valid on 1970-01-01. Such representation allows to simply represent local time with time zone id. That means that TIME WITH TIME ZONE that represents eg. '10:00:00.000 Asia/Kathmandu' will always represent this exact value. However mapping of such value to other TZ (including UTC) may differ over time. Eg. Asia/Kathmandu switched time zone offset on 1986 from +5:30 to +5:45. Result of query like: `SELECT time_with_tz_column FROM table;` Will always be the same, however: `SELECT time_with_tz_column AT TIME ZONE 'UTC' FROM table;` Will yail differnet value in 1980 and 2000 after changes from this commit. This is done to use current offset of TZ as function that stucked in 1970-01-01 offsets seems useless. This is not perfect solution and is not fully aligned with standard, but standard behavior cannot be achieved with current TIME WITH TIME ZONE representation, as we are not able to read TZ offset from TIME WITH TIME ZONE itselve (at least not in all cases).
- Loading branch information
Showing
3 changed files
with
159 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters