mirror of
https://github.com/MariaDB/server.git
synced 2025-01-15 19:42:28 +01:00
MDEV-35178 Assertion failure in Field_vector::store upon INSERT IGNORE with a wrong data
This commit is contained in:
parent
88adcbf35a
commit
425aa95655
4 changed files with 31 additions and 9 deletions
|
@ -217,3 +217,15 @@ create table t1 (a int, v vector(1) not null, vector(v));
|
|||
insert t1 values (1, 0x00000000);
|
||||
alter table t1 modify v vector(64) not null;
|
||||
drop table t1;
|
||||
#
|
||||
# MDEV-35178 Assertion failure in Field_vector::store upon INSERT IGNORE with a wrong data
|
||||
#
|
||||
create table t (v vector(2) not null);
|
||||
insert ignore into t values (1);
|
||||
Warnings:
|
||||
Warning 4078 Cannot cast 'int' as 'vector' in assignment of `test`.`t`.`v`
|
||||
Warning 1366 Incorrect vector value: '1' for column `test`.`t`.`v` at row 1
|
||||
select hex(v) from t;
|
||||
hex(v)
|
||||
0000000000000000
|
||||
drop table t;
|
||||
|
|
|
@ -166,3 +166,11 @@ create table t1 (a int, v vector(1) not null, vector(v));
|
|||
insert t1 values (1, 0x00000000);
|
||||
alter table t1 modify v vector(64) not null;
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-35178 Assertion failure in Field_vector::store upon INSERT IGNORE with a wrong data
|
||||
--echo #
|
||||
create table t (v vector(2) not null);
|
||||
insert ignore into t values (1);
|
||||
select hex(v) from t;
|
||||
drop table t;
|
||||
|
|
|
@ -273,29 +273,31 @@ Field::Copy_func *Field_vector::get_copy_func(const Field *from) const
|
|||
return do_copy_vec;
|
||||
}
|
||||
|
||||
int Field_vector::report_wrong_value(const ErrConv &val) const
|
||||
int Field_vector::report_wrong_value(const ErrConv &val)
|
||||
{
|
||||
my_error(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD, MYF(0), "vector",
|
||||
val.ptr(), table->s->db.str, table->s->table_name.str,
|
||||
field_name.str, table->in_use->get_stmt_da()->current_row_for_warning());
|
||||
return -1;
|
||||
THD *thd= table->in_use;
|
||||
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
|
||||
ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
|
||||
ER_THD(thd, ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
|
||||
"vector", val.ptr(), table->s->db.str,
|
||||
table->s->table_name.str, field_name.str,
|
||||
thd->get_stmt_da()->current_row_for_warning());
|
||||
reset();
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Field_vector::store(double nr)
|
||||
{
|
||||
DBUG_ASSERT(0);
|
||||
return report_wrong_value(ErrConvDouble(nr));
|
||||
}
|
||||
|
||||
int Field_vector::store(longlong nr, bool unsigned_val)
|
||||
{
|
||||
DBUG_ASSERT(0);
|
||||
return report_wrong_value(ErrConvInteger(Longlong_hybrid(nr, unsigned_val)));
|
||||
}
|
||||
|
||||
int Field_vector::store_decimal(const my_decimal *nr)
|
||||
{
|
||||
DBUG_ASSERT(0);
|
||||
return report_wrong_value(ErrConvDecimal(nr));
|
||||
}
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ public:
|
|||
|
||||
class Field_vector:public Field_varstring
|
||||
{
|
||||
int report_wrong_value(const ErrConv &val) const;
|
||||
int report_wrong_value(const ErrConv &val);
|
||||
public:
|
||||
Field_vector(uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg,
|
||||
enum utype unireg_check_arg, const LEX_CSTRING *field_name_arg,
|
||||
|
|
Loading…
Reference in a new issue