timestamp/date bug

Поиск
Список
Период
Сортировка
От juan@netsoc.tcd.ie (Juan Flynn)
Тема timestamp/date bug
Дата
Msg-id 20010204183154.A2598@netsoc.tcd.ie
обсуждение исходный текст
Ответы Re: timestamp/date bug  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: timestamp/date bug  (Karel Zak <zakkr@zf.jcu.cz>)
Список pgsql-bugs
I've come across an odd bug in Postgres 7 (7.0.3 I think) that's probably
best explained with an example:

SELECT to_char(timestamp '23-Mar-2000' + 1, 'Mon DD');
 to_char
---------
 Mar 24
(1 row)

Which is correct.

SELECT to_char(timestamp '23-Mar-2000' + 2, 'Mon DD');
 to_char
---------
 Mar 25
(1 row)

Also fine, but...

SELECT to_char(timestamp '23-Mar-2000' + 3, 'Mon DD');
 to_char
---------
 Mar 25
(1 row)

Which is wrong, however:

SELECT to_char(timestamp '23-Mar-2000' + 4, 'Mon DD');
 to_char
---------
 Mar 27
(1 row)

is correct.

This odd date bug seems to skip over March 26 2000, and it occurs also
on March 25 2001 and March 30 2002.

It caught me by surprise as I've been using Postgres for a while now and it's been
working really well, and the other day I got a phone call saying there was
no March 25. A current workaround is for me to redo the whole project with
dates and times instead of timestamps but that's a bit of a big job as they
are using the database everyday now.

Regards,
Juan

_________________________________________________________________________
Juan Flynn                                             juan@netsoc.tcd.ie
P.R.O., Dublin University Internet Society                 www.netsoc.tcd.ie

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: psql & "unexpected EOF on client connection"
Следующее
От: Alex Krohn
Дата:
Сообщение: Re: select fails on indexed varchars.