On Dec 13, 2007 5:09 PM, Gavin Baumanis <[EMAIL PROTECTED]> wrote: > Hi Everyone, > > Sorry if I am missing something obvious but I think I have found a bug. > If I perform the following SQL > > SELECT MAX(column) FROM table WHERE expression > > and there is no match, Postgres returns a record count of 1. > There is no value in max, it is NULL.
that's because you got one record back. A null one, but a record none the less. The standard way of doing this is: select count(column) from table where expression. since null columns don't get counted, it will return zero if they're all null. ---------------------------(end of broadcast)--------------------------- TIP 6: explain analyze is your friend