datetime regression test fails at daylight savings transitions - Mailing list pgsql-hackers

From Tom Lane
Subject datetime regression test fails at daylight savings transitions
Date
Msg-id 27869.909360312@sss.pgh.pa.us
Whole thread Raw
List pgsql-hackers
Anyone else notice that the datetime regression test is barfing today?
For example,

SELECT ('today'::datetime = ('tomorrow'::datetime - '1 day'::timespan));

is returning FALSE instead of the expected TRUE.  I thought I'd broken
something in my installation, but further investigation tells the tale:

regression=> select 'today'::datetime;
?column?
----------------------------
Sun Oct 25 00:00:00 1998 EDT
(1 row)

regression=> select 'tomorrow'::datetime;
?column?
----------------------------
Mon Oct 26 00:00:00 1998 EST
(1 row)

regression=> select 'tomorrow'::datetime - '1 day'::timespan;
?column?
----------------------------
Sun Oct 25 01:00:00 1998 EDT
(1 row)

Whoops.  Looks like "'1 day'::timespan" is treated as "24 hours",
not as "the same local time next day".  Twice a year (if you observe
DST) there is a difference.

It's debatable whether this is a bug in the date/time datatypes,
or just sloppy coding of the regression test.  It probably oughta be
documented somewhere, either way.  Also, whichever way we decide the
above expressions ought to be handled, the docs ought to explain
how to get the other functionality.
        regards, tom lane


pgsql-hackers by date:

Previous
From: "Thomas G. Lockhart"
Date:
Subject: Re: [HACKERS] Re: [DOCS] Last call?
Next
From: "Taral"
Date:
Subject: RE: [HACKERS] Re: [DOCS] Last call?