Open
Description
According to the design policy, 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
.
datafusion-sqlparser-rs/tests/sqlparser_common.rs
Lines 688 to 735 in 2182f7e
Metadata
Metadata
Assignees
Labels
No labels
Activity
piki commentedon May 11, 2025
It looks like #1120 is where this changed.
BigQueryDialect
got the ability to parseDELETE
statements without theFROM
keyword.GenericDialect
got treated the same way asBigQueryDialect
, but that broke its ability to parse some statements from dialects other thanBigQueryDialect
.The most permissive thing would be for
GenericDialect
to be able to support both of theseDELETE
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 theBigQueryDialect
style and one in the all-others style, and letGenericDialect
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
.