1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

MDEV-8102 REGEXP function fails to match hex values when expression is stored as a variable

We don't fix the bug itself, we just make regex functions display errors
returned from pcre_exec() as MariaDB warnings.
This commit is contained in:
Alexander Barkov
2015-05-14 14:43:37 +04:00
parent 0b4231e9f1
commit 46199c0e1d
6 changed files with 134 additions and 4 deletions

View File

@ -402,3 +402,27 @@ SET default_regex_flags=DEFAULT;
--echo # MDEV-6965 non-captured group \2 in regexp_replace
--echo #
SELECT REGEXP_REPLACE('1 foo and bar', '(\\d+) foo and (\\d+ )?bar', '\\1 this and \\2that');
--echo #
--echo # MDEV-8102 REGEXP function fails to match hex values when expression is stored as a variable
--echo #
--echo # Testing a warning
SET NAMES latin1;
SET @regCheck= '\\xE0\\x01';
SELECT 0xE001 REGEXP @regCheck;
--echo # Testing workaround N1: This makes the pattern to be a binary string:
SET NAMES latin1;
SET @regCheck= X'E001';
SELECT 0xE001 REGEXP @regCheck;
--echo # Testing workaround N2: This also makes the pattern to be a binary string, using a different syntax:
SET NAMES latin1;
SET @regCheck= _binary '\\xE0\\x01';
SELECT 0xE001 REGEXP @regCheck;
--echo # Testing workarond N3: This makes derivation of the subject string stronger (IMLICIT instead of COERCIBLE)
SET NAMES latin1;
SET @regCheck= '\\xE0\\x01';
SELECT CAST(0xE001 AS BINARY) REGEXP @regCheck;