Skip to content

Commit 74396a1

Browse files
committed
Key Value Options: add support for trailing semicolon
1 parent 1b842d3 commit 74396a1

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/parser/mod.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18409,7 +18409,7 @@ impl<'a> Parser<'a> {
1840918409
return self.expected(" another option or EOF", self.peek_token());
1841018410
}
1841118411
}
18412-
Token::EOF => break,
18412+
Token::EOF | Token::SemiColon => break,
1841318413
Token::Comma => {
1841418414
delimiter = KeyValueOptionsDelimiter::Comma;
1841518415
continue;
@@ -18421,7 +18421,7 @@ impl<'a> Parser<'a> {
1842118421
self.prev_token();
1842218422
break;
1842318423
}
18424-
_ => return self.expected("another option, EOF, Comma or ')'", self.peek_token()),
18424+
_ => return self.expected("another option, EOF, SemiColon, Comma or ')'", self.peek_token()),
1842518425
};
1842618426
}
1842718427

@@ -19306,4 +19306,11 @@ mod tests {
1930619306
assert!(Parser::parse_sql(&GenericDialect, &sql).is_err());
1930719307
}
1930819308
}
19309+
19310+
#[test]
19311+
fn test_key_value_options_trailing_semicolon() {
19312+
let sql = "CREATE USER u1 option1 = 'value1' option2 = 'value2';";
19313+
let ast = Parser::parse_sql(&GenericDialect, sql);
19314+
assert!(ast.is_ok());
19315+
}
1930919316
}

0 commit comments

Comments
 (0)