Re: Problem with interval

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Problem with interval
Дата
Msg-id 466.1097099591@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Problem with interval  (Bruno Prévost <bp@interaction.ws>)
Список pgsql-bugs
Bruno Prévost <bp@interaction.ws> writes:
> I'm using postgres version 7.4.5 and had a problem with interval

> Here is my query :
> select '2004/10/31'::timestamptz + '1 day'::interval;

> Here is the answer :
> 10/31/2004 11:00:00 PM

If you are in a US time zone then that's the expected answer, because
2004/10/31 is a DST transition day.  '1 day' is currently always taken
to mean '24 hours', and 2004/10/31 is in fact 25 hours long...

Personally I would like to see the interval type redone so that days are
separate from smaller units and this case behaves more intuitively.
But that's been on the wish list for years and it's not gotten to the
top of anyone's to-do list.

In the meantime, you might ask yourself if you really want to use
type timestamptz at all, as opposed to date.  ('2004/10/31'::date + 1
would give the answer you want.)  Or consider using timestamp without
time zone.
        regards, tom lane


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

Предыдущее
От: "Sean Utt"
Дата:
Сообщение: Re: Problem with interval
Следующее
От: "PostgreSQL Bugs List"
Дата:
Сообщение: BUG #1282: LIKE clause double-unescapes characters