File tree 2 files changed +13
-1
lines changed 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -109,7 +109,7 @@ impl Parser {
109
109
match self . next_token ( ) {
110
110
Some ( t) => match t {
111
111
Token :: SQLWord ( ref w) if w. keyword != "" => match w. keyword . as_ref ( ) {
112
- "SELECT" | "WITH" => {
112
+ "SELECT" | "WITH" | "VALUES" => {
113
113
self . prev_token ( ) ;
114
114
Ok ( SQLStatement :: SQLQuery ( Box :: new ( self . parse_query ( ) ?) ) )
115
115
}
@@ -133,6 +133,10 @@ impl Parser {
133
133
w. to_string( )
134
134
) ) ,
135
135
} ,
136
+ Token :: LParen => {
137
+ self . prev_token ( ) ;
138
+ Ok ( SQLStatement :: SQLQuery ( Box :: new ( self . parse_query ( ) ?) ) )
139
+ }
136
140
unexpected => self . expected (
137
141
"a keyword at the beginning of a statement" ,
138
142
Some ( unexpected) ,
Original file line number Diff line number Diff line change @@ -181,6 +181,14 @@ fn parse_where_delete_statement() {
181
181
}
182
182
}
183
183
184
+ #[ test]
185
+ fn parse_top_level ( ) {
186
+ verified_stmt ( "SELECT 1" ) ;
187
+ verified_stmt ( "(SELECT 1)" ) ;
188
+ verified_stmt ( "((SELECT 1))" ) ;
189
+ verified_stmt ( "VALUES (1)" ) ;
190
+ }
191
+
184
192
#[ test]
185
193
fn parse_simple_select ( ) {
186
194
let sql = "SELECT id, fname, lname FROM customer WHERE id = 1 LIMIT 5" ;
You can’t perform that action at this time.
0 commit comments