1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

Fixed bug mdev-9628.

In the function create_key_parts_for_pseudo_indexes()
the key part structures of pseudo-indexes created for
BLOB fields were set incorrectly.
Also the key parts for long fields must be 'truncated'
up to the maximum length acceptable for key parts.
This commit is contained in:
Igor Babaev
2016-10-26 10:59:38 -07:00
parent 9d4a0dde0a
commit d451d772fd
5 changed files with 198 additions and 1 deletions

View File

@ -3345,9 +3345,16 @@ bool create_key_parts_for_pseudo_indexes(RANGE_OPT_PARAM *param,
{
Field *field= *field_ptr;
uint16 store_length;
uint16 max_key_part_length= (uint16) table->file->max_key_part_length();
key_part->key= keys;
key_part->part= 0;
key_part->length= (uint16) field->key_length();
if (field->flags & BLOB_FLAG)
key_part->length= max_key_part_length;
else
{
key_part->length= (uint16) field->key_length();
set_if_smaller(key_part->length, max_key_part_length);
}
store_length= key_part->length;
if (field->real_maybe_null())
store_length+= HA_KEY_NULL_LENGTH;