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 043BED1DF27 for ; Sat, 3 Jan 2004 01:52:01 +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 86177-06 for ; Fri, 2 Jan 2004 21:51:18 -0400 (AST) Received: from mail.rfc1149.net (marvin.enst.fr [137.194.161.2]) by svr1.postgresql.org (Postfix) with ESMTP id 481DFD1E146 for ; Fri, 2 Jan 2004 20:56:11 -0400 (AST) Received: from beeblebrox.rfc1149.net (beeblebrox-tun.enst.fr [137.194.161.40]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "beeblebrox.rfc1149.net", Issuer "Top-level signer" (verified OK)) by mail.rfc1149.net (Postfix) with ESMTP id ECEEFA8093; Sat, 3 Jan 2004 01:56:19 +0100 (CET) Received: by beeblebrox.rfc1149.net (Postfix, from userid 1000) id 3D374AA7; Sat, 3 Jan 2004 01:56:19 +0100 (CET) Date: Sat, 3 Jan 2004 01:56:19 +0100 To: Michael Glaesemann Cc: pgsql-sql@postgresql.org Subject: Re: Ambiguous error message References: <87smiy1ej9.fsf@inf.enst.fr> <3DB0CA70-3D86-11D8-A298-000A95C88220@myrealbox.com> <2004-01-03-01-55-12+trackit+sam@rfc1149.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2004-01-03-01-55-12+trackit+sam@rfc1149.net> User-Agent: Mutt/1.5.5.1i From: Samuel Tardieu Organization: RFC 1149 (see http://www.rfc1149.net/) Content-Transfer-Encoding: 8bit Precedence: special-delivery X-WWW: http://www.rfc1149.net/sam X-Mail-Processing: Sam's procmail tools X-Jabber: (see http://www.jabber.org/) X-OpenPGP-Fingerprint: 79C0 AE3C CEA8 F17B 0EF1 45A5 F133 2241 1B80 ADE6 (see http://www.gnupg.org/) X-Sam-Laptop: yes Message-Id: <2004-01-03-01-56-19+trackit+sam@rfc1149.net> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200401/7 X-Sequence-Number: 16400 On 3/01, Samuel Tardieu wrote: | On 2/01, Michael Glaesemann wrote: | | | I'm not quite sure what you want the query to return, but you've got a | | problem with your parentheses. | | I can't believe this :) I got hit by the "inner query needs to be aliased" | message and added it to the wrong place and them munged the query a lot. | | The correct one was of course: | # 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); (with the "order by" part moved at the end of the query to avoid losing the order during the inner join) Sam