You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "takaebato (via GitHub)" <gi...@apache.org> on 2025/05/09 14:41:01 UTC
[I] `GenericDialect` should support multi-table DELETE and DELETE without FROM clause [datafusion-sqlparser-rs]
takaebato opened a new issue, #1846:
URL: https://github.com/apache/datafusion-sqlparser-rs/issues/1846
`GenericDialect` is intended to parse any SQL that other dialects can handle, but it currently fails to parse multi-table DELETE statements and DELETE statements without a FROM clause.
I think the expected behavior is that the following tests should also pass with `GenericDialect`.
https://github.com/apache/datafusion-sqlparser-rs/blob/2182f7ea71242a7e9674932d559baef67dae522d/tests/sqlparser_common.rs#L688-L735
--
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: github-unsubscribe@datafusion.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [I] `GenericDialect` should support multi-table DELETE and DELETE without FROM clause [datafusion-sqlparser-rs]
Posted by "piki (via GitHub)" <gi...@apache.org>.
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: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org