Re: Ambiguous error message

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Samuel Tardieu <sam(at)rfc1149(dot)net>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Ambiguous error message
Date: 2004-01-03 01:05:19
Message-ID: 20040102180519.A12370@quality.qadas.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Fri, Jan 02, 2004 at 05:49:46PM +0100, Samuel Tardieu wrote:
> 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?

The query has a right parenthesis after "as total" that looks like
it shouldn't be there.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Andy Lewis 2004-01-03 01:15:49 sort by on two columns
Previous Message Samuel Tardieu 2004-01-03 00:56:19 Re: Ambiguous error message