summaryrefslogtreecommitdiff
path: root/sql/opt_range.cc
diff options
context:
space:
mode:
authorNeeraj Bisht <neeraj.x.bisht@oracle.com>2013-04-30 22:46:37 +0530
committerNeeraj Bisht <neeraj.x.bisht@oracle.com>2013-04-30 22:46:37 +0530
commit697029d12db296b74d577213866a4acb1d85b0f8 (patch)
treeed73e56d1deb2eeb38643abc6d72422e7d6e0ef7 /sql/opt_range.cc
parent3d264bb1e960bcad56d581ee76212215241b4c0f (diff)
parent0c9c76e9eb0513478d3f445d06b75badc8c6d2b8 (diff)
downloadmariadb-git-697029d12db296b74d577213866a4acb1d85b0f8.tar.gz
BUG#16222245 - CRASH WITH EXPLAIN FOR A QUERY WITH LOOSE SCAN FOR
GROUP BY, MYISAM Merge fix for Bug#16222245 from mysql-5.1 to mysql-5.5
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 b8f583a66ed..386faed3aa2 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -11109,9 +11109,11 @@ int QUICK_GROUP_MIN_MAX_SELECT::next_min()
*/
if (min_max_arg_part && min_max_arg_part->field->is_null())
{
+ uchar key_buf[MAX_KEY_LENGTH];
+
/* Find the first subsequent record without NULL in the MIN/MAX field. */
- key_copy(tmp_record, record, index_info, 0);
- result= file->index_read_map(record, tmp_record,
+ key_copy(key_buf, record, index_info, 0);
+ result= file->index_read_map(record, key_buf,
make_keypart_map(real_key_parts),
HA_READ_AFTER_KEY);
/*
@@ -11127,7 +11129,7 @@ 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, key_buf, 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. */