mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
dbms: Server: Fixed behavior of LIKE. Now % correctly matches newlines. [#METR-17588]
This commit is contained in:
parent
0e26b64968
commit
1491260e3b
@ -180,7 +180,7 @@ inline String likePatternToRegexp(const String & pattern)
|
||||
break;
|
||||
case '%':
|
||||
if (pos + 1 != end)
|
||||
res += ".*";
|
||||
res += "(?:.|\n)*";
|
||||
else
|
||||
return res;
|
||||
break;
|
||||
|
@ -0,0 +1,11 @@
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
0
|
||||
0
|
11
dbms/tests/queries/0_stateless/00218_like_regexp_newline.sql
Normal file
11
dbms/tests/queries/0_stateless/00218_like_regexp_newline.sql
Normal file
@ -0,0 +1,11 @@
|
||||
SELECT 'abcdef' LIKE '%abc%def%';
|
||||
SELECT 'abctdef' LIKE '%abc%def%';
|
||||
SELECT 'abc\ndef' LIKE '%abc%def%';
|
||||
SELECT 'abc\ntdef' LIKE '%abc%def%';
|
||||
SELECT 'abct\ndef' LIKE '%abc%def%';
|
||||
SELECT 'abc\n\ndef' LIKE '%abc%def%';
|
||||
SELECT 'abc\n\ntdef' LIKE '%abc%def%';
|
||||
SELECT 'abc\nt\ndef' LIKE '%abc%def%';
|
||||
SELECT 'abct\n\ndef' LIKE '%abc%def%';
|
||||
SELECT 'ab\ndef' LIKE '%abc%def%';
|
||||
SELECT 'abc\nef' LIKE '%abc%def%';
|
Loading…
Reference in New Issue
Block a user