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

Redundant Item_func_conv_charset on WHERE utf8mb4_field=utf8mb3_field

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 10.2, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9
    • Fix Version/s: 10.9
    • Component/s: Character Sets
    • Labels:
      None

      Description

      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (a TEXT CHARACTER SET utf8mb4, b TEXT CHARACTER SET utf8mb3);
      INSERT INTO t1 VALUES ('a','a');
      EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=b;
      SHOW WARNINGS;
      

      +-------+------+--------------------------------------------------------------------------------------------------------------------------------------+
      | Level | Code | Message                                                                                                                              |
      +-------+------+--------------------------------------------------------------------------------------------------------------------------------------+
      | Note  | 1003 | select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` = convert(`test`.`t1`.`b` using utf8mb4) |
      +-------+------+--------------------------------------------------------------------------------------------------------------------------------------+
      

      The Item_func_conv_charset behind CONVERT() is redundant here. utf8mb3 can be reinterpreted to utf8mb4 without conversion.

      Note, we even allow online alter when converting an utf8mb3 column to utf8mb4 column with the same data type and size. The same optimization can be applied here.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              bar Alexander Barkov
              Reporter:
              bar Alexander Barkov
              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.