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


##########
tests/sqlparser_common.rs:
##########
@@ -18273,6 +18273,18 @@ fn test_parse_set_session_authorization() {
     );
 }
 
+#[test]
+fn test_set_authorization_without_scope_errors() {
+    // This should return a parser error, not panic.
+    let res = parse_sql_statements(
+        
"\tSET\t\t\t\t\t\t\t\t\t\tAUTHORIZATION\tTIME\t\t\t\t\t\tTIME\u{fffd}\u{fffd}v\u{1}\0\0\t74843EUTI>\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0USER_RNCLUDE_NULL\0\0\0\0\0\0\0\0\0\t\t\t\t^^^^^^^^\tWHI\t\tIN"

Review Comment:
   is there a simpler test case that reproduces the error? I'm assuming the 
escape sequences and null characters shouldnt be necessary based on the diff



##########
src/parser/mod.rs:
##########
@@ -14515,8 +14515,13 @@ impl<'a> Parser<'a> {
                 let value = self.parse_identifier()?;
                 SetSessionAuthorizationParamKind::User(value)
             };
+            let scope = scope.ok_or_else(|| {
+                ParserError::ParserError(
+                    "Expected a scope modifier (e.g. SESSION) before 
AUTHORIZATION".to_string(),
+                )

Review Comment:
   can we use one of the helper functions like `self.expected_at`?



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