Fixed OptimizedRegularExpression in case of empty regexp

This commit is contained in:
Alexey Milovidov 2020-02-21 18:55:36 +03:00
parent ee710dd1f7
commit 396e9c57d0
3 changed files with 17 additions and 0 deletions

View File

@ -309,6 +309,9 @@ bool OptimizedRegularExpressionImpl<thread_safe>::match(const char * subject, si
if (is_trivial)
{
if (required_substring.empty())
return true;
if (is_case_insensitive)
return haystack_end != case_insensitive_substring_searcher->search(haystack, subject_size);
else
@ -343,6 +346,9 @@ bool OptimizedRegularExpressionImpl<thread_safe>::match(const char * subject, si
if (is_trivial)
{
if (required_substring.empty())
return true;
const UInt8 * pos;
if (is_case_insensitive)
pos = case_insensitive_substring_searcher->search(haystack, subject_size);
@ -402,6 +408,9 @@ unsigned OptimizedRegularExpressionImpl<thread_safe>::match(const char * subject
if (is_trivial)
{
if (required_substring.empty())
return 1;
const UInt8 * pos;
if (is_case_insensitive)
pos = case_insensitive_substring_searcher->search(haystack, subject_size);

View File

@ -0,0 +1,8 @@
DROP DATABASE IF EXISTS test_01084;
CREATE DATABASE test_01084;
USE test_01084;
CREATE TABLE t (x UInt8) ENGINE = Memory;
SELECT * FROM merge('', '');
DROP DATABASE test_01084;