From: David G Johnston <david.g.johnston@gmail.com>
To: pgsql-bugs@postgresql.org
Subject: Re: BUG #12000: "CROSS JOIN" not equivalent to ","
Date: Tue, 18 Nov 2014 10:42:39 -0700 (MST)
Message-ID: <1416332559606-5827398.post@n5.nabble.com> (raw)
In-Reply-To: <20141118171126.2479.55006@wrigleys.postgresql.org>
References: <20141118171126.2479.55006@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: david.g.johnston@gmail.com
Subject: Re: BUG #12000: "CROSS JOIN" not equivalent to ","
In-Reply-To: <1416332559606-5827398.post@n5.nabble.com>
References: <20141118171126.2479.55006@wrigleys.postgresql.org> <1416332559606-5827398.post@n5.nabble.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox