diff options
author | unknown <monty@hundin.mysql.fi> | 2002-06-10 13:33:25 +0300 |
---|---|---|
committer | unknown <monty@hundin.mysql.fi> | 2002-06-10 13:33:25 +0300 |
commit | 45e0cd61290d8c11edb9f6bbb5cc753bff35ccec (patch) | |
tree | da77e35875e5ea4fe29bf0d97a53ab041b985667 /sql | |
parent | 3a395a994a3d1f5d38e16e7b4781297692114cfc (diff) | |
download | mariadb-git-45e0cd61290d8c11edb9f6bbb5cc753bff35ccec.tar.gz |
Fixed bug in SQL_CALC_FOUND_ROWS + LIMIT
Docs/manual.texi:
Changelog
mysql-test/r/select_found.result:
Test of FOUND_ROWS() bug fix
mysql-test/t/select_found.test:
Test of FOUND_ROWS() bug fix
Diffstat (limited to 'sql')
-rw-r--r-- | sql/sql_select.cc | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 7f194b85ab8..315211f63c5 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -4900,12 +4900,24 @@ end_send(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), JOIN_TAB *jt=join->join_tab; 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)) { /* Join over all rows in table; Return number of found rows */ + TABLE *table=jt->table; + join->select_options ^= OPTION_FOUND_ROWS; - jt->table->file->info(HA_STATUS_VARIABLE); - join->send_records = jt->table->file->records; + if (table->record_pointers || + (table->io_cache && my_b_inited(table->io_cache))) + { + /* Using filesort */ + join->send_records= table->found_records; + } + else + { + table->file->info(HA_STATUS_VARIABLE); + join->send_records = table->file->records; + } } else { |