Commit fe964796 authored by unknown's avatar unknown

Proper fix for bug with BLOB in MIN/MAX


sql/key.cc:
  Change constant to define
parent 0153488a
......@@ -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)
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment