@@ -32,8 +32,8 @@ use sqlparser_derive::{Visit, VisitMut};
32
32
pub use super :: ddl:: { ColumnDef , TableConstraint } ;
33
33
34
34
use super :: {
35
- display_comma_separated, display_separated, ClusteredBy , CommentDef , Expr , FileFormat ,
36
- FromTable , HiveDistributionStyle , HiveFormat , HiveIOFormat , HiveRowFormat , Ident ,
35
+ display_comma_separated, display_separated, Assignment , ClusteredBy , CommentDef , Expr ,
36
+ FileFormat , FromTable , HiveDistributionStyle , HiveFormat , HiveIOFormat , HiveRowFormat , Ident ,
37
37
InsertAliases , MysqlInsertPriority , ObjectName , OnCommit , OnInsert , OneOrManyWithParens ,
38
38
OrderByExpr , Query , RowAccessPolicy , SelectItem , SqlOption , SqliteOnConflict , TableEngine ,
39
39
TableWithJoins , Tag , WrappedCollection ,
@@ -480,6 +480,9 @@ pub struct Insert {
480
480
pub overwrite : bool ,
481
481
/// A SQL query that specifies what to insert
482
482
pub source : Option < Box < Query > > ,
483
+ /// MySQL `INSERT INTO ... SET`
484
+ /// See: <https://dev.mysql.com/doc/refman/8.4/en/insert.html>
485
+ pub assignments : Vec < Assignment > ,
483
486
/// partitioned insert (Hive)
484
487
pub partitioned : Option < Vec < Expr > > ,
485
488
/// Columns defined after PARTITION
@@ -545,9 +548,10 @@ impl Display for Insert {
545
548
546
549
if let Some ( source) = & self . source {
547
550
write ! ( f, "{source}" ) ?;
548
- }
549
-
550
- if self . source . is_none ( ) && self . columns . is_empty ( ) {
551
+ } else if !self . assignments . is_empty ( ) {
552
+ write ! ( f, "SET " ) ?;
553
+ write ! ( f, "{}" , display_comma_separated( & self . assignments) ) ?;
554
+ } else if self . source . is_none ( ) && self . columns . is_empty ( ) {
551
555
write ! ( f, "DEFAULT VALUES" ) ?;
552
556
}
553
557
0 commit comments