aharpervc commented on code in PR #1809:
URL: 
https://github.com/apache/datafusion-sqlparser-rs/pull/1809#discussion_r2052462208


##########
src/parser/mod.rs:
##########
@@ -15064,6 +15117,38 @@ impl<'a> Parser<'a> {
         }))
     }
 
+    /// Parse [Statement::Go]
+    fn parse_go(&mut self) -> Result<Statement, ParserError> {
+        self.expect_previously_only_whitespace_until_newline()?;

Review Comment:
   > hmm this call look equivalent to the loop below that peeks forward to skip 
newlines? unclear why we're peeking backwards here right after we parsed the GO 
keyword (so that this will always be infallible?)
   
   The too loops aren't the same. The reason we need to peek look backwards 
here is to forbid this syntax:
   
   ```sql
   -- `GO` is disallowed
   select 1; go
   ```
   
   If you actually run this on a real SQL Server instance, you will also get a 
similar error: `Incorrect syntax near 'go'.`. Therefore it seems prudent to 
forbid this syntax from parsing here in this library.
   
   
   --- 
   
   Note that the extremely similar syntax `select 1 go` _is_ allowed, but in 
this example `go` is a column alias rather than a batch delimiter.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to