@@ -3014,9 +3014,6 @@ pub enum Statement {
30143014 /// TABLE - optional keyword;
30153015 table : bool ,
30163016 /// Postgres-specific option
3017- /// [ TRUNCATE TABLE ONLY ]
3018- only : bool ,
3019- /// Postgres-specific option
30203017 /// [ RESTART IDENTITY | CONTINUE IDENTITY ]
30213018 identity : Option < TruncateIdentityOption > ,
30223019 /// Postgres-specific option
@@ -3405,7 +3402,7 @@ pub enum Statement {
34053402 purge : bool ,
34063403 /// MySQL-specific "TEMPORARY" keyword
34073404 temporary : bool ,
3408- /// MySQL-specific drop index syntax, which requires table specification
3405+ /// MySQL-specific drop index syntax, which requires table specification
34093406 /// See <https://dev.mysql.com/doc/refman/8.4/en/drop-index.html>
34103407 table : Option < ObjectName > ,
34113408 } ,
@@ -4422,17 +4419,15 @@ impl fmt::Display for Statement {
44224419 table_names,
44234420 partitions,
44244421 table,
4425- only,
44264422 identity,
44274423 cascade,
44284424 on_cluster,
44294425 } => {
44304426 let table = if * table { "TABLE " } else { "" } ;
4431- let only = if * only { "ONLY " } else { "" } ;
44324427
44334428 write ! (
44344429 f,
4435- "TRUNCATE {table}{only}{ table_names}" ,
4430+ "TRUNCATE {table}{table_names}" ,
44364431 table_names = display_comma_separated( table_names)
44374432 ) ?;
44384433
@@ -6097,10 +6092,17 @@ pub struct TruncateTableTarget {
60976092 /// name of the table being truncated
60986093 #[ cfg_attr( feature = "visitor" , visit( with = "visit_relation" ) ) ]
60996094 pub name : ObjectName ,
6095+ /// Postgres-specific option
6096+ /// [ TRUNCATE TABLE ONLY ]
6097+ /// <https://www.postgresql.org/docs/current/sql-truncate.html>
6098+ pub only : bool ,
61006099}
61016100
61026101impl fmt:: Display for TruncateTableTarget {
61036102 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
6103+ if self . only {
6104+ write ! ( f, "ONLY " ) ?;
6105+ } ;
61046106 write ! ( f, "{}" , self . name)
61056107 }
61066108}
0 commit comments