File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -242,6 +242,9 @@ impl<'a> Parser<'a> {
242242
243243 let expr = match self . next_token ( ) {
244244 Token :: Word ( w) => match w. keyword {
245+ Keyword :: FROM if dialect_of ! ( self is BigQueryDialect ) => {
246+ parser_err ! ( self , "FROM is a disallowed expr in BigQuery" )
247+ }
245248 Keyword :: TRUE | Keyword :: FALSE | Keyword :: NULL => {
246249 self . prev_token ( ) ;
247250 Ok ( Expr :: Value ( self . parse_value ( ) ?) )
@@ -1249,7 +1252,20 @@ impl<'a> Parser<'a> {
12491252 {
12501253 let mut values = vec ! [ ] ;
12511254 loop {
1252- values. push ( f ( self ) ?) ;
1255+ // save the index so we can backtrack if necessary
1256+ let index_before_expr = self . index ;
1257+ match f ( self ) {
1258+ Ok ( expr) => values. push ( expr) ,
1259+ Err ( err) if dialect_of ! ( self is BigQueryDialect ) => {
1260+ debug ! ( "invalid bq expression: {}" , err) ;
1261+ // in BigQuery there might just be a trailing comma in a
1262+ // comma-separated list, and we can just reset the index,
1263+ // bail, and try to continue parsing
1264+ self . index = index_before_expr;
1265+ break ;
1266+ }
1267+ Err ( err) => return Err ( err) ,
1268+ }
12531269 if !self . consume_token ( & Token :: Comma ) {
12541270 break ;
12551271 }
You can’t perform that action at this time.
0 commit comments