Commit 4bacde8c authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-35006 Using varbinary as vector-storing column results in assertion failures

* hlindexes cannot be extended with pk
* hlindexes cannot be covering
parent c3bcedce
......@@ -94,3 +94,12 @@ select vec_distance_euclidean(v, x'B047263C9F87233fcfd27e3eae493e3f0329f43e') as
e
insert into t values (x'B047263C9F87233fcfd27e3eae493e3f0329f43e');
drop table t;
#
# MDEV-35006 Using varbinary as vector-storing column results in assertion failures
#
create table t (pk int primary key, v varbinary(1024) not null, vector key(v)) engine=InnoDB;
insert into t values (1, x'B047263C9F87233fcfd27e3eae493e3f0329f43e');
select pk,hex(v) from t;
pk hex(v)
1 B047263C9F87233FCFD27E3EAE493E3F0329F43E
drop table t;
......@@ -79,3 +79,11 @@ create table t (v blob not null, vector key(v)) engine=InnoDB;
select vec_distance_euclidean(v, x'B047263C9F87233fcfd27e3eae493e3f0329f43e') as e from t order by e limit 1;
insert into t values (x'B047263C9F87233fcfd27e3eae493e3f0329f43e');
drop table t;
--echo #
--echo # MDEV-35006 Using varbinary as vector-storing column results in assertion failures
--echo #
create table t (pk int primary key, v varbinary(1024) not null, vector key(v)) engine=InnoDB;
insert into t values (1, x'B047263C9F87233fcfd27e3eae493e3f0329f43e');
select pk,hex(v) from t;
drop table t;
......@@ -3136,8 +3136,8 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
}
key_part= keyinfo->key_part;
uint key_parts= share->use_ext_keys ? keyinfo->ext_key_parts :
keyinfo->user_defined_key_parts;
uint key_parts= share->use_ext_keys && key < share->keys
? keyinfo->ext_key_parts : keyinfo->user_defined_key_parts;
if (keyinfo->algorithm == HA_KEY_ALG_LONG_HASH)
key_parts++;
if (keyinfo->algorithm == HA_KEY_ALG_UNDEF) // old .frm
......@@ -3191,7 +3191,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
if (i == 0)
field->key_start.set_bit(key);
if (field->key_length() == key_part->length &&
!(field->flags & BLOB_FLAG) &&
!(field->flags & BLOB_FLAG) && key < share->keys &&
keyinfo->algorithm != HA_KEY_ALG_LONG_HASH)
{
if (handler_file->index_flags(key, i, 0) & HA_KEYREAD_ONLY)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment