LucaCappelletti94 commented on code in PR #1826:
URL: 
https://github.com/apache/datafusion-sqlparser-rs/pull/1826#discussion_r2071126270


##########
src/parser/mod.rs:
##########
@@ -5199,13 +5199,20 @@ impl<'a> Parser<'a> {
 
         // parse: [ argname ] argtype
         let mut name = None;
+        let next_token = self.peek_token();

Review Comment:
   The argument named `Int2` (as described in the 
[issue](https://github.com/apache/datafusion-sqlparser-rs/issues/1825)) is not 
parsed as `DataType::Custom`, but as a 
[`DataType::Int2`](https://github.com/apache/datafusion-sqlparser-rs/blob/a464f8e8d7a5057e4e5b8046b0f619acdf7fce74/src/ast/data_type.rs#L150).
 Analogously, any other such argument names that collides with data types from 
other SQL engines would be parsed into a type.
   
   Now, if I were to convert back to string `DataType::Int2` I would get some 
arbitrary capitalization which in this case is `INT2` - without the 
`peek_token`, I am unsure how we can preserve the initial token from being lost.



-- 
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