Re: min() and NaN - Mailing list pgsql-sql

From Bruce Momjian
Subject Re: min() and NaN
Date
Msg-id 200307222019.h6MKJvP20649@candle.pha.pa.us
Whole thread Raw
In response to Re: min() and NaN  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-sql
Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > Well, my 2 cents is that though we consider NULL when ordering via ORDER
> > BY, we ignore it in MAX because it really isn't a value, and NaN seems
> > to be similar to NULL.
> 
> Good idea, but I don't think we can get away with it.  The spec says
> that MAX/MIN have to be consistent with the comparison operators (and
> therefore with ORDER BY):
> 
>             iii) If MAX or MIN is specified, then the result is respec-
>                  tively the maximum or minimum value in TXA. These results
>                  are determined using the comparison rules specified in
>                  Subclause 8.2, "<comparison predicate>".
> 
> NULL can be special, because it acts specially in comparisons anyway.
> But NaN is just a value of the datatype.
> 
> I'd be willing to go against the spec if I thought that having
> ignore-NaNs behavior was sufficiently important, but I don't think it's
> important enough to disregard the spec...

Yep.

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: min() and NaN
Next
From: Robert Treat
Date:
Subject: obtuse plpgsql function needs