Received: from sss.pgh.pa.us ([192.204.191.242]) by postgresql.org (8.11.3/8.11.4) with ESMTP id f7GMCiP56719 for ; Thu, 16 Aug 2001 18:12:44 -0400 (EDT) (envelope-from tgl@sss.pgh.pa.us) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id f7GMCVY25975; Thu, 16 Aug 2001 18:12:32 -0400 (EDT) To: "Josh Berkus" cc: Oleg Lebedev , pgsql-sql@postgresql.org Subject: Re: Nested JOINs In-reply-to: References: Comments: In-reply-to "Josh Berkus" message dated "Thu, 16 Aug 2001 14:44:31 -0700" Date: Thu, 16 Aug 2001 18:12:31 -0400 Message-ID: <25972.997999951@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200108/226 X-Sequence-Number: 4458 "Josh Berkus" writes: > Second, you can't alias a JOINed set of tables; Actually you can, according to my reading of SQL92: ::=
[ [ AS ] [ ] ] | [ AS ] [ ] | ::=
::= ::= ::= | ::= | | ::=
[ NATURAL ] [ ] JOIN
[ ] So a parenthesized is a and may be followed by [ AS ] . 7.1 gets this right. 7.0's very preliminary implementation of JOIN syntax did not. (It had a number of other bugs too, IIRC.) The spec's grammar is horribly badly written: it's ambiguous whether the parentheses should be parsed as part of a second-level which would imply that a correlation name would NOT be accepted. It took a fair amount of work to derive a grammar that was unambiguous and still accepted everything... regards, tom lane