From: | Adam Mackler <pgsql-novice(at)mackler(dot)org> |
---|---|
To: | pgsql-novice(at)postgresql(dot)org |
Subject: | Equivalence of CROSS JOIN and comma |
Date: | 2012-10-15 04:39:35 |
Message-ID: | 20121015043935.GA37814@bk.macklerlaw.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
Hi:
The PostgreSQL manual [1] reads in part:
"FROM T1 CROSS JOIN T2 is equivalent to FROM T1, T2."
Yet here are two statements that are identical to each other except
that one has a CROSS JOIN where the other has a comma:
WITH t1 (val) AS ( VALUES (1) ),
t2 (name) AS ( VALUES ('foo') ),
t3 (num) AS ( VALUES (1) )
SELECT * FROM t1 CROSS JOIN t2 JOIN t3 ON num=val;
WITH t1 (val) AS ( VALUES (1) ),
t2 (name) AS ( VALUES ('foo') ),
t3 (num) AS ( VALUES (1) )
SELECT * FROM t1, t2 JOIN t3 ON num=val;
and one works but the other doesn't. To my way of thinking, they are not
equivalent, which makes me wonder if I am misunderstanding the quoted
text above to mean that both statements should have the same result.
What am I missing?
I am using version 9.2.0.
Thanks very munch in advance.
[1] http://www.postgresql.org/docs/9.2/interactive/queries-table-expressions.html#QUERIES-JOIN
--
Adam Mackler
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2012-10-15 13:52:37 | Re: Equivalence of CROSS JOIN and comma |
Previous Message | Josh Kupershmidt | 2012-10-12 22:12:38 | Re: check if type is valid pg type |