@@ -1291,6 +1291,7 @@ impl fmt::Display for CastFormat {
12911291}
12921292
12931293impl fmt:: Display for Expr {
1294+ #[ cfg_attr( feature = "recursive-protection" , recursive:: recursive) ]
12941295 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
12951296 match self {
12961297 Expr :: Identifier ( s) => write ! ( f, "{s}" ) ,
@@ -2354,6 +2355,7 @@ pub enum Statement {
23542355 cache_metadata : bool ,
23552356 noscan : bool ,
23562357 compute_statistics : bool ,
2358+ has_table_keyword : bool ,
23572359 } ,
23582360 /// ```sql
23592361 /// TRUNCATE
@@ -3239,6 +3241,9 @@ pub enum Statement {
32393241 ///
32403242 /// [SQLite](https://sqlite.org/lang_explain.html)
32413243 query_plan : bool ,
3244+ /// `EXPLAIN ESTIMATE`
3245+ /// [Clickhouse](https://clickhouse.com/docs/en/sql-reference/statements/explain#explain-estimate)
3246+ estimate : bool ,
32423247 /// A SQL query that specifies what to explain
32433248 statement : Box < Statement > ,
32443249 /// Optional output format of explain
@@ -3471,6 +3476,7 @@ impl fmt::Display for Statement {
34713476 verbose,
34723477 analyze,
34733478 query_plan,
3479+ estimate,
34743480 statement,
34753481 format,
34763482 options,
@@ -3483,6 +3489,9 @@ impl fmt::Display for Statement {
34833489 if * analyze {
34843490 write ! ( f, "ANALYZE " ) ?;
34853491 }
3492+ if * estimate {
3493+ write ! ( f, "ESTIMATE " ) ?;
3494+ }
34863495
34873496 if * verbose {
34883497 write ! ( f, "VERBOSE " ) ?;
@@ -3644,8 +3653,13 @@ impl fmt::Display for Statement {
36443653 cache_metadata,
36453654 noscan,
36463655 compute_statistics,
3656+ has_table_keyword,
36473657 } => {
3648- write ! ( f, "ANALYZE TABLE {table_name}" ) ?;
3658+ write ! (
3659+ f,
3660+ "ANALYZE{}{table_name}" ,
3661+ if * has_table_keyword { " TABLE " } else { " " }
3662+ ) ?;
36493663 if let Some ( ref parts) = partitions {
36503664 if !parts. is_empty ( ) {
36513665 write ! ( f, " PARTITION ({})" , display_comma_separated( parts) ) ?;
0 commit comments