Re: [BUGS] BUG #1993: Adding/subtracting negative time intervals

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Klint Gore <kg(at)kgb(dot)une(dot)edu(dot)au>, Michael Fuhr <mike(at)fuhr(dot)org>, Michael Glaesemann <grzm(at)myrealbox(dot)com>, Russell Smith <mr-russ(at)pws(dot)com(dot)au>, Nicholas <hb(at)x256(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: [BUGS] BUG #1993: Adding/subtracting negative time intervals
Date: 2005-10-26 14:49:12
Message-ID: 200510261449.j9QEnCb14461@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers


[ bugs list removed, hackers added.]

Tom Lane wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > I saw a lot of disussion because I forgot to specify that my tests were
> > for EST5EDT, but what about the use of interval_justify_hours() in
> > timestamp_mi(). Is this something we want to change?
>
> It's too late to mess with it for 8.1, but see my previous message
> proposing a set of TODO items for future work.

Yes, it is late, but I am worried about adding an interface change that
we will later revert in 8.2. In 8.0.X I see the query returning the '25
hour' answer:

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';

timezone
---------------------
2005-10-30 13:22:00
(1 row)

In current CVS the top query returns '14:22:00'. Do we change this for
8.1, then change it back in 8.2? That seems bad to me.

Actually, 8.0.X returns '1 day, 1 hour' for the subtraction, which we
treat in 8.0.X as '25 hours':

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)

In 8.0.X, because we didn't have a 'days' field, we could treat '1 day 1
hour' as always '25 hours', and could display the results as days/hours.
If we remove interval_justify_hours(), then we are always going to
display timestamp subtraction in hours (not days), e.g. '6422 hours'
(yea, ugly) unless they manually call interval_justify_hours().

Keep in mind that the addition of the interval_justify_hours() did
generate some regression test changes, so removing
interval_justify_hours() might just take the results back to what we had
in 8.0. My point is that regression changes caused by its removal might
not be a good guide to determining compatibility with 8.0.X.

I guess my point is that we are changing 8.0.X behavior so we better be
sure it is now the way we want it to remain.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2005-10-26 14:49:46 Re: BUG #2001: Signal 11 after concurrent inserts + updates
Previous Message Tom Lane 2005-10-26 14:45:03 Re: 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 14:58:30 Re: add_missing_from breaks existing views
Previous Message Michael Paesold 2005-10-26 14:48:05 Re: expanded \df+ display broken in beta4