diff options
author | rucha174 <rucha.deodhar@mariadb.com> | 2020-06-09 01:35:39 +0530 |
---|---|---|
committer | rucha174 <rucha.deodhar@mariadb.com> | 2020-06-09 13:41:07 +0530 |
commit | 6f26a8a2331b3d48a9fa384464741c1a351ad460 (patch) | |
tree | 580ae234fccff891ca26472c0e143a8dd852ed97 /mysql-test/t/select_found.test | |
parent | d218d1aa49e848cef2bdbe83bbaf08e474d5209c (diff) | |
download | mariadb-git-bb-10.1-MDEV-22830.tar.gz |
MDEV-22830:SQL_CALC_FOUND_ROWS not working properly for single SELECT for DUALbb-10.1-MDEV-22830
In case of SELECT without tables which returns either 0 or 1 rows,
JOIN::exec_inner() did not check if the flag representing SQL_CALC_FOUND_ROWS
is set or not and send_records was direclty assigned 0. So SELECT FOUND_ROWS()
was giving 0 in the output. Now it checks if the flag is set, if it is set
send_record=1 else 0. 1 is the number of rows that could have been sent
to the client if the SELECT query had SQL_CALC_FOUND_ROWS.
It is 0 when no rows were sent because the SELECT query did not have
SQL_CALC_FOUND_ROWS.
Diffstat (limited to 'mysql-test/t/select_found.test')
-rw-r--r-- | mysql-test/t/select_found.test | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/mysql-test/t/select_found.test b/mysql-test/t/select_found.test index 33613697722..092ffc00cdc 100644 --- a/mysql-test/t/select_found.test +++ b/mysql-test/t/select_found.test @@ -286,4 +286,11 @@ select * from t1 order by c1 limit 2,1; select found_rows(); select sql_calc_found_rows * from t1 order by c1 limit 2,1; select found_rows(); + +# +# MDEV-22830 SQL_CALC_FOUND_ROWS not working properly for single SELECT for DUAL +# +SELECT SQL_CALC_FOUND_ROWS 1 FROM DUAL WHERE 0; +SELECT FOUND_ROWS(); + drop table t1; |