to_char function has Daylight Savings Bug

Поиск
Список
Период
Сортировка
От Dana Burd
Тема to_char function has Daylight Savings Bug
Дата
Msg-id 893CF1EC58DAD211A2C00060089BB15D8E044B@colorado
обсуждение исходный текст
Ответы Re: to_char function has Daylight Savings Bug  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
to_char(timestamp, 'SSSS') has a Daylight Savings bug.  It includes the
missing 2am hour in it's "seconds from midnight count" for DST begin day
(4/6/2003), and does not include the extra hour for DST end day
(10/26/2003).

both seconds1 and seconds2 below should be 7200.  Note 4/6/2003 is start of
daylight savings for MST7MDT.

select '4/6/2003 3:00:00'::timestamp,
       '4/6/2003 00:00:00'::timestamp,
       to_char('4/6/2003 3:00:00'::timestamp,'SSSS') AS seconds1,
       trunc(extract(epoch from '4/6/2003 3:00:00'::timestamp)-
             extract(epoch from '4/6/2003 00:00:00'::timestamp)) AS
seconds2;

      timestamptz       |      timestamptz       | seconds1 | seconds2
------------------------+------------------------+----------+----------
 2003-04-06 03:00:00-06 | 2003-04-06 00:00:00-07 | 10800    |     7200
(1 row)

Included explicit TZ info, gives the same.

select '4/6/2003 3:00:00 MDT'::timestamp,
       '4/6/2003 00:00:00 MST'::timestamp,
       to_char('4/6/2003 3:00:00 MDT'::timestamp,'SSSS') AS seconds1,
       trunc(extract(epoch from '4/6/2003 3:00:00 MDT'::timestamp)-
             extract(epoch from '4/6/2003 00:00:00 MST'::timestamp)) AS
seconds2;

      timestamptz       |      timestamptz       | seconds1 | seconds2
------------------------+------------------------+----------+----------
 2003-04-06 03:00:00-06 | 2003-04-06 00:00:00-07 | 10800    |     7200
(1 row)

VERSION

% psql -V
psql (PostgreSQL) 7.2.3

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

Предыдущее
От: root
Дата:
Сообщение: Hello
Следующее
От: Ian Barwick
Дата:
Сообщение: Re: PL/PgSQL Create/Drop Table Issue