diff --git a/vendored/sqlite3-parser/src/parser/ast/check.rs b/vendored/sqlite3-parser/src/parser/ast/check.rs index ca1e8cb55..7e65d6852 100644 --- a/vendored/sqlite3-parser/src/parser/ast/check.rs +++ b/vendored/sqlite3-parser/src/parser/ast/check.rs @@ -66,10 +66,13 @@ impl Stmt { } => column_count(returning), Self::Pragma(..) => ColumnCount::Dynamic, Self::Select(s) => s.column_count(), - Self::Update { - returning: Some(returning), - .. - } => column_count(returning), + Self::Update(update) => { + let Update { returning, .. } = &**update; + match returning { + Some(returning) => column_count(returning), + None => ColumnCount::None, + } + } _ => ColumnCount::None, } } @@ -173,11 +176,18 @@ impl Stmt { Err(custom_err!("0 values for {} columns", columns.len())) } }, - Self::Update { - order_by: Some(_), - limit: None, - .. - } => Err(custom_err!("ORDER BY without LIMIT on UPDATE")), + Self::Update(update) => { + let Update { + order_by, limit, .. + } = &**update; + if let Some(_) = order_by { + if limit.is_none() { + return Err(custom_err!("ORDER BY without LIMIT on UPDATE")); + } + } + + Ok(()) + } _ => Ok(()), } } diff --git a/vendored/sqlite3-parser/src/parser/ast/fmt.rs b/vendored/sqlite3-parser/src/parser/ast/fmt.rs index 10e7c1ad9..2d44f5255 100644 --- a/vendored/sqlite3-parser/src/parser/ast/fmt.rs +++ b/vendored/sqlite3-parser/src/parser/ast/fmt.rs @@ -466,18 +466,19 @@ impl ToTokens for Stmt { name.to_tokens(s) } Self::Select(select) => select.to_tokens(s), - Self::Update { - with, - or_conflict, - tbl_name, - indexed, - sets, - from, - where_clause, - returning, - order_by, - limit, - } => { + Self::Update(update) => { + let Update { + with, + or_conflict, + tbl_name, + indexed, + sets, + from, + where_clause, + returning, + order_by, + limit, + } = &**update; if let Some(with) = with { with.to_tokens(s)?; } diff --git a/vendored/sqlite3-parser/src/parser/ast/mod.rs b/vendored/sqlite3-parser/src/parser/ast/mod.rs index 814aacdb1..3c729ea70 100644 --- a/vendored/sqlite3-parser/src/parser/ast/mod.rs +++ b/vendored/sqlite3-parser/src/parser/ast/mod.rs @@ -223,6 +223,11 @@ pub enum Stmt { /// `SELECT` Select(Box