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 D7BD2D1DAFC for ; Sat, 3 Jan 2004 02:23:24 +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 90123-06 for ; Fri, 2 Jan 2004 22:22:42 -0400 (AST) Received: from lists.frmug.org (frmug-gw.frmug.org [193.56.58.252]) by svr1.postgresql.org (Postfix) with ESMTP id 6C31CD1D8EB for ; Fri, 2 Jan 2004 21:34:20 -0400 (AST) Received: by lists.frmug.org (Postfix/TLS, from userid 66) id 2393720FE8; Sat, 3 Jan 2004 02:34:33 +0100 (CET) Received: (from elrond@localhost) by memo.frmug.org (8.11.6/8.11.6) id i031UYO05200 for pgsql-sql@postgresql.org; Sat, 3 Jan 2004 02:30:34 +0100 (CET) (envelope-from pgsql-sql@phoe.frmug.org) X-Authentication-Warning: memo.frmug.org: elrond set sender to pgsql-sql@phoe.frmug.org using -f Date: Sat, 3 Jan 2004 02:30:34 +0100 From: Bertrand Petit To: pgsql-sql@postgresql.org Subject: Re: Ambiguous error message Message-ID: <20040103023034.A5150@memo.frmug.org> Mail-Followup-To: pgsql-sql@postgresql.org References: <87smiy1ej9.fsf@inf.enst.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i 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/10 X-Sequence-Number: 16403 On Fri, Jan 02, 2004 at 05:49:46PM +0100, Samuel Tardieu wrote: > > select texten, total > from (select protocolid, count(*) as total) from ips where catid=1 ^ +--- There > 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? That's maybe due to the highlighted spurious parenthesis. -- %!PS 297.6 420.9 translate 90 rotate 0 setgray gsave 0 1 1{pop 0 180 moveto 100 180 170 100 170 -10 curveto 180 -9 180 -9 190 -10 curveto 190 100 100 180 0 180 curveto fill 180 rotate}for grestore/Bookman-LightItalic findfont 240 scalefont setfont -151.536392 -63.7998886 moveto (bp)show showpage