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

Wrong (corrupt) result upon SELECT with ORDER BY, compressed column and certain charsets

    XMLWordPrintable

    Details

      Description

      CREATE TABLE t (a varchar(64) /*!100301 COMPRESSED*/, b INT) CHARSET utf32;
      INSERT INTO t VALUES ('foo',1),('bar',2);
       
      SELECT a, HEX(a) FROM t WHERE b IN ( SELECT b FROM t WHERE b IN ( SELECT b FROM t ) ) ORDER BY a;
      SELECT a, HEX(a) FROM t WHERE b IN ( SELECT b FROM t WHERE b IN ( SELECT b FROM t ) );
       
      # Cleanup
      DROP TABLE t;
      

      The second (unordered) select returns the expected values. The first one, with ORDER BY, returns garbage, even though HEX is okay.

      10.3 3fd80d08 with utf32

      SELECT a, HEX(a) FROM t WHERE b IN ( SELECT b FROM t WHERE b IN ( SELECT b FROM t ) ) ORDER BY a;
      a	HEX(a)
      	000000660000006F0000006F
      	000000620000006100000072
      SELECT a, HEX(a) FROM t WHERE b IN ( SELECT b FROM t WHERE b IN ( SELECT b FROM t ) );
      a	HEX(a)
      foo	000000660000006F0000006F
      bar	000000620000006100000072
      

      with utf16

      SELECT a, HEX(a) FROM t WHERE b IN ( SELECT b FROM t WHERE b IN ( SELECT b FROM t ) ) ORDER BY a;
      a	HEX(a)
      ba	006200610072
      fo	0066006F006F
      SELECT a, HEX(a) FROM t WHERE b IN ( SELECT b FROM t WHERE b IN ( SELECT b FROM t ) );
      a	HEX(a)
      foo	0066006F006F
      bar	006200610072
      

        Attachments

          Activity

            People

            Assignee:
            bar Alexander Barkov
            Reporter:
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            1 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.