diff options
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r-- | sql/sql_select.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 8d651c00a0a..0abfb483820 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -6369,7 +6369,8 @@ end_send(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), if ((join->tables == 1) && !join->tmp_table && !join->sort_and_group && !join->send_group_parts && !join->having && !jt->select_cond && !(jt->select && jt->select->quick) && - !(jt->table->file->table_flags() & HA_NOT_EXACT_COUNT)) + !(jt->table->file->table_flags() & HA_NOT_EXACT_COUNT) && + (jt->ref.key < 0)) { /* Join over all rows in table; Return number of found rows */ TABLE *table=jt->table; @@ -6462,7 +6463,11 @@ end_send_group(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), if (error > 0) DBUG_RETURN(-1); /* purecov: inspected */ if (end_of_records) + { + if (!error) + join->send_records++; DBUG_RETURN(0); + } if (join->send_records >= join->unit->select_limit_cnt && join->do_send_rows) { |