diff options
author | rucha174 <rucha.deodhar@mariadb.com> | 2020-06-09 01:35:39 +0530 |
---|---|---|
committer | rucha174 <rucha.deodhar@mariadb.com> | 2020-06-09 14:43:15 +0530 |
commit | 443391236d20cd0303fcc9957eb49a6aaf28316e (patch) | |
tree | f63f7c015578c8a3f7a9cc25bd9cc5e4d2b2e1f5 /sql | |
parent | e1045a768b23ff3847e6ed96d51627b8529d3138 (diff) | |
download | mariadb-git-443391236d20cd0303fcc9957eb49a6aaf28316e.tar.gz |
MDEV-22830: SQL_CALC_FOUND_ROWS not working properly for single SELECT for DUAL
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 'sql')
-rw-r--r-- | sql/sql_select.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 647dee80188..a9c12136497 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -2647,7 +2647,7 @@ void JOIN::exec_inner() thd->get_sent_row_count()); } else - send_records= 0; + send_records= (select_options & OPTION_FOUND_ROWS) ? 1 : 0; if (!error) { join_free(); // Unlock all cursors |