@@ -36,7 +36,7 @@ use super::{
36
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
- TableWithJoins , Tag , WrappedCollection ,
39
+ TableObject , TableWithJoins , Tag , WrappedCollection ,
40
40
} ;
41
41
42
42
/// CREATE INDEX statement.
@@ -470,8 +470,7 @@ pub struct Insert {
470
470
/// INTO - optional keyword
471
471
pub into : bool ,
472
472
/// TABLE
473
- #[ cfg_attr( feature = "visitor" , visit( with = "visit_relation" ) ) ]
474
- pub table_name : ObjectName ,
473
+ pub table : TableObject ,
475
474
/// table_name as foo (for PostgreSQL)
476
475
pub table_alias : Option < Ident > ,
477
476
/// COLUMNS
@@ -488,7 +487,7 @@ pub struct Insert {
488
487
/// Columns defined after PARTITION
489
488
pub after_columns : Vec < Ident > ,
490
489
/// whether the insert has the table keyword (Hive)
491
- pub table : bool ,
490
+ pub has_table_keyword : bool ,
492
491
pub on : Option < OnInsert > ,
493
492
/// RETURNING
494
493
pub returning : Option < Vec < SelectItem > > ,
@@ -503,9 +502,9 @@ pub struct Insert {
503
502
impl Display for Insert {
504
503
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
505
504
let table_name = if let Some ( alias) = & self . table_alias {
506
- format ! ( "{0} AS {alias}" , self . table_name )
505
+ format ! ( "{0} AS {alias}" , self . table )
507
506
} else {
508
- self . table_name . to_string ( )
507
+ self . table . to_string ( )
509
508
} ;
510
509
511
510
if let Some ( on_conflict) = self . or {
@@ -531,7 +530,7 @@ impl Display for Insert {
531
530
ignore = if self . ignore { " IGNORE" } else { "" } ,
532
531
over = if self . overwrite { " OVERWRITE" } else { "" } ,
533
532
int = if self . into { " INTO" } else { "" } ,
534
- tbl = if self . table { " TABLE" } else { "" } ,
533
+ tbl = if self . has_table_keyword { " TABLE" } else { "" } ,
535
534
) ?;
536
535
}
537
536
if !self . columns . is_empty ( ) {
0 commit comments