@@ -4062,7 +4062,7 @@ impl fmt::Display for DropTrigger {
40624062/// A `TRUNCATE` statement.
40634063///
40644064/// ```sql
4065- /// TRUNCATE TABLE table_names [PARTITION (partitions)] [RESTART IDENTITY | CONTINUE IDENTITY] [CASCADE | RESTRICT] [ON CLUSTER cluster_name]
4065+ /// TRUNCATE TABLE [IF EXISTS] table_names [PARTITION (partitions)] [RESTART IDENTITY | CONTINUE IDENTITY] [CASCADE | RESTRICT] [ON CLUSTER cluster_name]
40664066/// ```
40674067#[ derive( Debug , Clone , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
40684068#[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
@@ -4074,6 +4074,8 @@ pub struct Truncate {
40744074 pub partitions : Option < Vec < Expr > > ,
40754075 /// TABLE - optional keyword
40764076 pub table : bool ,
4077+ /// Snowflake/Redshift-specific option: [ IF EXISTS ]
4078+ pub if_exists : bool ,
40774079 /// Postgres-specific option: [ RESTART IDENTITY | CONTINUE IDENTITY ]
40784080 pub identity : Option < super :: TruncateIdentityOption > ,
40794081 /// Postgres-specific option: [ CASCADE | RESTRICT ]
@@ -4086,10 +4088,11 @@ pub struct Truncate {
40864088impl fmt:: Display for Truncate {
40874089 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
40884090 let table = if self . table { "TABLE " } else { "" } ;
4091+ let if_exists = if self . if_exists { "IF EXISTS " } else { "" } ;
40894092
40904093 write ! (
40914094 f,
4092- "TRUNCATE {table}{table_names}" ,
4095+ "TRUNCATE {table}{if_exists}{ table_names}" ,
40934096 table_names = display_comma_separated( & self . table_names)
40944097 ) ?;
40954098
0 commit comments