MDEV-37025 Incorrect error/docs for Vector column lengths (max = 65532

This commit is contained in:
Sergei Golubchik 2025-06-26 21:28:01 +02:00
parent faec725599
commit eff01f4f07
3 changed files with 17 additions and 0 deletions

View File

@ -484,4 +484,9 @@ t1 CREATE TABLE `t1` (
VECTOR KEY `v` (`v`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
drop table t1;
#
# MDEV-37025 Incorrect error/docs for Vector column lengths (max = 65532)
#
create table t1(v vector (16384) not null,vector (v));
ERROR 42000: Column length too big for column 'v' (max = 16383); use BLOB or TEXT instead
# End of 11.8 tests

View File

@ -355,4 +355,10 @@ alter table t1 add x int references t1(x),add y int constraint c references t1(y
show create table t1;
drop table t1;
--echo #
--echo # MDEV-37025 Incorrect error/docs for Vector column lengths (max = 65532)
--echo #
--error ER_TOO_BIG_FIELDLENGTH
create table t1(v vector (16384) not null,vector (v));
--echo # End of 11.8 tests

View File

@ -78,6 +78,12 @@ bool Type_handler_vector::Column_definition_fix_attributes(
my_error(ER_WRONG_FIELD_SPEC, MYF(0), def->field_name.str);
return true;
}
if (def->length > MAX_FIELD_VARCHARLENGTH/sizeof(float))
{
my_error(ER_TOO_BIG_FIELDLENGTH, MYF(0), def->field_name.str,
static_cast<ulong>(MAX_FIELD_VARCHARLENGTH / sizeof(float)));
return true;
}
def->length*= sizeof(float);
return false;
}