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

From Klint Gore
Subject Re: BUG #1993: Adding/subtracting negative time intervals
Date
Msg-id 435EC3862AD.2D99KG@129.180.47.120
Whole thread Raw
In response to Re: BUG #1993: Adding/subtracting negative time intervals  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: BUG #1993: Adding/subtracting negative time intervals
Re: BUG #1993: Adding/subtracting negative time intervals
List pgsql-bugs
On Tue, 25 Oct 2005 13:28:00 -0400, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> regression=# select '2005-10-29 13:22:00-04'::timestamptz + '1 day'::interval;
>         ?column?
> ------------------------
>  2005-10-30 13:22:00-05
> (1 row)
>
> regression=# select '2005-10-30 13:22:00-05'::timestamptz - '2005-10-29 13:22:00-04'::timestamptz;
>     ?column?
> ----------------
>  1 day 01:00:00
> (1 row)
>
> ISTM that given the former result, the latter calculation ought to
> produce '1 day', not something else.

Would the '1 day' result know it was 24 hours or be the new 23/24/25
hour version of '1 day'?

If it was the new version, could you get the original values back?
i.e. what would be the result of
select
('2005-10-29 13:22:00-04'::timestamptz +
('2005-10-30 13:22:00-05'::timestamptz -
 '2005-10-29 13:22:00-04'::timestamptz)) at time zone 'EST';

klint.

+---------------------------------------+-----------------+
: Klint Gore                            : "Non rhyming    :
: EMail   : kg@kgb.une.edu.au           :  slang - the    :
: Snail   : A.B.R.I.                    :  possibilities  :
: Mail      University of New England   :  are useless"   :
:           Armidale NSW 2351 Australia :     L.J.J.      :
: Fax     : +61 2 6772 5376             :                 :
+---------------------------------------+-----------------+

pgsql-bugs by date:

Previous
From: "Jean-Pierre Pelletier"
Date:
Subject: Re: RIGHT JOIN is only supported with merge-joinable join conditions, PostgreSQL 8.1 beta3
Next
From: Bruce Momjian
Date:
Subject: Re: BUG #1993: Adding/subtracting negative time intervals