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

Sorting behavior changed from 10.1 to 10.3

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Not a Bug
    • 10.3.25, 10.2, 10.3, 10.4, 10.5
    • N/A
    • Character Sets
    • None
    • Ubuntu 20.04

    Description

      The sorting behavior for columns with CRLF (\n\r) values seem to have changed from MariaDB 10.1 to 10.3

      Simple example table

      CREATE TABLE `test` (
        `a` int(11) NOT NULL AUTO_INCREMENT,
        `b` varchar(255) NOT NULL,
        `c` text NOT NULL,
        `d` varchar(255) NOT NULL,
        PRIMARY KEY (`a`)
      ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
       
      INSERT INTO `test` VALUES (1,'A','\r\n','CRLF'),(2,'A','',''),(3,'A','',''),(4,'A','\r\n','CRLF'),(5,'A','','');
      

      Results on MariaDB 10.1 (Ubuntu 18.04 LTS)

      SELECT * FROM test ORDER BY b ASC, c ASC, a ASC;
       
      +---+---+----+------+
      | a | b | c  | d    |
      +---+---+----+------+
      | 2 | A |    |      |
      | 3 | A |    |      |
      | 5 | A |    |      |
      | 1 | A |    | CRLF |
      | 4 | A |    | CRLF |
      +---+---+----+------+
      

      Results on MariaDB 10.3 (Ubuntu 20.04 LTS)

      SELECT * FROM test ORDER BY b ASC, c ASC, a ASC;
       
      +---+---+----+------+
      | a | b | c  | d    |
      +---+---+----+------+
      | 1 | A |    | CRLF |
      | 4 | A |    | CRLF |
      | 2 | A |    |      |
      | 3 | A |    |      |
      | 5 | A |    |      |
      +---+---+----+------+
      

      The ordering for column c has obviously changed, since rows with a CRLF value are now shown before rows with an empty value.

      I did not find any documentation describing this change in sorting behavior. Is this a bug or can this behavior be changed "back" by a setting?

      Attachments

        Issue Links

          Activity

            People

              serg Sergei Golubchik
              derhansen Torben Hansen
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.