Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Xqmnf-0004DX-PT for pgsql-bugs@arkaria.postgresql.org; Tue, 18 Nov 2014 17:42:47 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Xqmne-0000q7-HR for pgsql-bugs@arkaria.postgresql.org; Tue, 18 Nov 2014 17:42:46 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Xqmnc-0000py-AC for pgsql-bugs@postgresql.org; Tue, 18 Nov 2014 17:42:44 +0000 Received: from [162.253.133.43] (helo=mwork.nabble.com) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XqmnY-00022Q-PW for pgsql-bugs@postgresql.org; Tue, 18 Nov 2014 17:42:42 +0000 Received: from msam.nabble.com (unknown [162.253.133.85]) by mwork.nabble.com (Postfix) with ESMTP id C2FAFA6CDDE for ; Tue, 18 Nov 2014 09:42:40 -0800 (PST) Date: Tue, 18 Nov 2014 10:42:39 -0700 (MST) From: David G Johnston To: pgsql-bugs@postgresql.org Message-ID: <1416332559606-5827398.post@n5.nabble.com> In-Reply-To: <20141118171126.2479.55006@wrigleys.postgresql.org> References: <20141118171126.2479.55006@wrigleys.postgresql.org> Subject: Re: BUG #12000: "CROSS JOIN" not equivalent to "," MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Host-Lookup-Failed: Reverse DNS lookup failed for 162.253.133.43 (failed) X-Pg-Spam-Score: 0.5 (/) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Dr. Andreas Kunert wrote > According to the documentation > http://www.postgresql.org/docs/9.3/static/queries-table-expressions.html > (7.2.1.1): > "FROM T1 CROSS JOIN T2 is equivalent to FROM T1, T2" > > However, in the following example the SQL-Query using "CROSS JOIN" works, > while the usage of "," results in an invalid reference: > > table1 a > , table1 b > left outer join table2 c on a.x = y and b.x = z; It does not say that: A, B JOIN C is equivalent to A CROSS JOIN B JOIN C The "," introduces lower precedence operator to the mix and so the B JOIN C is evaluated first and the corresponding "ON" clause can only refer to those two tables. In effect you are writing: FROM A, (B JOIN C) I personally find the use of "," in the FROM-clause to be poor form and its even worse if you decide to mix both "," and explicit JOIN clauses. If you want to make this be explained better feel free to provide suggestions; but I'd suggest you simply forget the fact that "FROM A, B" is even valid and just use the proper joining keywords instead. Given this does not work as far back at 9.0 I would say that it is not a bug. Nor do I believe it is particularly under-documented; its just complicated because of the mixing of two separate concepts. David J. -- View this message in context: http://postgresql.nabble.com/BUG-12000-CROSS-JOIN-not-equivalent-to-tp5827394p5827398.html Sent from the PostgreSQL - bugs mailing list archive at Nabble.com. -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs