From: Tom Lane <tgl@sss.pgh.pa.us>
To: Samuel Tardieu <sam@rfc1149.net>
Cc: pgsql-sql@postgresql.org
Subject: Re: Ambiguous error message
Date: Fri, 02 Jan 2004 19:47:48 -0500
Message-ID: <17379.1073090868@sss.pgh.pa.us> (raw)
In-Reply-To: <87smiy1ej9.fsf@inf.enst.fr>
References: <87smiy1ej9.fsf@inf.enst.fr>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, sam@rfc1149.net
Subject: Re: Ambiguous error message
In-Reply-To: <17379.1073090868@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox