Require space after -- to start single line comment in MySQL (#1705)

This commit is contained in:
Hans Ott 2025-02-05 20:47:17 +01:00 committed by GitHub
parent 751dc5afce
commit 443f492b4b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 127 additions and 6 deletions

View file

@ -3250,3 +3250,18 @@ fn parse_double_precision() {
"CREATE TABLE foo (bar DOUBLE(11,0))",
);
}
#[test]
fn parse_looks_like_single_line_comment() {
mysql().one_statement_parses_to(
"UPDATE account SET balance=balance--1 WHERE account_id=5752",
"UPDATE account SET balance = balance - -1 WHERE account_id = 5752",
);
mysql().one_statement_parses_to(
r#"
UPDATE account SET balance=balance-- 1
WHERE account_id=5752
"#,
"UPDATE account SET balance = balance WHERE account_id = 5752",
);
}