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 @@ -14396,8 +14396,13 @@ impl<'a> Parser<'a> {
1439614396 let value = self.parse_identifier()?;
1439714397 SetSessionAuthorizationParamKind::User(value)
1439814398 };
14399+ let scope = scope.ok_or_else(|| {
14400+ ParserError::ParserError(
14401+ "Expected a scope modifier (e.g. SESSION) before AUTHORIZATION".to_string(),
14402+ )
14403+ })?;
1439914404 return Ok(Set::SetSessionAuthorization(SetSessionAuthorizationParam {
14400- scope: scope.expect("SET ... AUTHORIZATION must have a scope") ,
14405+ scope,
1440114406 kind: auth_value,
1440214407 })
1440314408 .into());
Original file line number Diff line number Diff line change @@ -18128,6 +18128,18 @@ fn test_parse_set_session_authorization() {
1812818128 );
1812918129}
1813018130
18131+ #[test]
18132+ fn test_set_authorization_without_scope_errors() {
18133+ // This should return a parser error, not panic.
18134+ let res = parse_sql_statements(
18135+ "\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"
18136+ );
18137+ assert!(
18138+ res.is_err(),
18139+ "SET AUTHORIZATION without a scope modifier (e.g. SESSION) should error"
18140+ );
18141+ }
18142+
1813118143#[test]
1813218144fn parse_select_parenthesized_wildcard() {
1813318145 // Test SELECT DISTINCT(*) which uses a parenthesized wildcard
You can’t perform that action at this time.
0 commit comments