summaryrefslogtreecommitdiff
path: root/sql/opt_sum.cc
diff options
context:
space:
mode:
authorunknown <igor@rurik.mysql.com>2004-09-07 19:46:09 -0700
committerunknown <igor@rurik.mysql.com>2004-09-07 19:46:09 -0700
commited24f6d4c6ca35a5372b44f4844b6cc21b68e602 (patch)
tree6b4d2d0566207823bf99bb46602fc6d497449426 /sql/opt_sum.cc
parentb8ff1ebceb9a6d72e6f3ef211cd343f33b801543 (diff)
downloadmariadb-git-ed24f6d4c6ca35a5372b44f4844b6cc21b68e602.tar.gz
func_group.test, func_group.result:
Added test case for bug #5406. opt_sum.cc: Fixed bug #5406. sql/opt_sum.cc: Fixed bug #5406. mysql-test/r/func_group.result: Added test case for bug #5406. mysql-test/t/func_group.test: Added test case for bug #5406.
Diffstat (limited to 'sql/opt_sum.cc')
-rw-r--r--sql/opt_sum.cc18
1 files changed, 8 insertions, 10 deletions
diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc
index f4c39462d0c..538f5c6097d 100644
--- a/sql/opt_sum.cc
+++ b/sql/opt_sum.cc
@@ -186,16 +186,15 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
if (!ref.key_length)
error= table->file->index_first(table->record[0]);
else
- {
error= table->file->index_read(table->record[0],key_buff,
ref.key_length,
range_fl & NEAR_MIN ?
HA_READ_AFTER_KEY :
HA_READ_KEY_OR_NEXT);
- if (!error && reckey_in_range(0, &ref, item_field->field,
- conds, range_fl, prefix_len))
- error= HA_ERR_KEY_NOT_FOUND;
- }
+ if ((!error || error == HA_ERR_KEY_NOT_FOUND) &&
+ 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;
@@ -260,16 +259,15 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
if (!ref.key_length)
error= table->file->index_last(table->record[0]);
else
- {
error= table->file->index_read(table->record[0], key_buff,
ref.key_length,
range_fl & NEAR_MAX ?
HA_READ_BEFORE_KEY :
HA_READ_PREFIX_LAST_OR_PREV);
- if (!error && reckey_in_range(1, &ref, item_field->field,
- conds, range_fl, prefix_len))
- error= HA_ERR_KEY_NOT_FOUND;
- }
+ if ((!error || error == HA_ERR_KEY_NOT_FOUND) &&
+ 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;