Problem with intervals

Поиск
Список
Период
Сортировка
От Bob Smith
Тема Problem with intervals
Дата
Msg-id AFC6FD04-2485-11D8-A180-0003933DD370@h-e.com
обсуждение исходный текст
Ответы Re: Problem with intervals  (Richard Huxton <dev@archonet.com>)
Re: Problem with intervals  ("Alexander M. Pravking" <fduch@antar.bryansk.ru>)
Re: Problem with intervals  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-sql
I'm getting an unexpected result using intervals in an expression:

select ('2003-10-26 0:00:00'::timestamp + '1 day'::interval)::date;    date
------------ 2003-10-26
(1 row)

When I get rid of the date cast it becomes clear what is happening:

select '2003-10-26 0:00:00'::timestamp + '1 day'::interval;        ?column?
------------------------ 2003-10-26 23:00:00-08
(1 row)

I assumed '1 day' would always increment the date by 1, but it appears 
that '1 day' just means '24 hours', and due to the daylight/standard 
time shift, October 26 was 25 hours long this year.

Is this a Postgres bug, or is this correct SQL behavior?  I'm running 
Postgres 7.2.2.

Bob S.



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

Предыдущее
От: "Kumar"
Дата:
Сообщение: Re: Concatenating multiple fetches into a single string
Следующее
От: Tomasz Myrta
Дата:
Сообщение: Re: Concatenating multiple fetches into a single string