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

    XMLWordPrintable

    Details

    • Sprint:
      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

            People

            Assignee:
            serg Sergei Golubchik
            Reporter:
            dylan Dylan Su
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: