File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -99,6 +99,7 @@ impl fmt::Display for SetExpr {
9999#[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
100100pub enum SetOperator {
101101 Union ,
102+ Minus ,
102103 Except ,
103104 Intersect ,
104105}
@@ -107,6 +108,7 @@ impl fmt::Display for SetOperator {
107108 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
108109 f. write_str ( match self {
109110 SetOperator :: Union => "UNION" ,
111+ SetOperator :: Minus => "MINUS" ,
110112 SetOperator :: Except => "EXCEPT" ,
111113 SetOperator :: Intersect => "INTERSECT" ,
112114 } )
Original file line number Diff line number Diff line change @@ -274,6 +274,7 @@ define_keywords!(
274274 MERGE ,
275275 METHOD ,
276276 MIN ,
277+ MINUS ,
277278 MINUTE ,
278279 MOD ,
279280 MODIFIES ,
Original file line number Diff line number Diff line change @@ -2040,7 +2040,9 @@ impl<'a> Parser<'a> {
20402040 let op = self . parse_set_operator ( & self . peek_token ( ) ) ;
20412041 let next_precedence = match op {
20422042 // UNION and EXCEPT have the same binding power and evaluate left-to-right
2043- Some ( SetOperator :: Union ) | Some ( SetOperator :: Except ) => 10 ,
2043+ Some ( SetOperator :: Union ) | Some ( SetOperator :: Except ) | Some ( SetOperator :: Minus ) => {
2044+ 10
2045+ }
20442046 // INTERSECT has higher precedence than UNION/EXCEPT
20452047 Some ( SetOperator :: Intersect ) => 20 ,
20462048 // Unexpected token or EOF => stop parsing the query body
@@ -2064,6 +2066,7 @@ impl<'a> Parser<'a> {
20642066 fn parse_set_operator ( & mut self , token : & Token ) -> Option < SetOperator > {
20652067 match token {
20662068 Token :: Word ( w) if w. keyword == Keyword :: UNION => Some ( SetOperator :: Union ) ,
2069+ Token :: Word ( w) if w. keyword == Keyword :: MINUS => Some ( SetOperator :: Union ) ,
20672070 Token :: Word ( w) if w. keyword == Keyword :: EXCEPT => Some ( SetOperator :: Except ) ,
20682071 Token :: Word ( w) if w. keyword == Keyword :: INTERSECT => Some ( SetOperator :: Intersect ) ,
20692072 _ => None ,
You can’t perform that action at this time.
0 commit comments