@@ -32,8 +32,8 @@ use sqlparser_derive::{Visit, VisitMut};
3232pub use super :: ddl:: { ColumnDef , TableConstraint } ;
3333
3434use 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 ,
3737 InsertAliases , MysqlInsertPriority , ObjectName , OnCommit , OnInsert , OneOrManyWithParens ,
3838 OrderByExpr , Query , RowAccessPolicy , SelectItem , SqlOption , SqliteOnConflict , TableEngine ,
3939 TableWithJoins , Tag , WrappedCollection ,
@@ -480,6 +480,9 @@ pub struct Insert {
480480 pub overwrite : bool ,
481481 /// A SQL query that specifies what to insert
482482 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 > ,
483486 /// partitioned insert (Hive)
484487 pub partitioned : Option < Vec < Expr > > ,
485488 /// Columns defined after PARTITION
@@ -545,9 +548,10 @@ impl Display for Insert {
545548
546549 if let Some ( source) = & self . source {
547550 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 ( ) {
551555 write ! ( f, "DEFAULT VALUES" ) ?;
552556 }
553557
0 commit comments