X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 010F1D1DF48 for ; Sat, 3 Jan 2004 02:01:09 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 87688-03 for ; Fri, 2 Jan 2004 22:00:26 -0400 (AST) Received: from quality.qadas.com (quality.qadas.com [204.227.16.4]) by svr1.postgresql.org (Postfix) with ESMTP id 5BFC1D1DF7E for ; Fri, 2 Jan 2004 21:05:19 -0400 (AST) Received: from quality.qadas.com (localhost [127.0.0.1]) by quality.qadas.com (8.12.10/8.12.10) with ESMTP id i0315JJM014830; Fri, 2 Jan 2004 18:05:19 -0700 (MST) Received: (from mfuhr@localhost) by quality.qadas.com (8.12.10/8.12.10/Submit) id i0315Jcb014827; Fri, 2 Jan 2004 18:05:19 -0700 (MST) Date: Fri, 2 Jan 2004 18:05:19 -0700 From: Michael Fuhr To: Samuel Tardieu Cc: pgsql-sql@postgresql.org Subject: Re: Ambiguous error message Message-ID: <20040102180519.A12370@quality.qadas.com> References: <87smiy1ej9.fsf@inf.enst.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87smiy1ej9.fsf@inf.enst.fr>; from sam@rfc1149.net on Fri, Jan 02, 2004 at 05:49:46PM +0100 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200401/8 X-Sequence-Number: 16401 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/