From cfbf065893dd935a65919108b2c688f8e90114db Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 17 Oct 2024 15:27:45 +0200 Subject: [PATCH] MDEV-35176 ASAN errors in Field_vector::store with optimizer_trace enabled --- mysql-test/main/vector2.result | 5 +++++ mysql-test/main/vector2.test | 6 ++++++ sql/sql_type_vector.h | 1 + 3 files changed, 12 insertions(+) diff --git a/mysql-test/main/vector2.result b/mysql-test/main/vector2.result index e2f224820c1..292f0583c43 100644 --- a/mysql-test/main/vector2.result +++ b/mysql-test/main/vector2.result @@ -229,3 +229,8 @@ select hex(v) from t; hex(v) 0000000000000000 drop table t; +# +# MDEV-35176 ASAN errors in Field_vector::store with optimizer_trace enabled +# +create table t (pk int primary key, v vector(2) not null, key(v(6))); +ERROR HY000: Incorrect prefix key; the used key part isn't a string, the used length is longer than the key part, or the storage engine doesn't support unique prefix keys diff --git a/mysql-test/main/vector2.test b/mysql-test/main/vector2.test index 0f730086b9e..23ecea340f8 100644 --- a/mysql-test/main/vector2.test +++ b/mysql-test/main/vector2.test @@ -174,3 +174,9 @@ create table t (v vector(2) not null); insert ignore into t values (1); select hex(v) from t; drop table t; + +--echo # +--echo # MDEV-35176 ASAN errors in Field_vector::store with optimizer_trace enabled +--echo # +--error ER_WRONG_SUB_KEY +create table t (pk int primary key, v vector(2) not null, key(v(6))); diff --git a/sql/sql_type_vector.h b/sql/sql_type_vector.h index 52a934f77b5..0cd79c9f53e 100644 --- a/sql/sql_type_vector.h +++ b/sql/sql_type_vector.h @@ -26,6 +26,7 @@ public: const Type_handler *type_handler_for_comparison() const override; virtual Item *create_typecast_item(THD *thd, Item *item, const Type_cast_attributes &attr) const override; + bool type_can_have_key_part() const override { return false; } bool subquery_type_allows_materialization(const Item *, const Item *, bool) const override {