trinodb / trino

Official repository of Trino, the distributed SQL query engine for big data, formerly known as PrestoSQL (https://trino.io)
https://trino.io
Apache License 2.0
10.18k stars 2.94k forks source link

Day-denominated intervals are not time zone aware #23200

Open jacobbaskin opened 2 weeks ago

jacobbaskin commented 2 weeks ago

Because of daylight savings time, a given number of days doesn't correspond to a fixed number of seconds. Currently, Trino's interval type represents interval '1' day as equivalent to interval '86400' second. This gives incorrect results around DST changes:

trino> select timestamp '2024-11-02 11:00:00 America/New_York' + interval '1' day;
                  _col0                   
------------------------------------------
 2024-11-03 10:00:00.000 America/New_York 
(1 row)

Compare e.g. postgres:

# select (timestamp with time zone '2024-11-02 11:00:00 America/New_York' + interval '1' day);
        ?column?        
------------------------
 2024-11-03 11:00:00-05
(1 row)
wendigo commented 2 weeks ago

@martint ptal