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

record appear mutiply time in pagination query order by column with same value

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Not a Bug
    • 10.1.17
    • N/A
    • None
    • CentOS 7 64bit

    Description

      with mariadb 10.1, the record with id 8 appear twice

      MariaDB [test]> DROP TABLE random_order;
      Query OK, 0 rows affected, 1 warning (0.01 sec)
       
      MariaDB [test]> CREATE TABLE `random_order` ( `Id` INT NOT NULL AUTO_INCREMENT , `Name` VARCHAR(8) NOT NULL , PRIMARY KEY (`Id`)) ENGINE = InnoDB;
      Query OK, 0 rows affected (0.04 sec)
       
      MariaDB [test]> INSERT INTO `random_order` (`Id`, `Name`) VALUES (NULL, 'a'), (NULL, 'a'), (NULL, 'a'), (NULL, 'a'), (NULL, 'a'), (NULL, 'a'), (NULL, 'a'), (N
      ULL, 'a');
      Query OK, 8 rows affected (0.00 sec)
      Records: 8  Duplicates: 0  Warnings: 0
       
      MariaDB [test]> SELECT * FROM `random_order` ORDER BY Name LIMIT 0,2;
      +----+------+
      | Id | Name |
      +----+------+
      |  8 | a    |
      |  2 | a    |
      +----+------+
      2 rows in set (0.00 sec)
       
      MariaDB [test]> SELECT * FROM `random_order` ORDER BY Name LIMIT 2,2;
      +----+------+
      | Id | Name |
      +----+------+
      |  3 | a    |
      |  4 | a    |
      +----+------+
      2 rows in set (0.00 sec)
       
      MariaDB [test]> SELECT * FROM `random_order` ORDER BY Name LIMIT 4,2;
      +----+------+
      | Id | Name |
      +----+------+
      |  5 | a    |
      |  6 | a    |
      +----+------+
      2 rows in set (0.00 sec)
       
      MariaDB [test]> SELECT * FROM `random_order` ORDER BY Name LIMIT 6,2;
      +----+------+
      | Id | Name |
      +----+------+
      |  7 | a    |
      |  8 | a    |
      +----+------+
      2 rows in set (0.00 sec)
      

      and mariadb 5.5 works as expected:

      MariaDB [test]> DROP TABLE random_order;
      Query OK, 0 rows affected (0.02 sec)
       
      MariaDB [test]> CREATE TABLE `random_order` ( `Id` INT NOT NULL AUTO_INCREMENT , `Name` VARCHAR(8) NOT NULL , PRIMARY KEY (`Id`)) ENGINE = InnoDB;
      Query OK, 0 rows affected (0.06 sec)
       
      MariaDB [test]> INSERT INTO `random_order` (`Id`, `Name`) VALUES (NULL, 'a'), (NULL, 'a'), (NULL, 'a'), (NULL, 'a'), (NULL, 'a'), (NULL, 'a'), (NULL, 'a'), (N
      ULL, 'a');
      Query OK, 8 rows affected (0.00 sec)
      Records: 8  Duplicates: 0  Warnings: 0
       
      MariaDB [test]> SELECT * FROM `random_order` ORDER BY Name LIMIT 0,2;
      +----+------+
      | Id | Name |
      +----+------+
      |  1 | a    |
      |  2 | a    |
      +----+------+
      2 rows in set (0.00 sec)
       
      MariaDB [test]> SELECT * FROM `random_order` ORDER BY Name LIMIT 2,2;
      +----+------+
      | Id | Name |
      +----+------+
      |  3 | a    |
      |  4 | a    |
      +----+------+
      2 rows in set (0.00 sec)
       
      MariaDB [test]> SELECT * FROM `random_order` ORDER BY Name LIMIT 4,2;
      +----+------+
      | Id | Name |
      +----+------+
      |  5 | a    |
      |  6 | a    |
      +----+------+
      2 rows in set (0.00 sec)
       
      MariaDB [test]> SELECT * FROM `random_order` ORDER BY Name LIMIT 6,2;
      +----+------+
      | Id | Name |
      +----+------+
      |  7 | a    |
      |  8 | a    |
      +----+------+
      2 rows in set (0.00 sec)
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            jarod_liu Jarod Liu
            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.