lemon-rs
lemon-rs copied to clipboard
support strange joins
Sqite has a rather flexible syntax for joins, and the parser should support them. This PR alleviate the restriction on joins, and make them more flexible.
see: https://www.sqlite.org/lang_select.html#strange_join_names
@MarinPostma https://github.com/gwenn/lemon-rs/issues/23#issuecomment-1458636586 it looks like weird joins are fine on their own, looks like we hit another kind of issue
No they aren't, for example, this is not supported by the parser, but should:
SELECT * FROM foo LEFT NATURAL JOIN bar
I am going to try fixing #23 first. https://www.sqlite.org/lang_select.html#strange_join_names
Remember: you can use these non-standard join types but you ought not. Stick to using standard JOIN syntax for portability with other SQL database engines.
And I am not sure we want to support these non-standard join types (like Double-Quoted String).
It seems that the actual rules are here: https://github.com/sqlite/sqlite/blob/80511f32f7e71062026edd471913ef0455563964/src/select.c#L197-L257
The only restrictions on the join type name are:
"INNER" cannot appear together with "OUTER", "LEFT", "RIGHT", or "FULL".
"CROSS" cannot appear together with "OUTER", "LEFT", "RIGHT, or "FULL".
If "OUTER" is present then there must also be one of "LEFT", "RIGHT", or "FULL"
I'll implement that 👍
See #37