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

From: Klint Gore <kg(at)kgb(dot)une(dot)edu(dot)au>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Michael Fuhr <mike(at)fuhr(dot)org>, Michael Glaesemann <grzm(at)myrealbox(dot)com>, Russell Smith <mr-russ(at)pws(dot)com(dot)au>, pgsql-bugs(at)postgresql(dot)org, Nicholas <hb(at)x256(dot)com>, Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Subject: Re: BUG #1993: Adding/subtracting negative time intervals
Date: 2005-10-25 23:45:10
Message-ID: 435EC3862AD.2D99KG@129.180.47.120
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On Tue, 25 Oct 2005 13:28:00 -0400, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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(at)kgb(dot)une(dot)edu(dot)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 : :
+---------------------------------------+-----------------+

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Nicholas Vinen 2005-10-26 01:57:07 Re: BUG #1993: Adding/subtracting negative time intervals
Previous Message Seneca Cunningham 2005-10-25 22:01:41 BUG #1999: contrib/spi doesn't receive the configured CFLAGS

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2005-10-26 00:03:16 Re: [HACKERS] expanded \df+ display broken in beta4
Previous Message Simon Riggs 2005-10-25 23:13:43 Re: add_missing_from breaks existing views