Re: BUG #9265: why the same interval can't get the same timestamp?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #9265: why the same interval can't get the same timestamp?
Дата
Msg-id 23717.1392733577@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #9265: why the same interval can't get the same timestamp?  (miaoyimin@huawei.com)
Список pgsql-bugs
miaoyimin@huawei.com writes:
> postgres=# select ('epoch'::pg_catalog.timestamptz + 1386201600 * '1
> second'::pg_catalog.interval);
>         ?column?
> ------------------------
>  2013-12-05 08:00:00+08
> (1 row)

> postgres=# select ('epoch'::pg_catalog.timestamptz + 16044 * '1
> day'::pg_catalog.interval);
>         ?column?
> ------------------------
>  2013-12-05 07:30:00+08
> (1 row)

It's intentional that those don't give the same result.  Adding days
is DST-aware, adding seconds is not.  Since the epoch in that zone
was

# select 'epoch'::pg_catalog.timestamptz;
        timestamptz
---------------------------
 1970-01-01 07:30:00+07:30
(1 row)

adding any number of days to it will produce 07:30 local time on
the selected day, even though the zone offset changes.

            regards, tom lane

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

Предыдущее
От: Vik Fearing
Дата:
Сообщение: Re: BUG #9265: why the same interval can't get the same timestamp?
Следующее
От: Francisco Olarte
Дата:
Сообщение: Re: BUG #9265: why the same interval can't get the same timestamp?