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

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

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Klint Gore <kg(at)kgb(dot)une(dot)edu(dot)au>,Russell Smith <mr-russ(at)pws(dot)com(dot)au>, pgsql-bugs(at)postgresql(dot)org,Nicholas <hb(at)x256(dot)com>
Subject: Re: BUG #1993: Adding/subtracting negative time intervals
Date: 2005-10-25 03:45:17
Message-ID: 20051025034517.GA33298@winnie.fuhr.org (view raw or flat)
Thread:
Lists: pgsql-bugspgsql-hackers
On Mon, Oct 24, 2005 at 11:21:52PM -0400, Tom Lane wrote:
> Klint Gore <kg(at)kgb(dot)une(dot)edu(dot)au> writes:
> > That's changed since v7.4.7
> 
> Yup.  '1 week' = '7 days' which is no longer the same as 7*24 hours.
> In particular, as of 8.1 local noon plus one day is still local noon,
> even if there was a DST change in between.  Adding 24 hours, on the
> other hand, might give 11am or 1pm.

Should 24 hours be the same as 1 * 24 hours?  The latter appears
to be equal to 1 day, not 24 hours:

test=> SELECT '2005-10-29 12:00:00-06'::timestamptz + '24 hours'::interval;
        ?column?        
------------------------
 2005-10-30 11:00:00-07
(1 row)

test=> SELECT '2005-10-29 12:00:00-06'::timestamptz + 1 * '24 hours'::interval;
        ?column?        
------------------------
 2005-10-30 12:00:00-07
(1 row)

test=> SELECT '2005-10-29 12:00:00-06'::timestamptz + '1 day'::interval;
        ?column?        
------------------------
 2005-10-30 12:00:00-07
(1 row)

-- 
Michael Fuhr

In response to

Responses

pgsql-hackers by date

Next:From: markDate: 2005-10-25 03:55:07
Subject: Re: PG Killed by OOM Condition
Previous:From: Bruce MomjianDate: 2005-10-25 03:41:11
Subject: Re: [GENERAL] 'a' == 'a '

pgsql-bugs by date

Next:From: Tom LaneDate: 2005-10-25 04:03:58
Subject: Re: BUG #1993: Adding/subtracting negative time intervals
Previous:From: Michael FuhrDate: 2005-10-25 03:38:26
Subject: Re: BUG #1993: Adding/subtracting negative time intervals

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