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

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

    XMLWordPrintable

Details

    Description

      The regexp function works differently when evaluating a string stored in a variable than it does when evaluating a string literal.

      Example:

      select 
            0xE001A90213021002,
            @regCheck:= '\\xE0\\x01',
            '\\xE0\\x01'= @regCheck,
            0xE001A90213021002 REGEXP @regCheck,
            0xE001A90213021002 REGEXP '\\xE0\\x01';

      The select statement above successfully matches via the regular expression only when the string literal is used. The evaluation of the variable fails to match, even though Maria is saying the string literal and the variable have matching values.

      The problem appears to be related to the use of the hex values in the regular expression, as the following statement evaluates without issue:

      select 
      	@regCheck :='D'
      	@testvar:='Dude',
              @testvar regexp @regCheck,
              @testvar regexp 'D';

      I tested this against MySQL 5.5, where the evaluation fails for both the string literal and the variable (completely non-functional in all situations), so I decided to report the bug here instead.

      Attachments

        Activity

          People

            bar Alexander Barkov
            MarkP Mark Punak
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

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