Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-21640

REGEXP_REPLACE 'pcre_exec: null argument passed' from regexp

    XMLWordPrintable

Details

    • Bug
    • Status: Confirmed (View Workflow)
    • Minor
    • Resolution: Unresolved
    • 10.4.10, 10.4.11, 10.3, 10.4
    • 10.4
    • Character Sets, Data types
    • 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

      Attachments

        Activity

          People

            bar Alexander Barkov
            ChrisHSandN Chris Hewett
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.