@@ -380,7 +380,10 @@ pub enum Expr {
380380 right : Box < Expr > ,
381381 } ,
382382 /// CompositeAccess (postgres) eg: SELECT (information_schema._pg_expandarray(array['i','i'])).n
383- CompositeAccess { expr : Box < Expr > , key : Ident } ,
383+ CompositeAccess {
384+ expr : Box < Expr > ,
385+ key : Ident ,
386+ } ,
384387 /// `IS FALSE` operator
385388 IsFalse ( Box < Expr > ) ,
386389 /// `IS NOT FALSE` operator
@@ -474,7 +477,10 @@ pub enum Expr {
474477 right : Box < Expr > ,
475478 } ,
476479 /// Unary operation e.g. `NOT foo`
477- UnaryOp { op : UnaryOperator , expr : Box < Expr > } ,
480+ UnaryOp {
481+ op : UnaryOperator ,
482+ expr : Box < Expr > ,
483+ } ,
478484 /// CONVERT a value to a different data type or character encoding. e.g. `CONVERT(foo USING utf8mb4)`
479485 Convert {
480486 /// The expression to convert
@@ -545,7 +551,10 @@ pub enum Expr {
545551 /// ```sql
546552 /// POSITION(<expr> in <expr>)
547553 /// ```
548- Position { expr : Box < Expr > , r#in : Box < Expr > } ,
554+ Position {
555+ expr : Box < Expr > ,
556+ r#in : Box < Expr > ,
557+ } ,
549558 /// ```sql
550559 /// SUBSTRING(<expr> [FROM <expr>] [FOR <expr>])
551560 /// ```
@@ -589,20 +598,32 @@ pub enum Expr {
589598 /// A literal value, such as string, number, date or NULL
590599 Value ( Value ) ,
591600 /// <https://dev.mysql.com/doc/refman/8.0/en/charset-introducer.html>
592- IntroducedString { introducer : String , value : Value } ,
601+ IntroducedString {
602+ introducer : String ,
603+ value : Value ,
604+ } ,
593605 /// A constant of form `<data_type> 'value'`.
594606 /// This can represent ANSI SQL `DATE`, `TIME`, and `TIMESTAMP` literals (such as `DATE '2020-01-01'`),
595607 /// as well as constants of other types (a non-standard PostgreSQL extension).
596- TypedString { data_type : DataType , value : String } ,
608+ TypedString {
609+ data_type : DataType ,
610+ value : String ,
611+ } ,
597612 /// Access a map-like object by field (e.g. `column['field']` or `column[4]`
598613 /// Note that depending on the dialect, struct like accesses may be
599614 /// parsed as [`ArrayIndex`](Self::ArrayIndex) or [`MapAccess`](Self::MapAccess)
600615 /// <https://clickhouse.com/docs/en/sql-reference/data-types/map/>
601- MapAccess { column : Box < Expr > , keys : Vec < Expr > } ,
616+ MapAccess {
617+ column : Box < Expr > ,
618+ keys : Vec < Expr > ,
619+ } ,
602620 /// Scalar function call e.g. `LEFT(foo, 5)`
603621 Function ( Function ) ,
604622 /// Aggregate function with filter
605- AggregateExpressionWithFilter { expr : Box < Expr > , filter : Box < Expr > } ,
623+ AggregateExpressionWithFilter {
624+ expr : Box < Expr > ,
625+ filter : Box < Expr > ,
626+ } ,
606627 /// `CASE [<operand>] WHEN <condition> THEN <result> ... [ELSE <result>] END`
607628 ///
608629 /// Note we only recognize a complete single expression as `<condition>`,
@@ -616,7 +637,10 @@ pub enum Expr {
616637 } ,
617638 /// An exists expression `[ NOT ] EXISTS(SELECT ...)`, used in expressions like
618639 /// `WHERE [ NOT ] EXISTS (SELECT ...)`.
619- Exists { subquery : Box < Query > , negated : bool } ,
640+ Exists {
641+ subquery : Box < Query > ,
642+ negated : bool ,
643+ } ,
620644 /// A parenthesized subquery `(SELECT ...)`, used in expression like
621645 /// `SELECT (subquery) AS x` or `WHERE (subquery) = x`
622646 Subquery ( Box < Query > ) ,
@@ -653,9 +677,15 @@ pub enum Expr {
653677 /// 1 AS A
654678 /// ```
655679 /// [1]: https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#struct_type
656- Named { expr : Box < Expr > , name : Ident } ,
680+ Named {
681+ expr : Box < Expr > ,
682+ name : Ident ,
683+ } ,
657684 /// An array index expression e.g. `(ARRAY[1, 2])[1]` or `(current_schemas(FALSE))[1]`
658- ArrayIndex { obj : Box < Expr > , indexes : Vec < Expr > } ,
685+ ArrayIndex {
686+ obj : Box < Expr > ,
687+ indexes : Vec < Expr > ,
688+ } ,
659689 /// An array expression e.g. `ARRAY[1, 2]`
660690 Array ( Array ) ,
661691 /// An interval expression e.g. `INTERVAL '1' YEAR`
@@ -678,6 +708,10 @@ pub enum Expr {
678708 /// `<search modifier>`
679709 opt_search_modifier : Option < SearchModifier > ,
680710 } ,
711+ Wildcard ,
712+ /// Qualified wildcard, e.g. `alias.*` or `schema.table.*`.
713+ /// (Same caveats apply to `QualifiedWildcard` as to `Wildcard`.)
714+ QualifiedWildcard ( ObjectName ) ,
681715}
682716
683717impl fmt:: Display for CastFormat {
@@ -704,6 +738,8 @@ impl fmt::Display for Expr {
704738 }
705739 Ok ( ( ) )
706740 }
741+ Expr :: Wildcard => f. write_str ( "*" ) ,
742+ Expr :: QualifiedWildcard ( prefix) => write ! ( f, "{}.*" , prefix) ,
707743 Expr :: CompoundIdentifier ( s) => write ! ( f, "{}" , display_separated( s, "." ) ) ,
708744 Expr :: IsTrue ( ast) => write ! ( f, "{ast} IS TRUE" ) ,
709745 Expr :: IsNotTrue ( ast) => write ! ( f, "{ast} IS NOT TRUE" ) ,
@@ -4188,6 +4224,16 @@ pub enum FunctionArgExpr {
41884224 Wildcard ,
41894225}
41904226
4227+ impl From < Expr > for FunctionArgExpr {
4228+ fn from ( wildcard_expr : Expr ) -> Self {
4229+ match wildcard_expr {
4230+ Expr :: QualifiedWildcard ( prefix) => Self :: QualifiedWildcard ( prefix) ,
4231+ Expr :: Wildcard => Self :: Wildcard ,
4232+ expr => Self :: Expr ( expr) ,
4233+ }
4234+ }
4235+ }
4236+
41914237impl fmt:: Display for FunctionArgExpr {
41924238 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
41934239 match self {
0 commit comments