Group: pgsql.sql


Subject: SELECT MAX returns wrong value
From: tgl@sss.pgh.pa.us (Tom Lane)
Date: 12/13/2007 6:32:38 PM
Gavin Baumanis <gavinb@eclinic.com.au> writes: > 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. This is the behavior required by the SQL standard. > Thus trying to perform some "other" tasks based on if a record was > returned or not is proving a little difficult in this instance. Test for null result, perhaps? regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match