summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/r/select_found.result5
-rw-r--r--mysql-test/t/select_found.test2
-rw-r--r--sql/sql_select.cc2
3 files changed, 8 insertions, 1 deletions
diff --git a/mysql-test/r/select_found.result b/mysql-test/r/select_found.result
index a48e1e16d37..8500e244d08 100644
--- a/mysql-test/r/select_found.result
+++ b/mysql-test/r/select_found.result
@@ -183,4 +183,9 @@ titre numeropost maxnumrep
SELECT FOUND_ROWS();
FOUND_ROWS()
3
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 ORDER BY numeropost LIMIT 0;
+titre numeropost maxnumrep
+SELECT FOUND_ROWS();
+FOUND_ROWS()
+3
drop table t1;
diff --git a/mysql-test/t/select_found.test b/mysql-test/t/select_found.test
index b380c86d2db..316e7894344 100644
--- a/mysql-test/t/select_found.test
+++ b/mysql-test/t/select_found.test
@@ -90,4 +90,6 @@ SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE numeropost > 1 LIMIT 0;
SELECT FOUND_ROWS();
SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 0;
SELECT FOUND_ROWS();
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 ORDER BY numeropost LIMIT 0;
+SELECT FOUND_ROWS();
drop table t1;
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index b596d27b5af..05551980309 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -324,7 +324,7 @@ JOIN::prepare(TABLE_LIST *tables_init,
this->group= group_list != 0;
row_limit= ((select_distinct || order || group_list) ? HA_POS_ERROR :
unit->select_limit_cnt);
- do_send_rows = (row_limit) ? 1 : 0;
+ do_send_rows = (unit->select_limit_cnt) ? 1 : 0;
this->unit= unit;
#ifdef RESTRICTED_GROUP