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

Wrong result set with utf8mb4_danish_ci and BNLH join

    XMLWordPrintable

Details

    Description

      CREATE OR REPLACE TABLE t1 (a VARCHAR(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_danish_ci);
      INSERT INTO t1 VALUES ('aaaa'),('åå');
      SELECT * FROM t1 WHERE a='aaaa';
      

      +------+
      | a    |
      +------+
      | aaaa |
      | åå   |
      +------+
      

      Looks good so far. It returns two records, because in Danish collation 'å' is equal to 'aa'.

      Now I join the table to itself:

      SET join_cache_level=1;
      SELECT * FROM t1 NATURAL JOIN t1 t2;
      

      +------+
      | a    |
      +------+
      | aaaa |
      | åå   |
      | aaaa |
      | åå   |
      +------+
      

      Looks good so far.

      Now I enable the BNLH join:

      SET join_cache_level=3;
      SELECT * FROM t1 NATURAL JOIN t1 t2;
      

      +------+
      | a    |
      +------+
      | aaaa |
      | åå   |
      +------+
      

      Half of the records disappeared. Looks wrong.

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0d
                  0d
                  Logged:
                  Time Spent - 3h
                  3h

                  Git Integration

                    Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.