Re: BUG #1993: Adding/subtracting negative time intervals

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #1993: Adding/subtracting negative time intervals
Дата
Msg-id 5765.1130336349@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: BUG #1993: Adding/subtracting negative time intervals  (Andrew - Supernews <andrew+nonews@supernews.com>)
Список pgsql-bugs
Andrew - Supernews <andrew+nonews@supernews.com> writes:
> Um, what? Under what conditions is it permissable for simple arithmetic on
> (only) timestamptz values (which may have originated in different timezones
> neither of which is the current one) to be dependent on the current timezone
> setting?

Timestamp subtraction will give different answers depending on whether
there's a DST adjustment in between.

regression=# select '2005-10-31'::timestamptz - '2005-10-28'::timestamptz;
    ?column?
-----------------
 3 days 01:00:00
(1 row)

regression=# set timezone = 'Japan';
SET
regression=# select '2005-10-31'::timestamptz - '2005-10-28'::timestamptz;
 ?column?
----------
 3 days
(1 row)

BTW, if we were doing subtraction symbolically as I think we should,
these *would* give the same answer, ie, '3 days' in both cases.  Care to
rethink your opposition to that idea?

            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: BUG #1993: Adding/subtracting negative time intervals
Следующее
От: "Kevin Grittner"
Дата:
Сообщение: Re: BUG #1993: Adding/subtracting negative time