diff options
author | Sergei Golubchik <sergii@pisem.net> | 2014-03-21 14:36:49 +0100 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2014-03-21 14:36:49 +0100 |
commit | f17831fa745cbd47952c6bf7d4a8eeb9195e6b6c (patch) | |
tree | 32a854494b07c1f6148a895c235bc1a0a0fc9f32 /storage/heap/hp_hash.c | |
parent | a52e2c787d90a6681a2f27bee2a675d12e67c7d2 (diff) | |
download | mariadb-git-f17831fa745cbd47952c6bf7d4a8eeb9195e6b6c.tar.gz |
MDEV-5817 MySQL BUG#11825482: Broken key length calculation for btree index
just as in 5.6 fix - copy the correct null-handling code from MyISAM
Diffstat (limited to 'storage/heap/hp_hash.c')
-rw-r--r-- | storage/heap/hp_hash.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/storage/heap/hp_hash.c b/storage/heap/hp_hash.c index f96cf866138..993d3377b73 100644 --- a/storage/heap/hp_hash.c +++ b/storage/heap/hp_hash.c @@ -875,9 +875,19 @@ uint hp_rb_pack_key(HP_KEYDEF *keydef, uchar *key, const uchar *old, keypart_map>>= 1; if (seg->null_bit) { + /* Convert NULL from MySQL representation into HEAP's. */ if (!(*key++= (char) 1 - *old++)) + { + /* + Skip length part of a variable length field. + Length of key-part used with heap_rkey() always 2. + See also hp_hashnr(). + */ + if (seg->flag & (HA_VAR_LENGTH_PART | HA_BLOB_PART)) + old+= 2; continue; } + } if (seg->flag & HA_SWAP_KEY) { uint length= seg->length; |