summaryrefslogtreecommitdiff
path: root/sql/opt_sum.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/opt_sum.cc')
-rw-r--r--sql/opt_sum.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc
index b9de54dbf5c..3fc62d05ae5 100644
--- a/sql/opt_sum.cc
+++ b/sql/opt_sum.cc
@@ -249,20 +249,20 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
Check if case 1 from above holds. If it does, we should read
the skipped tuple.
*/
- if (ref.key_buff[prefix_len] == 1 &&
- /*
+ if (item_field->field->real_maybe_null() &&
+ ref.key_buff[prefix_len] == 1 &&
+ /*
Last keypart (i.e. the argument to MIN) is set to NULL by
find_key_for_maxmin only if all other keyparts are bound
to constants in a conjunction of equalities. Hence, we
can detect this by checking only if the last keypart is
NULL.
- */
+ */
(error == HA_ERR_KEY_NOT_FOUND ||
key_cmp_if_same(table, ref.key_buff, ref.key, prefix_len)))
{
- DBUG_ASSERT(item_field->field->real_maybe_null());
error= table->file->index_read(table->record[0], ref.key_buff,
- ref.key_length,
+ ref.key_length,
HA_READ_KEY_EXACT);
}
}