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

REGEXP with binary LHS: literal pattern works, user-variable / PS parameter raises ERROR 1300

    XMLWordPrintable

Details

    Description

      Summary

      On MariaDB 12.3.1 (rev 21a0714a), REGEXP behaves inconsistently when the left-hand side is a binary hex literal. A string-literal pattern works, but the identical pattern stored in a user variable or passed as a prepared-statement parameter raises ERROR 1300.

      Minimal Reproducer

      SET NAMES utf8mb3;
       
      SELECT 0xE001 REGEXP '\\xE0\\x01';
      -- 1
       
      SET @pat='\\xE0\\x01';
      SELECT HEX(@pat);
      -- 5C7845305C783031
       
      SELECT 0xE001 REGEXP @pat;
      -- ERROR 1300 (HY000): Invalid utf8mb3 character string: 'E001'
       
      PREPARE st FROM 'SELECT 0xE001 REGEXP ?';
      EXECUTE st USING @pat;
      -- ERROR 1300 (HY000): Invalid utf8mb3 character string: 'E001'
      DEALLOCATE PREPARE st;
      

      Expected

      The user-variable and PS-parameter forms should behave like the literal form and return 1, not ERROR 1300.

      Environment

      Item Value
      Version 12.3.1-MariaDB-asan-log
      Revision 21a0714a118614982d20bfa504763d7247800091
      Charset utf8mb3

      Attachments

        Activity

          People

            raghunandan.bhat Raghunandan Bhat
            mu mu
            Votes:
            0 Vote for this issue
            Watchers:
            2 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.