mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-12-23 11:12:51 +00:00
Support Snowflake Update-From-Select (#1604)
Co-authored-by: Ifeanyi Ubah <ify1992@yahoo.com>
This commit is contained in:
parent
14cefc47ed
commit
024a878ee7
6 changed files with 59 additions and 16 deletions
|
|
@ -11791,15 +11791,20 @@ impl<'a> Parser<'a> {
|
|||
pub fn parse_update(&mut self) -> Result<Statement, ParserError> {
|
||||
let or = self.parse_conflict_clause();
|
||||
let table = self.parse_table_and_joins()?;
|
||||
self.expect_keyword(Keyword::SET)?;
|
||||
let assignments = self.parse_comma_separated(Parser::parse_assignment)?;
|
||||
let from = if self.parse_keyword(Keyword::FROM)
|
||||
&& dialect_of!(self is GenericDialect | PostgreSqlDialect | DuckDbDialect | BigQueryDialect | SnowflakeDialect | RedshiftSqlDialect | MsSqlDialect | SQLiteDialect )
|
||||
{
|
||||
Some(self.parse_table_and_joins()?)
|
||||
let from_before_set = if self.parse_keyword(Keyword::FROM) {
|
||||
Some(UpdateTableFromKind::BeforeSet(
|
||||
self.parse_table_and_joins()?,
|
||||
))
|
||||
} else {
|
||||
None
|
||||
};
|
||||
self.expect_keyword(Keyword::SET)?;
|
||||
let assignments = self.parse_comma_separated(Parser::parse_assignment)?;
|
||||
let from = if from_before_set.is_none() && self.parse_keyword(Keyword::FROM) {
|
||||
Some(UpdateTableFromKind::AfterSet(self.parse_table_and_joins()?))
|
||||
} else {
|
||||
from_before_set
|
||||
};
|
||||
let selection = if self.parse_keyword(Keyword::WHERE) {
|
||||
Some(self.parse_expr()?)
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue