BUG #7653: Minor problem with join condition
The following bug has been logged on the website:
Bug reference: 7653
Logged by: Stefano Baccianella
Email address: stefano@sportilia.com
PostgreSQL version: 9.2.1
Operating system: Linux CentOS
Description:
Don't know if this is a bug or a correct behaviour, but in a query like
this:
SELECT t1.* FROM
table1 t1 JOIN
table2 t2 ON t1.id = t2.t1id JOIN
table3 t3 ON t1.id = t2.t1id
The parser should return an error because we are joining a table without
using any of its column.
I know this is a minor issue and a correct SQL syntax, but logically a JOIN
without condition is a Cartesian product between the two tables and not a
JOIN.
My proposal is to raise an error when a join condition doesn't contains the
table reference.
Regards
stefano@sportilia.com writes:
Don't know if this is a bug or a correct behaviour, but in a query like
this:
SELECT t1.* FROM
table1 t1 JOIN
table2 t2 ON t1.id = t2.t1id JOIN
table3 t3 ON t1.id = t2.t1id
The parser should return an error because we are joining a table without
using any of its column.
There is no such restriction in the SQL standard.
regards, tom lane