Skip to content

Commit 334264f

Browse files
committed
Key Value Options: add support for trailing semicolon
1 parent ab76a07 commit 334264f

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
@@ -18780,7 +18780,7 @@ impl<'a> Parser<'a> {
1878018780
return self.expected(" another option or EOF", self.peek_token());
1878118781
}
1878218782
}
18783-
Token::EOF => break,
18783+
Token::EOF | Token::SemiColon => break,
1878418784
Token::Comma => {
1878518785
delimiter = KeyValueOptionsDelimiter::Comma;
1878618786
continue;
@@ -18792,7 +18792,7 @@ impl<'a> Parser<'a> {
1879218792
self.prev_token();
1879318793
break;
1879418794
}
18795-
_ => return self.expected("another option, EOF, Comma or ')'", self.peek_token()),
18795+
_ => return self.expected("another option, EOF, SemiColon, Comma or ')'", self.peek_token()),
1879618796
};
1879718797
}
1879818798

@@ -19677,4 +19677,11 @@ mod tests {
1967719677
assert!(Parser::parse_sql(&GenericDialect, &sql).is_err());
1967819678
}
1967919679
}
19680+
19681+
#[test]
19682+
fn test_key_value_options_trailing_semicolon() {
19683+
let sql = "CREATE USER u1 option1 = 'value1' option2 = 'value2';";
19684+
let ast = Parser::parse_sql(&GenericDialect, sql);
19685+
assert!(ast.is_ok());
19686+
}
1968019687
}

0 commit comments

Comments
 (0)