Re: [SQL] Interval subtracting

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Mark Dilger <pgsql(at)markdilger(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [SQL] Interval subtracting
Date: 2006-03-01 22:45:47
Message-ID: 16569.1141253147@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches pgsql-sql

Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> Imagine this:

> '1 mons -2 days -12:00:00'

> Which sign do we head to for this? For justify_hours, if we don't look
> at the months it remains unchange, but calling justify_days we get:

> '28 days -12:00:00'

> which is wrong (negative and positive).

Ugh, that's not good.

Based on that, I guess I have to change my vote: justify_hours should
still not look at the month (because it shouldn't use the month=30days
assumption), but justify_days should be changed to be effectively a
combination of both functions --- that is, it should fix all three
fields using both the 30days and the 24hours assumptions. Then it could
guarantee that all come out with the same sign.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2006-03-01 22:54:02 Re: implement prepared queries in plperl
Previous Message Bruce Momjian 2006-03-01 22:42:40 Re: implement prepared queries in plperl

Browse pgsql-patches by date

  From Date Subject
Next Message Andrew Dunstan 2006-03-01 22:54:02 Re: implement prepared queries in plperl
Previous Message Bruce Momjian 2006-03-01 22:42:40 Re: implement prepared queries in plperl

Browse pgsql-sql by date

  From Date Subject
Next Message Mark Dilger 2006-03-01 22:54:35 Re: [SQL] Interval subtracting
Previous Message Mark Dilger 2006-03-01 22:30:11 Re: [SQL] Interval subtracting