select MIN/MAX when no row selected

Поиск
Список
Период
Сортировка
От Ricardo Coelho
Тема select MIN/MAX when no row selected
Дата
Msg-id 002401bf30e3$c1a6b260$03fafdc8@px.com.br
обсуждение исходный текст
Список pgsql-hackers
Hi All,

I think I had read this question with count(*) before.....

PgSql returns one row with a null field when we use select MIN or MAX on a
table, but the result should be "no rows selected".

I didn't try with C function, but I got the same result with psql.

So, I'm sending a Java example to Peter.

try {   rs=stmt.executeQuery("select min(field1) from tab where
field1>maxValueOfField1");   if (rs.next()) {       System.out.println("I found a row !!!!");
theResult=rs.getString(1);      if (theResult==null)           System.out.println("Min of field1 is NULL !!!!");   }
 
} catch (.............

maxValueofField1 = select max(field1) from tab;

Is it correct ?

I'm using PgSql 6.5.2, RHLinux/Intel 6.0

Thanks,

Ricardo Coelho.





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

Предыдущее
От: wieck@debis.com (Jan Wieck)
Дата:
Сообщение: regression tests
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: [HACKERS] Re: Postgresql Docs....