Re: count(*) of zero rows returns 1

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: count(*) of zero rows returns 1
Дата
Msg-id 26206.1358265071@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: count(*) of zero rows returns 1  (Gurjeet Singh <singh.gurjeet@gmail.com>)
Список pgsql-hackers
Gurjeet Singh <singh.gurjeet@gmail.com> writes:
> On Mon, Jan 14, 2013 at 4:15 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> David Johnston <polobo@yahoo.com> writes:
>>> SELECT *;
>>> Results in:
>>> SQL Error: ERROR:  SELECT * with no tables specified is not valid

> Interesting to note that SELECT * FROM table_with_zero_cols does not
> complain of anything.

Yeah.  IIRC that error check long predates our support for zero-column
tables (which we allowed when we introduced ALTER TABLE DROP COLUMN,
so that dropping the only column doesn't have to be an error case).
You could argue that the existence of zero-column tables makes the
error check inconsistent, but I think it's probably good as-is.  The
possibility that "*" can sometimes validly expand to no columns doesn't
mean that "SELECT *;" isn't almost surely a typo.
        regards, tom lane



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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: ALTER command reworks
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: pg_ctl idempotent option