MDEV-35769 ER_SQL_DISCOVER_ERROR upon updating vector key column using incorrect value

return as soon as the error status is known.

also, init_from_sql_statement_string() cannot be run if thd->is_error(),
assert it.
This commit is contained in:
Sergei Golubchik 2025-01-04 17:27:55 +01:00
parent cca243bf02
commit 0eaefafbaf
4 changed files with 22 additions and 2 deletions

View file

@ -386,4 +386,13 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t index NULL b 6 NULL 1
drop view v;
drop table t;
#
# MDEV-35769 ER_SQL_DISCOVER_ERROR upon updating vector key column using incorrect value
#
create table t (v vector(1) not null, vector(v));
insert into t values (0x31313131);
flush tables;
update t set v = 1;
ERROR HY000: Cannot cast 'int' as 'vector' in assignment of `test`.`t`.`v`
drop table t;
# End of 11.7 tests

View file

@ -279,4 +279,14 @@ explain select * from (select * from t) sq order by vec_distance_euclidean(b,0x3
drop view v;
drop table t;
--echo #
--echo # MDEV-35769 ER_SQL_DISCOVER_ERROR upon updating vector key column using incorrect value
--echo #
create table t (v vector(1) not null, vector(v));
insert into t values (0x31313131);
flush tables;
--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
update t set v = 1;
drop table t;
--echo # End of 11.7 tests

View file

@ -1877,6 +1877,8 @@ int multi_update::prepare(List<Item> &not_used_values,
*values, MARK_COLUMNS_READ, 0, NULL, 0) ||
TABLE::check_assignability_explicit_fields(*fields, *values,
ignore);
if (unlikely(error))
DBUG_RETURN(1);
ti.rewind();
while ((table_ref= ti++))
@ -1893,8 +1895,6 @@ int multi_update::prepare(List<Item> &not_used_values,
table->file->prepare_for_modify(true, true);
}
}
if (unlikely(error))
DBUG_RETURN(1);
/*
Save tables being updated in update_tables

View file

@ -3647,6 +3647,7 @@ int TABLE_SHARE::init_from_sql_statement_string(THD *thd, bool write,
LEX_CUSTRING frm= {0,0};
LEX_CSTRING db_backup= thd->db;
DBUG_ENTER("TABLE_SHARE::init_from_sql_statement_string");
DBUG_ASSERT(!thd->is_error());
/*
Ouch. Parser may *change* the string it's working on.