Repository navigation
Conversation
Change `join_condition` to `join_condition_opt` in the outer_join grammar production so LEFT/RIGHT/FULL JOIN works without an explicit ON/USING clause, matching INNER JOIN behavior and MySQL compatibility. Fixes matrixorigin#24737
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
LEFT JOIN without ON was already covered; add RIGHT JOIN variant to verify all outer join types parse correctly without ON/USING.
|
行为需要再判断一下,我先加个WIP |
fengttt
left a comment
There was a problem hiding this comment.
JOIN without ON/USING should be a cross product.
OUTER JOIN should require ON/USING clause, as per MySQL document. https://dev.mysql.com/doc/refman/9.7/en/join.html
So please revert the left/right/full outer join cases. Should raise an error, with a good error message (outer join requires ON/USING clause)
# Conflicts: # pkg/sql/parsers/dialect/mysql/mysql_sql.go
|
Superseded by merged PR #25880. The final takeover keeps ON/USING mandatory for LEFT/RIGHT/FULL OUTER JOIN and returns an explicit parser error, while preserving valid conditionless inner/cross join forms. |
What type of PR is this?
Which issue(s) this PR fixes:
issue #24737
What this PR does / why we need it:
Fixes a SQL parser bug where LEFT/RIGHT/FULL JOIN without ON/USING clause fails to parse when followed by WHERE or other clauses. The fix changes the outer_join grammar production from mandatory
join_conditionto optionaljoin_condition_opt, matching the behavior already used for INNER JOIN.This unblocks Prisma ORM's
relationLoadStrategy: 'join'preview featur for to-many relations, which generates LEFT JOIN without ON and uses the outer WHERE for filtering.