Details
-
Bug
-
Status: Confirmed (View Workflow)
-
Minor
-
Resolution: Unresolved
-
10.4.10, 10.4.11, 10.3, 10.4
-
None
-
CentOS 7
Description
I am experiencing a bug when updating a field with a REGEX_REPLACE() when the field is a blank string and it is passed through TRIM() first.
To Replicate:
CREATE TABLE `test` ( |
`input` varchar(10) COLLATE utf8_unicode_ci NOT NULL, |
`output` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, |
PRIMARY KEY (`input`) |
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; |
INSERT INTO `test` (`input`, `output`) VALUES ('', NULL); |
UPDATE `test` SET `output` = REGEXP_REPLACE(TRIM(`input`), '[^a-z]', ''); |
Expected Result:
`output` is set to ''
Actual Result:
Got error 'pcre_exec: null argument passed' from regexp
It seems to be something to do with the combination between TRIM() and a field with a blank string as:
UPDATE `test` SET `output` = REGEXP_REPLACE(`input`, '[^a-z]', ''); |
no error
Also:
UPDATE `test` SET `output` = REGEXP_REPLACE(TRIM(''), '[^a-z]', ''); |
no error