Re: Interval Question
От
Tom Lane
Тема
Re: Interval Question
Дата
Msg-id
16557.1105456741@sss.pgh.pa.us
Ответ на
Interval Question (Terry Lee Tucker)
Список
Дерево обсуждения
Interval Question Terry Lee Tucker <terry@esc1.com>
Re: Interval Question Tom Lane <tgl@sss.pgh.pa.us>
Re: Interval Question Terry Lee Tucker <terry@esc1.com>
Re: Interval Question Terry Lee Tucker <terry@esc1.com>
Re: Interval Question Tom Lane <tgl@sss.pgh.pa.us>
Re: Interval Question Terry Lee Tucker <terry@esc1.com>
Re: Interval Question Geoffrey <esoteric@3times25.net>
Re: Interval Question Tom Lane <tgl@sss.pgh.pa.us>
Re: Interval Question Marco Colombo <pgsql@esiway.net>
Re: Interval Question Terry Lee Tucker <terry@esc1.com>
Re: Interval Question Stephan Szabo <sszabo@megazone.bigpanda.com>
Re: Interval Question Timothy Perrigo <tperrigo@wernervas.com>
Re: Interval Question Terry Lee Tucker <terry@esc1.com>
Terry Lee Tucker writes:
> I thought that subtracting the larger interval from
> the small would return this but it is always the absolute value.
Eh?
regression=# set DateStyle TO ISO;
SET
regression=# select '@ 3 days 4 hours 17 mins'::interval -
regression-# '@ 3 days 6 hours 17 mins'::interval;
?column?
-----------
-02:00:00
(1 row)
regression=# set DateStyle TO postgres;
SET
regression=# select '@ 3 days 4 hours 17 mins'::interval -
regression-# '@ 3 days 6 hours 17 mins'::interval;
?column?
---------------
@ 2 hours ago
(1 row)
and as for detecting whether it's negative,
regression=# select ('@ 3 days 4 hours 17 mins'::interval -
regression(# '@ 3 days 6 hours 17 mins'::interval) < '0'::interval;
?column?
----------
t
(1 row)
regards, tom lane
В списке pgsql-general по дате отправления