summaryrefslogtreecommitdiff
path: root/sql/opt_range.cc
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2013-01-28 13:36:05 +0100
committerSergei Golubchik <sergii@pisem.net>2013-01-28 13:36:05 +0100
commit87de27e46b889d86cd872adf8ce613128d379911 (patch)
tree87f3ec6d65538b9bc199408f58daaa2ec9e7a702 /sql/opt_range.cc
parentf08a404a6d87f7c8c7fef1862eaf768cf920677b (diff)
parent34e84c227f1cb76771eabf229b4cf1b5292eef25 (diff)
downloadmariadb-git-87de27e46b889d86cd872adf8ce613128d379911.tar.gz
5.3 merge
Diffstat (limited to 'sql/opt_range.cc')
-rw-r--r--sql/opt_range.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index f3dd3b8e2d0..8f094c47f67 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -13382,9 +13382,10 @@ int QUICK_GROUP_MIN_MAX_SELECT::next_min()
*/
if (min_max_arg_part && min_max_arg_part->field->is_null())
{
+ uchar *tmp_key_buff= (uchar*)my_alloca(max_used_key_length);
/* Find the first subsequent record without NULL in the MIN/MAX field. */
- key_copy(tmp_record, record, index_info, max_used_key_length);
- result= file->ha_index_read_map(record, tmp_record,
+ key_copy(tmp_key_buff, record, index_info, max_used_key_length);
+ result= file->ha_index_read_map(record, tmp_key_buff,
make_keypart_map(real_key_parts),
HA_READ_AFTER_KEY);
/*
@@ -13400,10 +13401,11 @@ int QUICK_GROUP_MIN_MAX_SELECT::next_min()
if (!result)
{
if (key_cmp(index_info->key_part, group_prefix, real_prefix_len))
- key_restore(record, tmp_record, index_info, 0);
+ key_restore(record, tmp_key_buff, index_info, 0);
}
else if (result == HA_ERR_KEY_NOT_FOUND || result == HA_ERR_END_OF_FILE)
result= 0; /* There is a result in any case. */
+ my_afree(tmp_key_buff);
}
}