Re: Inconsistent time interval formatting

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Inconsistent time interval formatting
Дата
Msg-id 20736.1294964610@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Inconsistent time interval formatting  (Allen Chen <rocklob@gmail.com>)
Список pgsql-general
Allen Chen <rocklob@gmail.com> writes:
>> That won't really help.  The fundamental point here is that '1 day' is
>> not the same concept as '24 hours', because of DST changes; and the
>> interval type treats them as different.

> I don't understand how DST changes matter for a time interval or how that
> could even be factored into calculations.  Could you elaborate on that?

The main case where it matters is timestamp plus or minus interval.
As an example, 2011-03-13 is a DST transition day where I live.  So:

regression=# select '2011-03-13 01:00'::timestamptz;
      timestamptz
------------------------
 2011-03-13 01:00:00-05
(1 row)

regression=# select '2011-03-13 01:00'::timestamptz + '1 day'::interval;
        ?column?
------------------------
 2011-03-14 01:00:00-04
(1 row)

regression=# select '2011-03-13 01:00'::timestamptz + '24 hours'::interval;
        ?column?
------------------------
 2011-03-14 02:00:00-04
(1 row)

"Add 1 day" means "produce the same local time on the next day", whereas
"add 24 hours" means exactly that.

            regards, tom lane

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

Предыдущее
От: Dan Birken
Дата:
Сообщение: Re: Question about concurrent synchronous and asynchronous commits
Следующее
От: Nimesh Satam
Дата:
Сообщение: Stuck "idle in transaction (aborted)"