Ignore escaped LIKE wildcards in MySQL (#1735)

This commit is contained in:
Michael Victor Zink 2025-02-28 22:07:39 -08:00 committed by GitHub
parent ed416548dc
commit a629ddf89b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 89 additions and 15 deletions

View file

@ -2627,6 +2627,17 @@ fn parse_rlike_and_regexp() {
}
}
#[test]
fn parse_like_with_escape() {
// verify backslash is not stripped for escaped wildcards
mysql().verified_only_select(r#"SELECT 'a\%c' LIKE 'a\%c'"#);
mysql().verified_only_select(r#"SELECT 'a\_c' LIKE 'a\_c'"#);
mysql().verified_only_select(r#"SELECT '%\_\%' LIKE '%\_\%'"#);
mysql().verified_only_select(r#"SELECT '\_\%' LIKE CONCAT('\_', '\%')"#);
mysql().verified_only_select(r#"SELECT 'a%c' LIKE 'a$%c' ESCAPE '$'"#);
mysql().verified_only_select(r#"SELECT 'a_c' LIKE 'a#_c' ESCAPE '#'"#);
}
#[test]
fn parse_kill() {
let stmt = mysql_and_generic().verified_stmt("KILL CONNECTION 5");