Re: to_char miscalculation on April Fool's Day - the start of daylight savings

Поиск
Список
Период
Сортировка
От Thomas Lockhart
Тема Re: to_char miscalculation on April Fool's Day - the start of daylight savings
Дата
Msg-id 3ACDCAAD.74C3210B@alumni.caltech.edu
обсуждение исходный текст
Ответ на to_char miscalculation on April Fool's Day - the start of daylight savings  (Chris Straka <cstraka@incontactnow.com>)
Ответы Re: Re: to_char miscalculation on April Fool's Day - the start of daylight savings  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
> It's April 3 and I'm developing an update routine to maintain expired
> records, some of which expired on April 1.  When these records didn't get
> updated, I investigated and identified the alleged bug (which is
> potentially devastating based on date intensive calculations in financial
> applications).

A known problem which is fixed in the upcoming release. Workaround
follows...

> The quickest demonstration is as follows:
> select to_char(now(), 'YYYY-MM-DD');

Have you tried to use "date 'today'" rather than "now()"? As in

  select to_char(date 'today' - 1, 'YYYY-MM-DD');

which uses the DATE type rather than ABSTIME/TIMESTAMP returned from
now(). That should eliminate the problem, since the DATE type does not
try to carry along time zone information. Seems to work for me on 7.0.3.

                      - Thomas

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Unexpected query results
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Re: to_char miscalculation on April Fool's Day - the start of daylight savings