Re: SELECT MAX returns wrong value

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: SELECT MAX returns wrong value
Дата
Msg-id 22441.1197588758@sss.pgh.pa.us
обсуждение исходный текст
Ответ на SELECT MAX returns wrong value  (Gavin Baumanis <gavinb@eclinic.com.au>)
Список pgsql-sql
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


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

Предыдущее
От: Gavin Baumanis
Дата:
Сообщение: SELECT MAX returns wrong value
Следующее
От: Gary Stainburn
Дата:
Сообщение: odd error updating - varchar