datetime regression test fails at daylight savings transitions

Поиск
Список
Период
Сортировка
От Tom Lane
Тема datetime regression test fails at daylight savings transitions
Дата
Msg-id 27869.909360312@sss.pgh.pa.us
обсуждение исходный текст
Список 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 по дате отправления:

Предыдущее
От: "Thomas G. Lockhart"
Дата:
Сообщение: Re: [HACKERS] Re: [DOCS] Last call?
Следующее
От: "Taral"
Дата:
Сообщение: RE: [HACKERS] Re: [DOCS] Last call?