@@ -4126,7 +4126,7 @@ pub enum Statement {
41264126 /// A SQL query that specifies what to explain
41274127 statement : Box < Statement > ,
41284128 /// Optional output format of explain
4129- format : Option < AnalyzeFormat > ,
4129+ format : Option < AnalyzeFormatKind > ,
41304130 /// Postgres style utility options, `(analyze, verbose true)`
41314131 options : Option < Vec < UtilityOption > > ,
41324132 } ,
@@ -4494,7 +4494,7 @@ impl fmt::Display for Statement {
44944494 }
44954495
44964496 if let Some ( format) = format {
4497- write ! ( f, "FORMAT {format} " ) ?;
4497+ write ! ( f, "{format} " ) ?;
44984498 }
44994499
45004500 if let Some ( options) = options {
@@ -7641,13 +7641,34 @@ impl fmt::Display for DuplicateTreatment {
76417641 }
76427642}
76437643
7644+ #[ derive( Debug , Copy , Clone , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
7645+ #[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
7646+ #[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
7647+ pub enum AnalyzeFormatKind {
7648+ /// e.g. `EXPLAIN ANALYZE FORMAT JSON SELECT * FROM tbl`
7649+ Keyword ( AnalyzeFormat ) ,
7650+ /// e.g. `EXPLAIN ANALYZE FORMAT=JSON SELECT * FROM tbl`
7651+ Assignment ( AnalyzeFormat ) ,
7652+ }
7653+
7654+ impl fmt:: Display for AnalyzeFormatKind {
7655+ fn fmt ( & self , f : & mut core:: fmt:: Formatter < ' _ > ) -> core:: fmt:: Result {
7656+ match self {
7657+ AnalyzeFormatKind :: Keyword ( format) => write ! ( f, "FORMAT {format}" ) ,
7658+ AnalyzeFormatKind :: Assignment ( format) => write ! ( f, "FORMAT={format}" ) ,
7659+ }
7660+ }
7661+ }
7662+
76447663#[ derive( Debug , Copy , Clone , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
76457664#[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
76467665#[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
76477666pub enum AnalyzeFormat {
76487667 TEXT ,
76497668 GRAPHVIZ ,
76507669 JSON ,
7670+ TRADITIONAL ,
7671+ TREE ,
76517672}
76527673
76537674impl fmt:: Display for AnalyzeFormat {
@@ -7656,6 +7677,8 @@ impl fmt::Display for AnalyzeFormat {
76567677 AnalyzeFormat :: TEXT => "TEXT" ,
76577678 AnalyzeFormat :: GRAPHVIZ => "GRAPHVIZ" ,
76587679 AnalyzeFormat :: JSON => "JSON" ,
7680+ AnalyzeFormat :: TRADITIONAL => "TRADITIONAL" ,
7681+ AnalyzeFormat :: TREE => "TREE" ,
76597682 } )
76607683 }
76617684}
0 commit comments