summaryrefslogtreecommitdiff
path: root/sql/opt_sum.cc
diff options
context:
space:
mode:
authorSergey Vojtovich <svoj@sun.com>2010-02-09 12:53:13 +0400
committerSergey Vojtovich <svoj@sun.com>2010-02-09 12:53:13 +0400
commit0897669cba1b314c36f41a8a31ee73b6d0d11115 (patch)
tree4399c5a586ac17afc75f2a3776d0bf12b75315fe /sql/opt_sum.cc
parentc12c9780cdbe965bcdce0326b14a171d2f2b8635 (diff)
downloadmariadb-git-0897669cba1b314c36f41a8a31ee73b6d0d11115.tar.gz
BUG#49902 - SELECT returns incorrect results
Queries optimized with GROUP_MIN_MAX didn't cleanup KEYREAD optimization properly. As a result subsequent queries may return incomplete rows (fields are initialized to default values). mysql-test/r/group_min_max.result: A test case for BUG#49902. mysql-test/t/group_min_max.test: A test case for BUG#49902. sql/opt_range.cc: Refactor of KEYREAD optimization switch so that KEYREAD handler state is in sync with st_table::key_read flag. All SQL code is supposed to switch KEYREAD optimization via st_table::set_keyread(). sql/opt_sum.cc: Refactor of KEYREAD optimization switch so that KEYREAD handler state is in sync with st_table::key_read flag. All SQL code is supposed to switch KEYREAD optimization via st_table::set_keyread(). sql/sql_select.cc: Refactor of KEYREAD optimization switch so that KEYREAD handler state is in sync with st_table::key_read flag. All SQL code is supposed to switch KEYREAD optimization via st_table::set_keyread(). sql/sql_update.cc: Refactor of KEYREAD optimization switch so that KEYREAD handler state is in sync with st_table::key_read flag. All SQL code is supposed to switch KEYREAD optimization via st_table::set_keyread(). sql/table.cc: Refactor of KEYREAD optimization switch so that KEYREAD handler state is in sync with st_table::key_read flag. All SQL code is supposed to switch KEYREAD optimization via st_table::set_keyread(). sql/table.h: Refactor of KEYREAD optimization switch so that KEYREAD handler state is in sync with st_table::key_read flag. All SQL code is supposed to switch KEYREAD optimization via st_table::set_keyread().
Diffstat (limited to 'sql/opt_sum.cc')
-rw-r--r--sql/opt_sum.cc17
1 files changed, 3 insertions, 14 deletions
diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc
index e009cf1ca9f..70d6d0a5b17 100644
--- a/sql/opt_sum.cc
+++ b/sql/opt_sum.cc
@@ -326,11 +326,7 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
if (!error && reckey_in_range(0, &ref, item_field->field,
conds, range_fl, prefix_len))
error= HA_ERR_KEY_NOT_FOUND;
- if (table->key_read)
- {
- table->key_read= 0;
- table->file->extra(HA_EXTRA_NO_KEYREAD);
- }
+ table->set_keyread(FALSE);
table->file->ha_index_end();
if (error)
{
@@ -413,11 +409,7 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
if (!error && reckey_in_range(1, &ref, item_field->field,
conds, range_fl, prefix_len))
error= HA_ERR_KEY_NOT_FOUND;
- if (table->key_read)
- {
- table->key_read=0;
- table->file->extra(HA_EXTRA_NO_KEYREAD);
- }
+ table->set_keyread(FALSE);
table->file->ha_index_end();
if (error)
{
@@ -876,10 +868,7 @@ static bool find_key_for_maxmin(bool max_fl, TABLE_REF *ref,
converted (for example to upper case)
*/
if (field->part_of_key.is_set(idx))
- {
- table->key_read= 1;
- table->file->extra(HA_EXTRA_KEYREAD);
- }
+ table->set_keyread(TRUE);
return 1;
}
}