piki commented on issue #1846:
URL:
https://github.com/apache/datafusion-sqlparser-rs/issues/1846#issuecomment-2869951944
It looks like #1120 is where this changed. `BigQueryDialect` got the
ability to parse `DELETE` statements without the `FROM` keyword.
`GenericDialect` got treated the same way as `BigQueryDialect`, but that broke
its ability to parse some statements from dialects other than `BigQueryDialect`.
The most permissive thing would be for `GenericDialect` to be able to
support both of these `DELETE` formats:
- `DELETE [FROM] table [alias] WHERE condition` (like BigQuery)
- `DELETE tables FROM table WHERE condition` (like all the other dialects)
The challenge is that just making `FROM` optional doesn't work, because
these two statements become a reduce-reduce conflict:
- `DELETE table_list [FROM] table WHERE condition`
- `DELETE [FROM] table alias WHERE condition`
So I think the best approach is to split `parse_delete` into two functions:
one in the `BigQueryDialect` style and one in the all-others style, and let
`GenericDialect` try both.
Supporting the union of many grammars is hard and sometimes undefined, but I
think that 👆 is what makes the most sense for `DELETE`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]