Re: [HACKERS] bug with aggregates

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [HACKERS] bug with aggregates
Дата
Msg-id 15478.929205752@sss.pgh.pa.us
обсуждение исходный текст
Ответ на bug with aggregates  (Massimo Dal Zotto <dz@cs.unitn.it>)
Список pgsql-hackers
Massimo Dal Zotto <dz@cs.unitn.it> writes:
> dz=> select count(1) from my_table;
> pqReadData() -- backend closed the channel unexpectedly.

Further notes --- I find that you can get the same crash with no table
at all,    select count(1);

6.4.2 executes both queries --- but curiously enough, it produces "1"
regardless of the size of the table you mention, which is not surprising
when you look at its plan ... it optimizes out the scan of the table
entirely.  But if you do    select a,count(1) from table group by a;
then you get a count of the number of rows in each group, which is more
or less what I'd expect.  This behavior is not consistent with the
ungrouped case.

After a quick gander at the SQL spec, I see no evidence that either of
these queries is allowed by the spec.  I'm inclined to think that
"select count(1);" ought to be disallowed and "select count(1) from
my_table;" ought to be treated the same as "select count(*) from
my_table;", like it is in the grouped case.  Comments?
        regards, tom lane


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] bug with aggregates
Следующее
От: Hannu Krosing
Дата:
Сообщение: Re: [HACKERS] Postgres 6.5 beta2 and beta3 problem