Re: Ambiguous error message

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Ambiguous error message
Дата
Msg-id 17379.1073090868@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Ambiguous error message  (Samuel Tardieu <sam@rfc1149.net>)
Список pgsql-sql
Samuel Tardieu <sam@rfc1149.net> writes:
> In PostgreSQL 7.4, the following select:
> select texten, total
> from (select protocolid, count(*) as total) from ips where catid=1
>       group by protocolid order by protocolid) as c
>   inner join protocols using (protocolid);

> gives the error message:

> ERROR:  subquery in FROM must have an alias
> HINT:  For example, FROM (SELECT ...) [AS] foo.

> Why isn't the "as c" considered as an alias?

It's complaining about this part:

from (select protocolid, count(*) as total) from ips where    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

It hasn't gotten as far as noticing your mismatched parentheses and
two top-level FROM keywords yet ;-).

It would probably be helpful if this message included a cursor location...
        regards, tom lane


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

Предыдущее
От: Michael Glaesemann
Дата:
Сообщение: Re: Ambiguous error message
Следующее
От: Samuel Tardieu
Дата:
Сообщение: Re: Ambiguous error message