r1b commented on code in PR #2091:
URL: 
https://github.com/apache/datafusion-sqlparser-rs/pull/2091#discussion_r2516031780


##########
src/parser/mod.rs:
##########
@@ -5521,16 +5521,19 @@ impl<'a> Parser<'a> {
         // peek the next token, which if it is another type keyword, then the
         // first token is a name and not a type in itself.
         let data_type_idx = self.get_current_index();
-        if let Some(next_data_type) = self.maybe_parse(|parser| 
parser.parse_data_type())? {
-            let token = self.token_at(data_type_idx);
+        // DEFAULT will be parsed as `DataType::Custom`, which is undesirable 
in this context
+        if !self.peek_keyword(Keyword::DEFAULT) {
+            if let Some(next_data_type) = self.maybe_parse(|parser| 
parser.parse_data_type())? {
+                let token = self.token_at(data_type_idx);
 
-            // We ensure that the token is a `Word` token, and not other 
special tokens.
-            if !matches!(token.token, Token::Word(_)) {
-                return self.expected("a name or type", token.clone());
-            }
+                // We ensure that the token is a `Word` token, and not other 
special tokens.
+                if !matches!(token.token, Token::Word(_)) {

Review Comment:
   Won't we return a `Result<_, ParserError>` from `parse_function_arg` in this 
case? I was thinking we do still need to continue on to parse the 
`default_expr`. I'll take a closer look.
   
   I agree that the nesting is not ideal in any case, maybe another option 
would be to push this check into `maybe_parse` above?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to