mirror of
https://github.com/MariaDB/server.git
synced 2025-01-15 19:42:28 +01:00
MDEV-35338 - Non-copying ALTER does not pad VECTOR column, vector search further does not work
Since VECTOR data type is based on VARCHAR, ALTER TABLE expanding VECTOR column was allowed to go with ALGORITHM=INPLACE. However InnoDB sees such columns as VARCHAR and thus it doesn't pad updated columns data to new length. In contrast to ALGORITHM=COPY, which goes with field copy routines. With this patch ALGORITHM=INPLACE is not allowed for VECTOR columns.
This commit is contained in:
parent
d60efa269e
commit
d4386da772
3 changed files with 28 additions and 1 deletions
|
@ -227,3 +227,17 @@ connection con1;
|
|||
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
|
||||
drop table t;
|
||||
disconnect con1;
|
||||
connection default;
|
||||
#
|
||||
# MDEV-35338 - Non-copying ALTER does not pad VECTOR column,
|
||||
# vector search further does not work
|
||||
#
|
||||
create or replace table t (a int, v vector(1) not null, primary key (a)) engine=InnoDB;
|
||||
insert into t values (1,0x38383838),(2,0x37373737),(3,0x31313131);
|
||||
alter table t modify v vector(2) not null;
|
||||
select hex(v) from t order by a;
|
||||
hex(v)
|
||||
3838383800000000
|
||||
3737373700000000
|
||||
3131313100000000
|
||||
drop table t;
|
||||
|
|
|
@ -231,3 +231,14 @@ rollback;
|
|||
--reap
|
||||
drop table t;
|
||||
--disconnect con1
|
||||
connection default;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-35338 - Non-copying ALTER does not pad VECTOR column,
|
||||
--echo # vector search further does not work
|
||||
--echo #
|
||||
create or replace table t (a int, v vector(1) not null, primary key (a)) engine=InnoDB;
|
||||
insert into t values (1,0x38383838),(2,0x37373737),(3,0x31313131);
|
||||
alter table t modify v vector(2) not null;
|
||||
select hex(v) from t order by a;
|
||||
drop table t;
|
||||
|
|
|
@ -64,6 +64,7 @@
|
|||
#include "rpl_rli.h"
|
||||
#include "log.h"
|
||||
#include "vector_mhnsw.h"
|
||||
#include "sql_type_vector.h"
|
||||
|
||||
#ifdef WITH_WSREP
|
||||
#include "wsrep_mysqld.h"
|
||||
|
@ -6904,7 +6905,8 @@ static bool fill_alter_inplace_info(THD *thd, TABLE *table,
|
|||
|
||||
if (!is_equal)
|
||||
{
|
||||
if (field->table->file->can_convert_nocopy(*field, *new_field))
|
||||
if (!dynamic_cast<const Field_vector *>(field) &&
|
||||
field->table->file->can_convert_nocopy(*field, *new_field))
|
||||
{
|
||||
/*
|
||||
New column type differs from the old one, but storage engine can
|
||||
|
|
Loading…
Reference in a new issue