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

LP:872280 - Wrong sort order with ORDER BY

    Details

    • Type: Bug
    • Status: Closed
    • Resolution: Not a Bug
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:

      Description

      We've found a bug with wrong sort ordering of text data when using ORDER BY. Plase see the attached sql-file with test data. After importing it if you run:

      select * from test_items_g order by item_name;

      you'd see almost at the end of the list:

      96 Aurora RH04 255/70R16 109S 3 5399.00
      95 Aurora RH04 245/75R16 120Q 3 5936.00
      94 Aurora RH04 245/75R16 109S 3 6062.00
      93 Aurora RH04 235/75R15 104S 3 4588.00

      now almost the same query with extra WHERE:

      > select * from test_items_g where item_name like "Aurora RH04%" order by item_name;
      ----------------------------------------------------------+

      item_id item_name manufacturer_id price

      ----------------------------------------------------------+

      93 Aurora RH04 235/75R15 104S 3 4588.00
      94 Aurora RH04 245/75R16 109S 3 6062.00
      95 Aurora RH04 245/75R16 120Q 3 5936.00
      96 Aurora RH04 255/70R16 109S 3 5399.00

      ----------------------------------------------------------+
      4 rows in set (0.01 sec)

      This happens with MariaDB installed from package 5.2.9-mariadb102~squeeze (amd64 version) on Debian Squeeze with kernel 2.6.32-bpo.4-amd64

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            philipstoev Philip Stoev added a comment -

            Re: Wrong sort order with ORDER BY
            Hi,

            If you can, please do the following:

            1. Reproduce the problem on a freshly started server that contains only the data that is required to reproduce the bug.

            2. Once you have observed the wrong result, please use kill -9 to terminate the server instance;

            3. Package the server's data and log directory and my.ini file in a ZIP file and attach it to this bug report.

            If the wrong result is due to database corruption, this procedure may allow us to isolate the corruption and transport it to our debugging environment for further analysis.

            Thank you.

            Show
            philipstoev Philip Stoev added a comment - Re: Wrong sort order with ORDER BY Hi, If you can, please do the following: 1. Reproduce the problem on a freshly started server that contains only the data that is required to reproduce the bug. 2. Once you have observed the wrong result, please use kill -9 to terminate the server instance; 3. Package the server's data and log directory and my.ini file in a ZIP file and attach it to this bug report. If the wrong result is due to database corruption, this procedure may allow us to isolate the corruption and transport it to our debugging environment for further analysis. Thank you.
            Hide
            antonkhalikov Anton Khalikov added a comment -

            Re: Wrong sort order with ORDER BY
            Hi Philip

            I just rsync'ed this database to another server running the same version of mariadb and I couldn't reproduce the problem with the same data there. So this is not a database corruption. Looks like my last resort is to try to run mariadb in chroot environment.

            Show
            antonkhalikov Anton Khalikov added a comment - Re: Wrong sort order with ORDER BY Hi Philip I just rsync'ed this database to another server running the same version of mariadb and I couldn't reproduce the problem with the same data there. So this is not a database corruption. Looks like my last resort is to try to run mariadb in chroot environment.
            Hide
            antonkhalikov Anton Khalikov added a comment -

            Re: Wrong sort order with ORDER BY
            Philip, I am sorry but it was our fault. We had `max_sort_length = 20` on our my.cnf in every affected instance of mysqld. Looks like the bug is to be closed.

            Show
            antonkhalikov Anton Khalikov added a comment - Re: Wrong sort order with ORDER BY Philip, I am sorry but it was our fault. We had `max_sort_length = 20` on our my.cnf in every affected instance of mysqld. Looks like the bug is to be closed.
            Hide
            philipstoev Philip Stoev added a comment -

            Re: Wrong sort order with ORDER BY
            Yes, that would explain it. Please reopen the bug if there is anything else for us to check out.

            Show
            philipstoev Philip Stoev added a comment - Re: Wrong sort order with ORDER BY Yes, that would explain it. Please reopen the bug if there is anything else for us to check out.
            Hide
            ratzpo Rasmus Johansson added a comment -

            Launchpad bug id: 872280

            Show
            ratzpo Rasmus Johansson added a comment - Launchpad bug id: 872280

              People

              • Assignee:
                Unassigned
                Reporter:
                antonkhalikov Anton Khalikov
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: