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

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

From: Nicholas Vinen <hb(at)x256(dot)org>
To: Klint Gore <kg(at)kgb(dot)une(dot)edu(dot)au>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, 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-26 01:57:07
Message-ID: 435EE273.4020406@x256.org (view raw or flat)
Thread:
Lists: pgsql-bugspgsql-hackers
Thanks for all this discussion, fixing, etc. I'm currently having 
"issues" getting postgres' date/time functions to do what I want. You 
have obviously spotted some of the reasons for this.

Many of my issues disappear when I use 8.1, but it's still in beta. Is 
it safe for me to use 8.1 in production, if I don't use any of the new 
features? If not, would it be possible to backport these date/time 
changes to 8.0 so that my program can operate correctly before 8.1 is 
finished beta? I can do this backporting myself if someone can point me 
to the relevant files. (I'm sure I can work it out myself if necessary, 
but I'm a little busy at the moment).


BTW, Postgres' date functions are *great* except for these minor 
problems. The best I've ever used.


Thanks!
Nicholas


Klint Gore wrote:

>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 03:01:26
Subject: Re: Sequence dependencies
Previous:From: Christopher Kings-LynneDate: 2005-10-26 01:29:27
Subject: Re: SQL99 compat list

pgsql-bugs by date

Next:From: ToddDate: 2005-10-26 02:28:47
Subject: BUG #2000: psql does not prompt for password
Previous:From: Klint GoreDate: 2005-10-25 23:45:10
Subject: Re: BUG #1993: Adding/subtracting negative time intervals

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