Skip to content

Commit

Permalink
fix(cubestore): Escape regex symbols in like operator (#7175)
Browse files Browse the repository at this point in the history
  • Loading branch information
waralexrom committed Sep 27, 2023
1 parent 09ccd3b commit b88c3f3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
8 changes: 4 additions & 4 deletions rust/cubestore/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 11 additions & 1 deletion rust/cubestore/cubestore-sql-tests/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1579,7 +1579,13 @@ async fn ilike(service: Box<dyn SqlClient>) {
.exec_query(
"INSERT INTO s.strings(t, pat) \
VALUES ('aba', '%ABA'), ('ABa', '%aba%'), ('CABA', 'aba%'), ('ZABA', '%a%b%a%'), ('ZZZ', 'zzz'), ('TTT', 'TTT'),\
('some_underscore', '%some\\\\_underscore%')",
('some_underscore', '%some\\\\_underscore%'),\
('test [ special 1', '%test [%'),\
('test ( special 2', '%test (%'),\
('111 test {)?*|+aaa', '%test {)?*|+aaa'),\
('test2 }]\\\\222 ', 'test2 }]\\\\\\\\%')\
",

)
.await
.unwrap();
Expand Down Expand Up @@ -1632,12 +1638,16 @@ async fn ilike(service: Box<dyn SqlClient>) {
assert_eq!(
to_rows(&r),
rows(&[
("111 test {)?*|+aaa", "%test {)?*|+aaa"),
("ABa", "%aba%"),
("TTT", "TTT"),
("ZABA", "%a%b%a%"),
("ZZZ", "zzz"),
("aba", "%ABA"),
("some_underscore", "%some\\_underscore%"),
("test ( special 2", "%test (%"),
("test [ special 1", "%test [%"),
("test2 }]\\222 ", "test2 }]\\\\%")
])
);

Expand Down

0 comments on commit b88c3f3

Please sign in to comment.