Re: min() and NaN

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>, Jean-Luc Lachance <jllachan(at)nsd(dot)ca>, "Michael S(dot) Tibbetts" <mtibbetts(at)head-cfa(dot)cfa(dot)harvard(dot)edu>, pgsql-sql(at)postgresql(dot)org
Subject: Re: min() and NaN
Date: 2003-07-22 19:33:19
Message-ID: 15160.1058902399@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)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...

regards, tom lane

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Bruce Momjian 2003-07-22 20:19:57 Re: min() and NaN
Previous Message Bruce Momjian 2003-07-22 18:59:19 Re: min() and NaN