Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
Thread:
Lists: pgsql-bugspgsql-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

pgsql-hackers by date

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

pgsql-bugs by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group