Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MDEV-35338 - Non-copying ALTER does not pad VECTOR column, vector sea… #3706

Open
wants to merge 1 commit into
base: 11.7
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions mysql-test/main/vector_innodb.result
Original file line number Diff line number Diff line change
Expand Up @@ -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;
11 changes: 11 additions & 0 deletions mysql-test/main/vector_innodb.test
Original file line number Diff line number Diff line change
Expand Up @@ -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;
4 changes: 3 additions & 1 deletion sql/sql_table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down