mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-09-04 05:00:34 +00:00
Support multiple-table DELETE syntax (#855)
This commit is contained in:
parent
5ecf633e31
commit
f72e2ec382
3 changed files with 131 additions and 26 deletions
|
@ -4813,10 +4813,17 @@ impl<'a> Parser<'a> {
|
|||
}
|
||||
|
||||
pub fn parse_delete(&mut self) -> Result<Statement, ParserError> {
|
||||
self.expect_keyword(Keyword::FROM)?;
|
||||
let table_name = self.parse_table_factor()?;
|
||||
let tables = if !self.parse_keyword(Keyword::FROM) {
|
||||
let tables = self.parse_comma_separated(Parser::parse_object_name)?;
|
||||
self.expect_keyword(Keyword::FROM)?;
|
||||
tables
|
||||
} else {
|
||||
vec![]
|
||||
};
|
||||
|
||||
let from = self.parse_comma_separated(Parser::parse_table_and_joins)?;
|
||||
let using = if self.parse_keyword(Keyword::USING) {
|
||||
Some(self.parse_table_factor()?)
|
||||
Some(self.parse_comma_separated(Parser::parse_table_and_joins)?)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
@ -4833,7 +4840,8 @@ impl<'a> Parser<'a> {
|
|||
};
|
||||
|
||||
Ok(Statement::Delete {
|
||||
table_name,
|
||||
tables,
|
||||
from,
|
||||
using,
|
||||
selection,
|
||||
returning,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue