diff options
author | Sergei Golubchik <sergii@pisem.net> | 2014-03-19 20:33:12 +0100 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2014-03-19 20:33:12 +0100 |
commit | 9418bd9c2167ef6a75d7d1bfaaf5e2cf94d09bae (patch) | |
tree | 7555f2df23c72b1b6eea47aab5542be24742f94c /sql/sql_select.cc | |
parent | 1fa1ea0f2df62796a89df8f00f49a4e77d7cf478 (diff) | |
download | mariadb-git-9418bd9c2167ef6a75d7d1bfaaf5e2cf94d09bae.tar.gz |
MDEV-5898 FOUND_ROWS() return incorrect value when using DISTINCT
revert the fix for MDEV-5549, use a different approach.
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r-- | sql/sql_select.cc | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc index fee8b96ad0e..1ea738d976c 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -3064,7 +3064,8 @@ void JOIN::exec_inner() Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF); error= do_select(curr_join, curr_fields_list, NULL, procedure); thd->limit_found_rows= curr_join->send_records; - if (curr_join->order && curr_join->filesort_found_rows) + if (curr_join->order && curr_join->sortorder && + curr_join->select_options & OPTION_FOUND_ROWS) { /* Use info provided by filesort. */ DBUG_ASSERT(curr_join->table_count > curr_join->const_tables); @@ -18562,7 +18563,7 @@ end_send(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), records are read. Because of optimization in some cases it can provide only select_limit_cnt+1 records. */ - if (join->order && join->filesort_found_rows && + if (join->order && join->sortorder && join->select_options & OPTION_FOUND_ROWS) { DBUG_PRINT("info", ("filesort NESTED_LOOP_QUERY_LIMIT")); @@ -18584,7 +18585,6 @@ end_send(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), /* Join over all rows in table; Return number of found rows */ TABLE *table=jt->table; - join->select_options ^= OPTION_FOUND_ROWS; if (table->sort.record_pointers || (table->sort.io_cache && my_b_inited(table->sort.io_cache))) { @@ -20417,11 +20417,7 @@ create_sort_index(THD *thd, JOIN *join, ORDER *order, select, filesort_limit, 0, &examined_rows, &found_rows); table->sort.found_records= filesort_retval; - if (found_rows != HA_POS_ERROR) - { - tab->records= found_rows; // For SQL_CALC_ROWS - join->filesort_found_rows= true; - } + tab->records= found_rows; // For SQL_CALC_ROWS if (quick_created) { |