Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 72F1F2E0104 for ; Mon, 3 Dec 2007 02:13:36 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 09942-03 for ; Mon, 3 Dec 2007 02:13:33 -0400 (AST) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id AEAC62E00F6 for ; Mon, 3 Dec 2007 02:13:33 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.1/8.14.1) with ESMTP id lB36DTIQ009789; Mon, 3 Dec 2007 01:13:29 -0500 (EST) To: "Joost Kraaijeveld" cc: pgsql-sql@postgresql.org Subject: Re: alias required by standard or PostgreSQL? In-reply-to: <1196661149.5542.33.camel@panoramix.askesis.nl> References: <1196661149.5542.33.camel@panoramix.askesis.nl> Comments: In-reply-to "Joost Kraaijeveld" message dated "Mon, 03 Dec 2007 06:52:29 +0100" Date: Mon, 03 Dec 2007 01:13:29 -0500 Message-ID: <9788.1196662409@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200712/3 X-Sequence-Number: 29695 "Joost Kraaijeveld" writes: > "select * from (select * from table_name)" > PostgreSQL complains with > ERROR: subquery in FROM must have an alias > HINT: For example, FROM (SELECT ...) [AS] foo. > Is the alias required by the ISO standard Yes. A FROM-clause entry is defined as ::=
[ [ AS ] [ ] ] | [ AS ] [ ] | ::=
Note that the brackets show that a (ie, an alias) is optional for a regular table, but not for a subquery. regards, tom lane