diff options
author | Igor Babaev <igor@askmonty.org> | 2016-10-26 10:59:38 -0700 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2016-10-26 20:45:35 -0700 |
commit | d451d772fdaa554eeb96ae12f96c3a32a6fd4d66 (patch) | |
tree | ddd2e464baa0afe8b79569ff95b603941d7168d1 /sql/opt_range.cc | |
parent | 9d4a0dde0ae3e0d46b4c5c0967c25862d467e94e (diff) | |
download | mariadb-git-d451d772fdaa554eeb96ae12f96c3a32a6fd4d66.tar.gz |
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.
Diffstat (limited to 'sql/opt_range.cc')
-rw-r--r-- | sql/opt_range.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc index e0ca43e6d72..5d6891a1edf 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -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; |