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

From Scott Marlowe
Subject Re: [SQL] Interval subtracting
Date
Msg-id 1141245396.18820.16.camel@state.g2switchworks.com
Whole thread Raw
In response to Re: [SQL] Interval subtracting  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: [SQL] Interval subtracting
Re: [SQL] Interval subtracting
List pgsql-hackers
On Wed, 2006-03-01 at 14:27, Bruce Momjian wrote:
> Scott Marlowe wrote:
> > On Wed, 2006-03-01 at 14:18, Bruce Momjian wrote:
> > > 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'.
> > 
> > There's a part of me that thinks the WHOLE THING should be positive or
> > negative:
> > 
> > -(2 months 1 day)
> 
> But it isn't '-2 months, -1 day'.  I think what you are saying is what I
> am saying, that we should make the signs consistent.

Pretty much.  It just seems wrong to have different signs in what is
essentially a single unit.

We don't say 42 degrees, -12 minutes when measuring arc, do we?  Then
again, maybe some folks do.  It just seems wrong to me.


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: pg_config, pg_service.conf, postgresql.conf ....
Next
From: Tom Lane
Date:
Subject: Re: [SQL] Interval subtracting