Commit e5bc21af authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-4813 Replication fails on updating a MEMORY table with an index using btree

skip NULL VARCHAR key parts like it's done elsewhere
parent d2e80802
create table t1 (f1 varchar(128), f2 varchar(128), key (f2,f1) using btree) engine=memory;
insert into t1 values (null,'not'),('one',null),('two',null),('three','');
select * from t1 where f1 = 'one' and f2 is null;
f1 f2
one NULL
drop table t1;
#
# MDEV-4813 Replication fails on updating a MEMORY table with an index using btree
#
create table t1 (f1 varchar(128), f2 varchar(128), key (f2,f1) using btree) engine=memory;
insert into t1 values (null,'not'),('one',null),('two',null),('three','');
select * from t1 where f1 = 'one' and f2 is null;
drop table t1;
...@@ -876,8 +876,13 @@ uint hp_rb_pack_key(HP_KEYDEF *keydef, uchar *key, const uchar *old, ...@@ -876,8 +876,13 @@ uint hp_rb_pack_key(HP_KEYDEF *keydef, uchar *key, const uchar *old,
if (seg->null_bit) if (seg->null_bit)
{ {
if (!(*key++= (char) 1 - *old++)) if (!(*key++= (char) 1 - *old++))
{
/* Add key pack length (2) to key for VARCHAR segments */
if (seg->type == HA_KEYTYPE_VARTEXT1)
old+= 2;
continue; continue;
} }
}
if (seg->flag & HA_SWAP_KEY) if (seg->flag & HA_SWAP_KEY)
{ {
uint length= seg->length; uint length= seg->length;
......
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