Proper fix for bug with BLOB in MIN/MAX
sql/key.cc: Change constant to define
This commit is contained in:
parent
0153488a02
commit
fe9647968d
@ -182,9 +182,9 @@ int key_cmp(TABLE *table,const byte *key,uint idx,uint key_length)
|
||||
}
|
||||
if (key_part->key_part_flag & (HA_BLOB_PART | HA_VAR_LENGTH))
|
||||
{
|
||||
if (key_part->field->key_cmp(key, key_part->length+2))
|
||||
if (key_part->field->key_cmp(key, key_part->length+ HA_KEY_BLOB_LENGTH))
|
||||
return 1;
|
||||
length=key_part->length+2;
|
||||
length=key_part->length+HA_KEY_BLOB_LENGTH;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -440,14 +440,16 @@ static bool find_range_key(TABLE_REF *ref, Field* field, COND *cond)
|
||||
left_length < part->store_length ||
|
||||
(table->file->index_flags(idx) & HA_WRONG_ASCII_ORDER))
|
||||
break;
|
||||
uint store_length= part->store_length;
|
||||
// Save found constant
|
||||
if (part->null_bit)
|
||||
{
|
||||
*key_ptr++= (byte) test(part->field->is_null());
|
||||
part->field->get_key_image((char*) key_ptr,
|
||||
(part->field->type() == FIELD_TYPE_BLOB) ?
|
||||
part->length + HA_KEY_BLOB_LENGTH : part->length);
|
||||
key_ptr+=part->store_length - test(part->null_bit);
|
||||
left_length-=part->store_length;
|
||||
store_length--;
|
||||
}
|
||||
part->field->get_key_image((char*) key_ptr, store_length);
|
||||
key_ptr+= store_length;
|
||||
left_length-= part->store_length;
|
||||
}
|
||||
if (part == part_end && part->field == field)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user