@@ -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
@@ -4425,17 +4422,15 @@ impl fmt::Display for Statement {
44254422 table_names,
44264423 partitions,
44274424 table,
4428- only,
44294425 identity,
44304426 cascade,
44314427 on_cluster,
44324428 } => {
44334429 let table = if * table { "TABLE " } else { "" } ;
4434- let only = if * only { "ONLY " } else { "" } ;
44354430
44364431 write ! (
44374432 f,
4438- "TRUNCATE {table}{only}{ table_names}" ,
4433+ "TRUNCATE {table}{table_names}" ,
44394434 table_names = display_comma_separated( table_names)
44404435 ) ?;
44414436
@@ -6106,10 +6101,17 @@ pub struct TruncateTableTarget {
61066101 /// name of the table being truncated
61076102 #[ cfg_attr( feature = "visitor" , visit( with = "visit_relation" ) ) ]
61086103 pub name : ObjectName ,
6104+ /// Postgres-specific option
6105+ /// [ TRUNCATE TABLE ONLY ]
6106+ /// <https://www.postgresql.org/docs/current/sql-truncate.html>
6107+ pub only : bool ,
61096108}
61106109
61116110impl fmt:: Display for TruncateTableTarget {
61126111 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
6112+ if self . only {
6113+ write ! ( f, "ONLY " ) ?;
6114+ } ;
61136115 write ! ( f, "{}" , self . name)
61146116 }
61156117}
0 commit comments