From 4aa1968b890da21dc81e40394110f49c683bf025 Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Wed, 3 Jul 2024 19:52:53 +0400 Subject: [PATCH] Disable VECTOR indexes with partitioned tables --- mysql-test/main/vector_partition.result | 19 +++++++++++++++++++ mysql-test/main/vector_partition.test | 25 +++++++++++++++++++++++++ sql/sql_table.cc | 5 +++++ 3 files changed, 49 insertions(+) create mode 100644 mysql-test/main/vector_partition.result create mode 100644 mysql-test/main/vector_partition.test diff --git a/mysql-test/main/vector_partition.result b/mysql-test/main/vector_partition.result new file mode 100644 index 00000000000..a45af75ef13 --- /dev/null +++ b/mysql-test/main/vector_partition.result @@ -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 diff --git a/mysql-test/main/vector_partition.test b/mysql-test/main/vector_partition.test new file mode 100644 index 00000000000..ca5c69a4641 --- /dev/null +++ b/mysql-test/main/vector_partition.test @@ -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; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index f5344257f71..5edcd9cc683 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -3243,6 +3243,11 @@ mysql_prepare_create_table_finalize(THD *thd, HA_CREATE_INFO *create_info, key_number--; // Skip this key continue; 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) key->key_create_info.algorithm= HA_KEY_ALG_VECTOR; break;