Re: BUG #1993: Adding/subtracting negative time intervals - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #1993: Adding/subtracting negative time intervals
Date
Msg-id 1827.1130301486@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #1993: Adding/subtracting negative time intervals  (Klint Gore <kg@kgb.une.edu.au>)
List pgsql-bugs
Klint Gore <kg@kgb.une.edu.au> writes:
> On Tue, 25 Oct 2005 23:41:54 -0400 (EDT), Bruce Momjian
> <pgman@candle.pha.pa.us> wrote:
>> test=> select
>> test-> ('2005-10-30 13:22:00-05'::timestamptz -
>> test(>  '2005-10-29 13:22:00-04'::timestamptz);
>> ?column?
>> ----------
>> 25:00:00
>> (1 row)

> Is that actually the correct answer?

I'm of the opinion that the correct answer, or at least the usually
desired answer, is "1 day".

> Disregarding daylight savings, there is 25hrs between them.  Once
> daylight savings is taken into account there should be 24 or 26 hours
> between them (southern/northern hemisphere respectively).

If you want the numeric "25 hours" answer, you can always extract(epoch)
from both of them and subtract.  There isn't any way to get a symbolic
"1 day" answer unless we make timestamp subtraction provide it.

            regards, tom lane

pgsql-bugs by date:

Previous
From: John R Pierce
Date:
Subject: Re: BUG #1993: Adding/subtracting negative time intervals
Next
From: Tom Lane
Date:
Subject: Re: BUG #1993: Adding/subtracting negative time intervals