MDEV-35158 Assertion `res->length() > 0 && res->length() % 4 == 0' fails upon increasing length of vector column

This commit is contained in:
Sergei Golubchik 2024-10-15 18:58:50 +02:00
parent 6634c88480
commit 91720da9be
3 changed files with 17 additions and 2 deletions

View file

@ -210,3 +210,10 @@ select vec_totext(a) from t1;
vec_totext(a)
[14660154687488.000000,14660154687488.000000]
drop table t1;
#
# MDEV-35158 Assertion `res->length() > 0 && res->length() % 4 == 0' fails upon increasing length of vector column
#
create table t1 (a int, v vector(1) not null, vector(v));
insert t1 values (1, 0x00000000);
alter table t1 modify v vector(64) not null;
drop table t1;

View file

@ -158,3 +158,11 @@ alter table t1 modify a vector(2);
select hex(a) from t1;
select vec_totext(a) from t1;
drop table t1;
--echo #
--echo # MDEV-35158 Assertion `res->length() > 0 && res->length() % 4 == 0' fails upon increasing length of vector column
--echo #
create table t1 (a int, v vector(1) not null, vector(v));
insert t1 values (1, 0x00000000);
alter table t1 modify v vector(64) not null;
drop table t1;

View file

@ -243,8 +243,8 @@ int Field_vector::reset()
static void do_copy_vec(const Copy_field *copy)
{
uint from_length_bytes= 1 + (copy->from_length > 258);
uint to_length_bytes= 1 + (copy->to_length > 258);
uint from_length_bytes= 1 + (copy->from_length > 257);
uint to_length_bytes= 1 + (copy->to_length > 257);
uint from_length= copy->from_length - from_length_bytes;
uint to_length= copy->to_length - to_length_bytes;
uchar *from= copy->from_ptr + from_length_bytes;