On Fri, Oct 30, 2009 at 12:55:51AM -0400, Tom Lane wrote:
> Jeff Davis <pgsql(at)j-davis(dot)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/