Disable VECTOR indexes with partitioned tables

This commit is contained in:
Sergey Vojtovich 2024-07-03 19:52:53 +04:00 committed by Sergei Golubchik
parent 7c16bba71d
commit 4aa1968b89
3 changed files with 49 additions and 0 deletions

View file

@ -0,0 +1,19 @@
# Vector indexes do not support partitioned tables
create table t1 (id int auto_increment primary key,
v blob not null, vector index (v))
partition by key(id) partitions 2;
ERROR HY000: Partitioned tables do not support VECTOR
create table t1 (id int auto_increment primary key,
v blob not null)
partition by key(id) partitions 2;
alter table t1 add vector index(v);
ERROR HY000: Partitioned tables do not support VECTOR
create vector index i on t1(v);
ERROR HY000: Partitioned tables do not support VECTOR
drop table t1;
create table t1 (id int auto_increment primary key,
v blob not null, vector index(v));
alter table t1 partition by key(id) partitions 2;
ERROR HY000: Partitioned tables do not support VECTOR
drop table t1;
db.opt

View file

@ -0,0 +1,25 @@
--source include/have_partition.inc
--echo # Vector indexes do not support partitioned tables
--error ER_FEATURE_NOT_SUPPORTED_WITH_PARTITIONING
create table t1 (id int auto_increment primary key,
v blob not null, vector index (v))
partition by key(id) partitions 2;
create table t1 (id int auto_increment primary key,
v blob not null)
partition by key(id) partitions 2;
--error ER_FEATURE_NOT_SUPPORTED_WITH_PARTITIONING
alter table t1 add vector index(v);
--error ER_FEATURE_NOT_SUPPORTED_WITH_PARTITIONING
create vector index i on t1(v);
drop table t1;
create table t1 (id int auto_increment primary key,
v blob not null, vector index(v));
--error ER_FEATURE_NOT_SUPPORTED_WITH_PARTITIONING
alter table t1 partition by key(id) partitions 2;
drop table t1;
let $datadir=`select @@datadir`;
list_files $datadir/test;

View file

@ -3243,6 +3243,11 @@ mysql_prepare_create_table_finalize(THD *thd, HA_CREATE_INFO *create_info,
key_number--; // Skip this key key_number--; // Skip this key
continue; continue;
case Key::VECTOR: case Key::VECTOR:
if (IF_PARTITIONING(thd->work_part_info, false))
{
my_error(ER_FEATURE_NOT_SUPPORTED_WITH_PARTITIONING, MYF(0), "VECTOR");
DBUG_RETURN(TRUE);
}
if (key->key_create_info.algorithm == HA_KEY_ALG_UNDEF) if (key->key_create_info.algorithm == HA_KEY_ALG_UNDEF)
key->key_create_info.algorithm= HA_KEY_ALG_VECTOR; key->key_create_info.algorithm= HA_KEY_ALG_VECTOR;
break; break;