min() and NaN

Поиск
Список
Период
Сортировка
От Michael S. Tibbetts
Тема min() and NaN
Дата
Msg-id 3F145162.7010805@head-cfa.harvard.edu
обсуждение исходный текст
Ответы Re: min() and NaN  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: min() and NaN  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
Список pgsql-sql
Hi,

I have a table containing a double precision column. That column 
contains at least one judiciously placed NaN.

I'd expect the aggregate function min() to return the minimum, valid 
numeric value.  Instead, it seems to return the minimum value from the 
subset of rows following the 'NaN'.

What's going here?  What should I expect the aggregate function min() to 
return in this case?  And why?

Any help is appreciated,
Mike


testdb=> \d min_with_nan      Table "public.min_with_nan" Column |       Type       | Modifiers
--------+------------------+----------- col1   | double precision |

testdb=> select * from min_with_nan ; col1
------- 3.141 2.718   NaN    10
(4 rows)

testdb=> select min(col1) from min_with_nan ; min
-----  10
(1 row)

testdb=> select min(col1) from min_with_nan where col1 != 'NaN';  min
------- 2.718
(1 row)



В списке pgsql-sql по дате отправления:

Предыдущее
От: "Viorel Dragomir"
Дата:
Сообщение: Re: summing tables
Следующее
От: Raymond Chui
Дата:
Сообщение: Timestamp problem