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

long uniques don't work with unicode collations

    XMLWordPrintable

    Details

      Description

      set names utf8;
      create table t1 (a text collate utf8_general_ci unique);
      show create table t1;
      insert t1 values ('a');
      insert t1 values ('ä');
      select * from t1;
      select distinct * from t1;
      select 'a' = 'ä';
      drop table t1;
      

      shows that one can insert two characters into a long unique index that compare equally.

      It happens because calc_hash_for_unique() hashes string length in bytes together with the string content. So even if two utf8 strings hash to the same value, they can have different length in bytes and long unique hash will be different.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              bar Alexander Barkov
              Reporter:
              serg Sergei Golubchik
              Votes:
              3 Vote for this issue
              Watchers:
              9 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.