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

Function found_rows() gives incorrect result where the previous SELECT contains ORDER BY clause

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.0(EOL), 10.1(EOL)
    • 10.0.24, 10.1.12
    • Optimizer
    • None
    • 10.0.24

    Description

      Output:
      =====

      mysql> create table t1(c1 int);
      Query OK, 0 rows affected (0.01 sec)
       
      mysql> insert into t1 values(1),(2),(3),(4),(5);
      Query OK, 5 rows affected (0.00 sec)
      Records: 5  Duplicates: 0  Warnings: 0
       
      mysql> select * from t1 order by c1 limit 2,1;
      +------+
      | c1   |
      +------+
      |    3 |
      +------+
      1 row in set (0.00 sec)
       
      mysql> select found_rows();
      +--------------+
      | found_rows() |
      +--------------+
      |            5 |
      +--------------+
      1 row in set (0.00 sec)
       
      mysql> select version();
      +-----------------+
      | version()       |
      +-----------------+
      | 10.1.10-MariaDB |
      +-----------------+
      1 row in set (0.00 sec)
       

      Repeat:
      =====

      drop table if exists t1;
      create table t1(c1 int);
      insert into t1 values(1),(2),(3),(4),(5);
      select * from t1 order by c1 limit 2,1;
      select found_rows();
       

      Problem:
      =====
      3 is expected.

      Attachments

        Activity

          dylan Dylan Su created issue -
          elenst Elena Stepanova made changes -
          Field Original Value New Value
          Status Open [ 1 ] Confirmed [ 10101 ]

          Thanks for the report and the test case.

          The problem appeared in 10.0 tree with this revision:

          commit fde6ee61bbdeb051a169aac8da56e24bf2accdce
          Author: Sergei Golubchik <sergii@pisem.net>
          Date:   Thu Jun 5 15:59:41 2014 +0200
           
              revert the fix for MDEV-5898, restore the fix for MDEV-5549.
              simplify test case for MDEV-5898

          elenst Elena Stepanova added a comment - Thanks for the report and the test case. The problem appeared in 10.0 tree with this revision: commit fde6ee61bbdeb051a169aac8da56e24bf2accdce Author: Sergei Golubchik <sergii@pisem.net> Date: Thu Jun 5 15:59:41 2014 +0200   revert the fix for MDEV-5898, restore the fix for MDEV-5549. simplify test case for MDEV-5898
          elenst Elena Stepanova made changes -
          Fix Version/s 10.0 [ 16000 ]
          Fix Version/s 10.1 [ 16100 ]
          Affects Version/s 10.0 [ 16000 ]
          Affects Version/s 10.1 [ 16100 ]
          Affects Version/s 10.1.10 [ 20402 ]
          Assignee Sergei Golubchik [ serg ]
          ratzpo Rasmus Johansson (Inactive) made changes -
          Sprint 10.0.24-0 [ 35 ]
          ratzpo Rasmus Johansson (Inactive) made changes -
          Rank Ranked higher
          serg Sergei Golubchik made changes -
          Status Confirmed [ 10101 ] In Progress [ 3 ]
          serg Sergei Golubchik made changes -
          Status In Progress [ 3 ] Stalled [ 10000 ]
          serg Sergei Golubchik made changes -
          Component/s Optimizer [ 10200 ]
          Fix Version/s 10.0.24 [ 21101 ]
          Fix Version/s 10.1.12 [ 21502 ]
          Fix Version/s 10.0 [ 16000 ]
          Fix Version/s 10.1 [ 16100 ]
          Resolution Fixed [ 1 ]
          Status Stalled [ 10000 ] Closed [ 6 ]
          serg Sergei Golubchik made changes -
          Workflow MariaDB v3 [ 73601 ] MariaDB v4 [ 149988 ]

          People

            serg Sergei Golubchik
            dylan Dylan Su
            Votes:
            1 Vote for this issue
            Watchers:
            4 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.