Re: [SQL] Interval subtracting - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [SQL] Interval subtracting
Date
Msg-id 16569.1141253147@sss.pgh.pa.us
Whole thread Raw
In response to Re: [SQL] Interval subtracting  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: [SQL] Interval subtracting  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-hackers
Bruce Momjian <pgman@candle.pha.pa.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


pgsql-hackers by date:

Previous
From: Mark Kirkwood
Date:
Subject: Re: pg_config, pg_service.conf, postgresql.conf ....
Next
From: Mark Dilger
Date:
Subject: Re: [SQL] Interval subtracting