Details
Description
I created an SQL using a Left Join with resulted in a cartesian join as a result.
The format is
select a.col1, a.col2, b.col1, b.col1, b.col3, b.col4 from tablea a left outer join tableb b on b.col4 and b.col1 where b.col5 < current_date()
The erroneously placed and (should be an = ) creates a cartesian join. Some other database technology calls a parser error on this.
In the case of the system, it happened in on column in the join condition is a primary key and the other is the lead column of a multi-column index of a primary key
Gliffy Diagrams
Attachments
Activity
- All
- Comments
- Work Log
- History
- Activity
- Transitions
Peter McLarty,
So, what would be the expected result from your point of view, a syntax error?
Because if we accept the syntax, the cartesian product seems to be the only reasonable result set, do you agree?
Regarding the syntax, I suppose that technically the complaint is valid. I'm not very fluent at reading the SQL standard, but if I understand the description of search conditions correctly, col1 AND col2 is not one, because colX is not a predicate.
However, it has been accepted in MySQL for very long time, so disabling it now would be a disaster for existing applications.
Do you suggest to make the change anyway?