Обсуждение: Always one row with group by / agregate

Поиск
Список
Период
Сортировка

Always one row with group by / agregate

От
"Alain TESIO"
Дата:
dip=> create table t ( x int , y int );
CREATE
dip=> select x,min(y) from t group by x;
x|min
-+---
 |
(1 row)


select min(y) should return one row with a null value, but it's
expected. I thought that the first part of the job was to process
the group by and then the select on each group, but it doesn't
seem to be the case.

Alain




Re: [BUGS] Always one row with group by / agregate

От
Tom Lane
Дата:
"Alain TESIO" <tesio@easynet.fr> writes:
> dip=> select x,min(y) from t group by x;
> x|min
> -+---
>  |
> (1 row)

Yup, that's a bug --- with GROUP BY, no rows in should yield no groups
and hence no rows out.  It's fixed for the next release.

            regards, tom lane