Commit 1b1bf430 authored by Sergei Golubchik's avatar Sergei Golubchik

tolerate old pcre versions without PCRE2_EXTENDED_MORE flag

parent 0b8b84d8
...@@ -819,8 +819,11 @@ SET default_regex_flags=DEFAULT; ...@@ -819,8 +819,11 @@ SET default_regex_flags=DEFAULT;
SELECT 'Aq' RLIKE 'A\\q'; SELECT 'Aq' RLIKE 'A\\q';
ERROR 42000: Regex error 'unrecognized character follows \ at offset 2' ERROR 42000: Regex error 'unrecognized character follows \ at offset 2'
SET default_regex_flags='EXTRA'; SET default_regex_flags='EXTRA';
SELECT 'Aq' RLIKE 'A\\q'; SELECT 'A' RLIKE 'B';
ERROR 42000: Regex error 'unrecognized character follows \ at offset 2' 'A' RLIKE 'B'
0
Warnings:
Warning 1105 PCRE2 doesn't support the EXTRA flag. Ignored.
SET default_regex_flags=DEFAULT; SET default_regex_flags=DEFAULT;
SELECT 'a\nb\nc' RLIKE '^b$'; SELECT 'a\nb\nc' RLIKE '^b$';
'a\nb\nc' RLIKE '^b$' 'a\nb\nc' RLIKE '^b$'
......
...@@ -384,9 +384,10 @@ SET default_regex_flags=DEFAULT; ...@@ -384,9 +384,10 @@ SET default_regex_flags=DEFAULT;
--error ER_REGEXP_ERROR --error ER_REGEXP_ERROR
SELECT 'Aq' RLIKE 'A\\q'; SELECT 'Aq' RLIKE 'A\\q';
SET default_regex_flags='EXTRA'; SET default_regex_flags='EXTRA';
--error ER_REGEXP_ERROR SELECT 'A' RLIKE 'B';
SELECT 'Aq' RLIKE 'A\\q';
SET default_regex_flags=DEFAULT; SET default_regex_flags=DEFAULT;
SELECT 'a\nb\nc' RLIKE '^b$'; SELECT 'a\nb\nc' RLIKE '^b$';
......
...@@ -5992,6 +5992,11 @@ static Sys_var_set Sys_log_disabled_statements( ...@@ -5992,6 +5992,11 @@ static Sys_var_set Sys_log_disabled_statements(
DEFAULT(LOG_DISABLE_SP), DEFAULT(LOG_DISABLE_SP),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_has_super)); NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_has_super));
#define NOT_SUPPORTED_YET -2
#ifndef PCRE2_EXTENDED_MORE
#define PCRE2_EXTENDED_MORE NOT_SUPPORTED_YET
#endif
static const char *default_regex_flags_names[]= static const char *default_regex_flags_names[]=
{ {
"DOTALL", // (?s) . matches anything including NL "DOTALL", // (?s) . matches anything including NL
...@@ -6024,9 +6029,11 @@ int default_regex_flags_pcre(THD *thd) ...@@ -6024,9 +6029,11 @@ int default_regex_flags_pcre(THD *thd)
{ {
if (default_regex_flags_to_pcre[i] < 0) if (default_regex_flags_to_pcre[i] < 0)
{ {
const char *msg= default_regex_flags_to_pcre[i] == NOT_SUPPORTED_YET
? "Your version of PCRE2 does not support the %s flag. Ignored."
: "PCRE2 doesn't support the %s flag. Ignored.";
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_UNKNOWN_ERROR, ER_UNKNOWN_ERROR, msg, default_regex_flags_names[i]);
"PCRE2 doens't support the EXTRA flag. Ignored.");
continue; continue;
} }
res|= default_regex_flags_to_pcre[i]; res|= default_regex_flags_to_pcre[i];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment