mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
Merge pull request #30244 from evillique/fix_like_function
Fix `LIKE` function
This commit is contained in:
commit
377b937aa5
@ -200,7 +200,7 @@ struct MatchImpl
|
||||
}
|
||||
|
||||
/// We check that the entry does not pass through the boundaries of strings.
|
||||
if (pos + strstr_pattern.size() < begin + offsets[i])
|
||||
if (pos + required_substring.size() < begin + offsets[i])
|
||||
{
|
||||
/// And if it does not, if necessary, we check the regexp.
|
||||
|
||||
@ -344,7 +344,7 @@ struct MatchImpl
|
||||
const UInt8 * next_pos = begin;
|
||||
|
||||
/// If required substring is larger than string size - it cannot be found.
|
||||
if (strstr_pattern.size() <= n)
|
||||
if (required_substring.size() <= n)
|
||||
{
|
||||
Searcher searcher(required_substring.data(), required_substring.size(), end - pos);
|
||||
|
||||
@ -360,7 +360,7 @@ struct MatchImpl
|
||||
}
|
||||
next_pos += n;
|
||||
|
||||
if (pos + strstr_pattern.size() <= next_pos)
|
||||
if (pos + required_substring.size() <= next_pos)
|
||||
{
|
||||
/// And if it does not, if necessary, we check the regexp.
|
||||
|
||||
|
2
tests/queries/0_stateless/02045_like_function.reference
Normal file
2
tests/queries/0_stateless/02045_like_function.reference
Normal file
@ -0,0 +1,2 @@
|
||||
1
|
||||
1 1 1 1 1 1
|
10
tests/queries/0_stateless/02045_like_function.sql
Normal file
10
tests/queries/0_stateless/02045_like_function.sql
Normal file
@ -0,0 +1,10 @@
|
||||
SELECT 'r\\a1bbb' LIKE '%r\\\\a1%bbb%' AS res;
|
||||
|
||||
WITH lower('\RealVNC\WinVNC4 /v password') as CommandLine
|
||||
SELECT
|
||||
CommandLine LIKE '%\\\\realvnc\\\\winvnc4%password%' as t1,
|
||||
CommandLine LIKE '%\\\\realvnc\\\\winvnc4 %password%' as t2,
|
||||
CommandLine LIKE '%\\\\realvnc\\\\winvnc4%password' as t3,
|
||||
CommandLine LIKE '%\\\\realvnc\\\\winvnc4 %password' as t4,
|
||||
CommandLine LIKE '%realvnc%winvnc4%password%' as t5,
|
||||
CommandLine LIKE '%\\\\winvnc4%password%' as t6;
|
Loading…
Reference in New Issue
Block a user