File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -14516,8 +14516,13 @@ impl<'a> Parser<'a> {
1451614516 let value = self.parse_identifier()?;
1451714517 SetSessionAuthorizationParamKind::User(value)
1451814518 };
14519+ let scope = scope.ok_or_else(|| {
14520+ ParserError::ParserError(
14521+ "Expected a scope modifier (e.g. SESSION) before AUTHORIZATION".to_string(),
14522+ )
14523+ })?;
1451914524 return Ok(Set::SetSessionAuthorization(SetSessionAuthorizationParam {
14520- scope: scope.expect("SET ... AUTHORIZATION must have a scope") ,
14525+ scope,
1452114526 kind: auth_value,
1452214527 })
1452314528 .into());
Original file line number Diff line number Diff line change @@ -18280,6 +18280,18 @@ fn test_parse_set_session_authorization() {
1828018280 );
1828118281}
1828218282
18283+ #[test]
18284+ fn test_set_authorization_without_scope_errors() {
18285+ // This should return a parser error, not panic.
18286+ let res = parse_sql_statements(
18287+ "\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"
18288+ );
18289+ assert!(
18290+ res.is_err(),
18291+ "SET AUTHORIZATION without a scope modifier (e.g. SESSION) should error"
18292+ );
18293+ }
18294+
1828318295#[test]
1828418296fn parse_select_parenthesized_wildcard() {
1828518297 // Test SELECT DISTINCT(*) which uses a parenthesized wildcard
You can’t perform that action at this time.
0 commit comments