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

UNIQUE USING HASH accepts duplicate entries for tricky collations

    XMLWordPrintable

Details

    Description

      If I use a traditional unique constraint, the table correctly rejects the second record:

      CREATE OR REPLACE TABLE t1 (a VARCHAR(2000) COLLATE utf8_unicode_nopad_ci, UNIQUE(a(3)));
      INSERT INTO t1 VALUES ('ss ');
      INSERT INTO t1 VALUES ('ß ');
      

      ERROR 1062 (23000): Duplicate entry 'ß ' for key 'a'
      

      Now if I do the same thing with UNIQUE USING HASH, it accepts the duplicate record:

      CREATE OR REPLACE TABLE t1 (a VARCHAR(2000) COLLATE utf8_unicode_nopad_ci, UNIQUE(a(3)) USING HASH);
      INSERT INTO t1 VALUES ('ss ');
      INSERT INTO t1 VALUES ('ß ');
      

      This is wrong. The second record should be rejected.

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.