-
Notifications
You must be signed in to change notification settings - Fork 614
Don't silently accept naked OUTER JOINS #118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Pull Request Test Coverage Report for Build 357
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I didn't include OUTER
initially as I was unsure about Oracle, which lists it as a non-reserved keyword, and it wasn't required for parsing. Since then I learned the modern versions of Oracle support OUTER APPLY
(borrowed from MSSQL), so I was going to add this anyway.
Going forward I expect this list to be dialect-specific, but forbidding OUTER
makes sense for the time being.
(The SQL specification lists too many keywords as reserved, so keyword being in its reserved list is not a good reason to forbid it from being used as an identifier. Unless you're aiming for conformance, in which case it should arguably be handled elsewhere.)
@nickolay I realize this will conflict with #116—definitely feel free to merge that one first!
Yeah, I've merged my PR before seeing this one...
`SELECT * FROM a OUTER JOIN b` was previously being parsed as an inner join where table `a` was aliased to `OUTER`. This is extremely surprising, as the user likely intended to say FULL OUTER JOIN. Since the SQL specification lists OUTER as a keyword, we are well within our rights to return an error here.
Awesome, thanks for the review! |
@@ -422,7 +422,12 @@ pub const RESERVED_FOR_TABLE_ALIAS: &[&str] = &[ | |||
// Reserved as both a table and a column alias: | |||
WITH, SELECT, WHERE, GROUP, HAVING, ORDER, LIMIT, OFFSET, FETCH, UNION, EXCEPT, INTERSECT, | |||
// Reserved only as a table alias in the `FROM`/`JOIN` clauses: | |||
ON, JOIN, INNER, CROSS, FULL, LEFT, RIGHT, NATURAL, USING, | |||
ON, JOIN, INNER, CROSS, FULL, LEFT, RIGHT, NATURAL, USING, LIMIT, OFFSET, FETCH, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
, LIMIT, OFFSET, FETCH,
here is the result of a rebase going bad..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll fix this in a moment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
D'oh! Sorry. I distinctly remember intentionally resolving this conflict in favor of "adding" the new keywords without realizing they were in fact duplicates.
SELECT * FROM a OUTER JOIN b
was previously being parsed as an innerjoin where table
a
was aliased toOUTER
. This is extremelysurprising, as the user likely intended to say FULL OUTER JOIN. Since
the SQL specification lists OUTER as a keyword, we are well within our
rights to return an error here.
@nickolay I realize this will conflict with #116—definitely feel free to merge that one first!