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

REPLACE() a string with NULL leads to unexpected result for non UTF-8 char sets

    XMLWordPrintable

Details

    • Bug
    • Status: Confirmed (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.1, 10.2, 10.3, 10.4, 10.5
    • 10.4, 10.5
    • Character Sets
    • None

    Description

      I expect both fields of the following query to be NULL, however only the utf8mb4_expected field actually is. Instead, the latin1_unexpected field returns the original string of foo, which is unexpected.

      SELECT
          REPLACE(convert('foo' using utf8mb4), convert('bar' using utf8mb4), null) as `utf8mb4_expected`,
          REPLACE(convert('foo' using latin1), convert('bar' using latin1), null) as `latin1_unexpected`;
      

      +------------------+------------------+
      | utf8mb4_expected | latin_unexpected |
      +------------------+------------------+
      | NULL             | foo              |
      +------------------+------------------+
      1 row in set (0.01 sec)
      

      This seems to be in issue in all versions of MariaDB and all versions of MySQL below 8.0.x (works on MySQL 8.0.21).

      Attachments

        Activity

          People

            sanja Oleksandr Byelkin
            lauxjpn Lau
            Votes:
            0 Vote for this issue
            Watchers:
            3 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.