mirror of
https://github.com/MariaDB/server.git
synced 2025-04-18 21:44:20 +03:00
MDEV-35146 Vector-related error messages worth improving when possible
use THD::push_warning_truncated_value_for_field() to push the truncated warning consistently with other data types
This commit is contained in:
parent
a37eb6d013
commit
e240da3b19
@ -122,11 +122,11 @@ insert t1 (v) values (x'e360d63ebe554f3fcdbc523f4522193f5236083d'),
|
||||
select id,vec_distance_euclidean(v, x'b047263c9f87233Fcfd27e3eae493e3f0329f43e') d from t1 order by d limit 5;
|
||||
|
||||
|
||||
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
|
||||
--error ER_TRUNCATED_WRONG_VALUE
|
||||
insert t1 (v) values ('');
|
||||
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
|
||||
--error ER_TRUNCATED_WRONG_VALUE
|
||||
insert t1 (v) values (x'1234');
|
||||
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
|
||||
--error ER_TRUNCATED_WRONG_VALUE
|
||||
insert t1 (v) values (x'12345678');
|
||||
|
||||
drop table t1;
|
||||
|
@ -231,7 +231,7 @@ 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
|
||||
Warning 1292 Incorrect vector value: '1' for column `test`.`t`.`v` at row 1
|
||||
select hex(v) from t;
|
||||
hex(v)
|
||||
0000000000000000
|
||||
@ -408,4 +408,19 @@ t CREATE TABLE `t` (
|
||||
KEY `v` (`v`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
|
||||
drop table t;
|
||||
#
|
||||
# MDEV-35146 Vector-related error messages worth improving when possible
|
||||
#
|
||||
create table t (a vector(64) not null default '');
|
||||
ERROR 42000: Invalid default value for 'a'
|
||||
show warnings;
|
||||
Level Code Message
|
||||
Warning 1292 Incorrect vector value: '' for column ``.``.`a` at row 0
|
||||
Error 1067 Invalid default value for 'a'
|
||||
create table t (a inet6 not null default '');
|
||||
ERROR 42000: Invalid default value for 'a'
|
||||
show warnings;
|
||||
Level Code Message
|
||||
Warning 1292 Incorrect inet6 value: '' for column ``.``.`a` at row 0
|
||||
Error 1067 Invalid default value for 'a'
|
||||
# End of 11.7 tests
|
||||
|
@ -22,9 +22,9 @@ insert t1 values (1, 1.1);
|
||||
insert t1 values (1, 1e1);
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
|
||||
insert t1 values (1, now());
|
||||
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
|
||||
--error ER_TRUNCATED_WRONG_VALUE
|
||||
insert t1 values (1, repeat(x'56', 10));
|
||||
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
|
||||
--error ER_TRUNCATED_WRONG_VALUE
|
||||
insert t1 values (1, repeat(x'66', 40));
|
||||
insert t1 values (1, repeat(x'56', 40));
|
||||
select * from t1;
|
||||
@ -155,7 +155,7 @@ drop table t1;
|
||||
--echo #
|
||||
create table t1 (a blob);
|
||||
insert t1 values (1);
|
||||
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
|
||||
--error ER_TRUNCATED_WRONG_VALUE
|
||||
alter table t1 modify a vector(2);
|
||||
update t1 set a=x'5555555555555555';
|
||||
alter table t1 modify a vector(2);
|
||||
@ -298,4 +298,15 @@ create table t (v vector(8), key(v));
|
||||
show create table t;
|
||||
drop table t;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-35146 Vector-related error messages worth improving when possible
|
||||
--echo #
|
||||
--error ER_INVALID_DEFAULT
|
||||
create table t (a vector(64) not null default '');
|
||||
show warnings;
|
||||
--error ER_INVALID_DEFAULT
|
||||
create table t (a inet6 not null default '');
|
||||
show warnings;
|
||||
|
||||
--echo # End of 11.7 tests
|
||||
|
@ -276,13 +276,9 @@ Field::Copy_func *Field_vector::get_copy_func(const Field *from) const
|
||||
|
||||
int Field_vector::report_wrong_value(const ErrConv &val)
|
||||
{
|
||||
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());
|
||||
get_thd()->push_warning_truncated_value_for_field(
|
||||
Sql_condition::WARN_LEVEL_WARN, "vector", val.ptr(),
|
||||
table->s->db.str, table->s->table_name.str, field_name.str);
|
||||
reset();
|
||||
return 1;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user