Skip to content

Commit 7f97679

Browse files
yoavcloudayman-sigma
authored andcommitted
Key Value Options: add support for trailing semicolon (apache#2140)
1 parent 1998874 commit 7f97679

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

src/parser/mod.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18812,7 +18812,7 @@ impl<'a> Parser<'a> {
1881218812
return self.expected(" another option or EOF", self.peek_token());
1881318813
}
1881418814
}
18815-
Token::EOF => break,
18815+
Token::EOF | Token::SemiColon => break,
1881618816
Token::Comma => {
1881718817
delimiter = KeyValueOptionsDelimiter::Comma;
1881818818
continue;
@@ -18824,7 +18824,12 @@ impl<'a> Parser<'a> {
1882418824
self.prev_token();
1882518825
break;
1882618826
}
18827-
_ => return self.expected("another option, EOF, Comma or ')'", self.peek_token()),
18827+
_ => {
18828+
return self.expected(
18829+
"another option, EOF, SemiColon, Comma or ')'",
18830+
self.peek_token(),
18831+
)
18832+
}
1882818833
};
1882918834
}
1883018835

tests/sqlparser_common.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18078,3 +18078,11 @@ fn parse_overlap_as_bool_and() {
1807818078
let dialects = all_dialects_where(|d| d.supports_double_ampersand_operator());
1807918079
dialects.one_statement_parses_to("SELECT x && y", "SELECT x AND y");
1808018080
}
18081+
18082+
#[test]
18083+
fn test_parse_key_value_options_trailing_semicolon() {
18084+
one_statement_parses_to(
18085+
"CREATE USER u1 option1='value1' option2='value2';",
18086+
"CREATE USER u1 option1='value1' option2='value2'",
18087+
);
18088+
}

0 commit comments

Comments
 (0)