dbms: Server: Fixed behavior of LIKE. Now % correctly matches newlines. [#METR-17588]

This commit is contained in:
Alexey Arno 2015-09-03 15:09:47 +03:00
parent 0e26b64968
commit 1491260e3b
3 changed files with 23 additions and 1 deletions

View File

@ -180,7 +180,7 @@ inline String likePatternToRegexp(const String & pattern)
break;
case '%':
if (pos + 1 != end)
res += ".*";
res += "(?:.|\n)*";
else
return res;
break;

View File

@ -0,0 +1,11 @@
1
1
1
1
1
1
1
1
1
0
0

View 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%';