Re: Absolute value of intervals - Mailing list pgsql-general

From Sam Mason
Subject Re: Absolute value of intervals
Date
Msg-id 20091030112513.GX5407@samason.me.uk
Whole thread Raw
In response to Re: Absolute value of intervals  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Absolute value of intervals
List pgsql-general
On Fri, Oct 30, 2009 at 12:55:51AM -0400, Tom Lane wrote:
> Jeff Davis <pgsql@j-davis.com> writes:
> > Yes, that is a strange case. When you can't tell if an interval is
> > positive or negative, how do you define the absolute value?
>
> That was the point of my '1 day -25 hours' example.  Whether you
> consider that positive or negative seems mighty arbitrary.

My personal feeling is that when you provide any ordering operator and
negation you can easily provide an absolute value operator.  We've
already (somewhat arbitrarily) decided that one of '1month -30days' and
'-1month 30days) is "greater" than the other, so why not provide an
operator that returns the "greater" of an interval value and its own
negation?

--
  Sam  http://samason.me.uk/

pgsql-general by date:

Previous
From: Steve Clark
Date:
Subject: Re: checkpoints/bgwriter tuning verification
Next
From: Marko Kreen
Date:
Subject: Re: Absolute value of intervals