Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
builtins: fix incorrect timezone conversions for
extract
and `date_…
…trunc` `extract`: Due to actually taking `loc` into account for `MakeDTimestampTZFromDate` (as opposed to ignoring the argument before) in `827c97e04041e280a4413984d80cee99520c1d27`, this exposed other bugs. `date_trunc`: `timestamp` was incorrect because it tried to adapt to the timezone, even though it is returning a timestamp without time zone type. Furthermore, the `date` needed an additional `offset` for a given timezone as the given `date` is in UTC, but we need to truncate it in the correct timezone. This meant that my fix in the previous PR only fixed positive UTC offsets, but not negative UTC offsets. This PR fixes the immediate issue of `extract` and `date_trunc`, and I will make an audit of all other incorrect usages in an upcoming PR. There will be an upcoming PR to fix more other bugs found in the Plus and Minus expressions with the MakeDTimestampTZFromDate change. Release note (bug fix): Previously, `<date>:date` when context local timestamp is set would result in the previous day (`<date-1>::date>`) if the timezone is less than UTC+00:00 due to a recently introduced bug. This change fixes this. Release note (bug fix): Previously, date_trunc for timestamp were incorrect if in a local timezone was set. This change fixes this. Release note (bug fix): Previously, date_trunc for date types were incorrect with a negative timezone offset in a local timezone. This change fixes this.
- Loading branch information