[MDEV-22830] SQL_CALC_FOUND_ROWS not working properly for single SELECT for DUAL. Created: 2020-06-08  Updated: 2020-06-10  Resolved: 2020-06-09

Status: Closed
Project: MariaDB Server
Component/s: OTHER
Affects Version/s: 10.1
Fix Version/s: 10.5.4, 10.1.46, 10.2.33, 10.3.24, 10.4.14

Type: Bug Priority: Major
Reporter: Rucha Deodhar Assignee: Rucha Deodhar
Resolution: Fixed Votes: 0
Labels: None


 Description   

SQL_CALC_FOUND_ROWS not working properly, gives output zero because send_records is not getting incremented properly.

 
MariaDB [test]> SELECT SQL_CALC_FOUND_ROWS 1 FROM DUAL WHERE 0;
Empty set (0.00 sec)
 
MariaDB [test]> SELECT FOUND_ROWS();
+--------------+
| FOUND_ROWS() |
+--------------+
|            0 |
+--------------+
1 row in set (0.00 sec)
 



 Comments   
Comment by Rucha Deodhar [ 2020-06-09 ]

send_records in JOIN::exec_inner() was assigning 0 directly to send_records without checking if the flag that represents SQL_CALC_FOUND_ROWS is set. If it is set, send_records should be 1 otherwise 0.

Comment by Oleksandr Byelkin [ 2020-06-09 ]

OK to push after adding space between MDEV number with : and title of the bug.

Generated at Thu Feb 08 09:17:48 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.