datetime regression test fails at daylight savings transitions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)postgreSQL(dot)org
Subject: datetime regression test fails at daylight savings transitions
Date: 1998-10-26 00:05:12
Message-ID: 27869.909360312@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas G. Lockhart 1998-10-26 00:42:40 Re: [HACKERS] Re: [DOCS] Last call?
Previous Message Taral 1998-10-25 23:37:15 RE: [HACKERS] Re: [DOCS] Last call?