@@ -1027,7 +1027,7 @@ pub enum Expr {
10271027 /// Pattern expression.
10281028 pattern : Box < Expr > ,
10291029 /// Optional escape character.
1030- escape_char : Option < ValueWithSpan > ,
1030+ escape_char : Option < Box < Expr > > ,
10311031 } ,
10321032 /// `ILIKE` (case-insensitive `LIKE`)
10331033 ILike {
@@ -1041,7 +1041,7 @@ pub enum Expr {
10411041 /// Pattern expression.
10421042 pattern : Box < Expr > ,
10431043 /// Optional escape character.
1044- escape_char : Option < ValueWithSpan > ,
1044+ escape_char : Option < Box < Expr > > ,
10451045 } ,
10461046 /// `SIMILAR TO` regex
10471047 SimilarTo {
@@ -1052,7 +1052,7 @@ pub enum Expr {
10521052 /// Pattern expression.
10531053 pattern : Box < Expr > ,
10541054 /// Optional escape character.
1055- escape_char : Option < ValueWithSpan > ,
1055+ escape_char : Option < Box < Expr > > ,
10561056 } ,
10571057 /// MySQL: `RLIKE` regex or `REGEXP` regex
10581058 RLike {
@@ -1487,6 +1487,9 @@ pub enum AccessExpr {
14871487impl fmt:: Display for AccessExpr {
14881488 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
14891489 match self {
1490+ AccessExpr :: Dot ( Expr :: Value ( value) ) if matches ! ( value. value, Value :: Number ( _, _) ) => {
1491+ write ! ( f, " . {value}" )
1492+ }
14901493 AccessExpr :: Dot ( expr) => write ! ( f, ".{expr}" ) ,
14911494 AccessExpr :: Subscript ( subscript) => write ! ( f, "[{subscript}]" ) ,
14921495 }
@@ -7544,34 +7547,22 @@ pub struct Grantee {
75447547
75457548impl fmt:: Display for Grantee {
75467549 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
7547- match self . grantee_type {
7548- GranteesType :: Role => {
7549- write ! ( f, "ROLE " ) ?;
7550- }
7551- GranteesType :: Share => {
7552- write ! ( f, "SHARE " ) ?;
7553- }
7554- GranteesType :: User => {
7555- write ! ( f, "USER " ) ?;
7556- }
7557- GranteesType :: Group => {
7558- write ! ( f, "GROUP " ) ?;
7559- }
7560- GranteesType :: Public => {
7561- write ! ( f, "PUBLIC " ) ?;
7562- }
7563- GranteesType :: DatabaseRole => {
7564- write ! ( f, "DATABASE ROLE " ) ?;
7565- }
7566- GranteesType :: Application => {
7567- write ! ( f, "APPLICATION " ) ?;
7568- }
7569- GranteesType :: ApplicationRole => {
7570- write ! ( f, "APPLICATION ROLE " ) ?;
7550+ let keyword = match self . grantee_type {
7551+ GranteesType :: Role => "ROLE" ,
7552+ GranteesType :: Share => "SHARE" ,
7553+ GranteesType :: User => "USER" ,
7554+ GranteesType :: Group => "GROUP" ,
7555+ GranteesType :: Public => "PUBLIC" ,
7556+ GranteesType :: DatabaseRole => "DATABASE ROLE" ,
7557+ GranteesType :: Application => "APPLICATION" ,
7558+ GranteesType :: ApplicationRole => "APPLICATION ROLE" ,
7559+ GranteesType :: None => "" ,
7560+ } ;
7561+ f. write_str ( keyword) ?;
7562+ if let Some ( name) = & self . name {
7563+ if !keyword. is_empty ( ) {
7564+ f. write_str ( " " ) ?;
75717565 }
7572- GranteesType :: None => ( ) ,
7573- }
7574- if let Some ( ref name) = self . name {
75757566 name. fmt ( f) ?;
75767567 }
75777568 Ok ( ( ) )
0 commit comments