iffyio commented on code in PR #1477:
URL: 
https://github.com/apache/datafusion-sqlparser-rs/pull/1477#discussion_r1807181826


##########
src/parser/mod.rs:
##########
@@ -1023,7 +1023,8 @@ impl<'a> Parser<'a> {
                     self.parse_time_functions(ObjectName(vec![w.to_ident()]))
                 }
                 Keyword::CASE => self.parse_case_expr(),
-                Keyword::CONVERT => self.parse_convert_expr(),
+                Keyword::CONVERT => self.parse_convert_expr(false),
+                Keyword::TRY_CONVERT if dialect_of!(self is MsSqlDialect) => 
self.parse_convert_expr(true),

Review Comment:
   Can we have the guard as a dialect method e.g. 
`self.dialect.supports_try_convert()`? We can probably include support for the 
generic dialect as well



##########
tests/sqlparser_mssql.rs:
##########
@@ -495,6 +497,8 @@ fn parse_convert() {
         ParserError::ParserError("Expected: an expression, found: 
)".to_owned()),
         ms().parse_sql_statements(error_sql).unwrap_err()
     );
+
+    ms().verified_expr("TRY_CONVERT(VARCHAR(MAX), 'foo')");

Review Comment:
   with the dialect method we can move this over to common.rs  as a generic 
test over the dialects that support the feature



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