GROUP BY and empty queries
От | Jochen Scharrlach |
---|---|
Тема | GROUP BY and empty queries |
Дата | |
Msg-id | 376E1941.CA6E3774@mgm-net.de обсуждение исходный текст |
Список | pgsql-general |
Hi, sorry if this is a FAQ, but I have a bit trouble with PostgreSQL 6.5 on a RedHat 5.2 machine: ----snip---- js=> create table testi (number int, name varchar(40)); CREATE js=> insert into testi values (1, 'myname'); INSERT 151274 1 js=> select sum(number) from testi where name='myname'; sum --- 1 (1 row) js=> select * from testi where name='notthere'; number|name ------+---- (0 rows) js=> select sum(number) , name from testi where name='notthere' group by name; sum|name ---+---- | (1 row) ----snip---- This crashes my little app (because of the empty row) which works fine with Oracle: ----snip---- SQL> create table testi (n int, name varchar(40)); Table created. SQL> insert into testi values (1, 'myname'); 1 row created. SQL> select sum(n) from testi where name='myname'; SUM(N) ---------- 1 SQL> select * from testi where name='notthere'; no rows selected SQL> select sum(n), name from testi where name='notthere' group by name; no rows selected ----snip---- Which is the buggy one: Oracle, PostgreSQL or my Java-app? Thanls, Jochen
В списке pgsql-general по дате отправления: