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

From Hannu Krosing
Subject Re: [SQL] Interval subtracting
Date
Msg-id 1141244920.3737.10.camel@localhost.localdomain
Whole thread Raw
In response to Re: [SQL] Interval subtracting  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: [SQL] Interval subtracting  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
Re: [SQL] Interval subtracting  (Bruce Momjian <pgman@candle.pha.pa.us>)
Re: [SQL] Interval subtracting  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: [SQL] Interval subtracting  (Mark Dilger <pgsql@markdilger.com>)
List pgsql-hackers
Ühel kenal päeval, K, 2006-03-01 kell 15:18, kirjutas Bruce Momjian:
> Stephan Szabo wrote:
> > > justify_days doesn't currently do anything with this result --- it
> > > thinks its charter is only to reduce day components that are >= 30 days.
> > > However, I think a good case could be made that it should normalize
> > > negative days too; that is, the invariant on its result should be
> > > 0 <= days < 30, not merely days < 30.
> > 
> > What about cases like interval '1 month -99 days', should that turn into
> > interval '-3 mons +21 days' or '-2 mons -9 days'?
> 
> I think it should be the later.  It is best to have a single sign, and I
> think it is possible in all cases:
> 
>     '2 mons -1 days'
> 
> could be adjusted to '1 mons 29 days'.

But unfortunately '2 mons -1 days' <> '1 mons 29 days'

If I want something to happen 1 day less than two months from dome date,
then the only way to say that consistently *is* '2 mons -1 days'.

--------------
Hannu





pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [SQL] Interval subtracting
Next
From: Stephan Szabo
Date:
Subject: Re: [SQL] Interval subtracting