mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-30342 Wrong "Truncated incorrect DECIMAL value" warning/error
regression from MDEV-29540 / 8c38939369
.
INSERT SELECT errors needed to be unconditionally ignored.
As this touches the CREATE .. SELECT functionality, show
the equalivent test there.
This commit is contained in:
@ -2121,5 +2121,16 @@ Warnings:
|
||||
Warning 1280 Name 'foo' ignored for PRIMARY key.
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# MDEV-30342 Wrong "Truncated incorrect DECIMAL value" warning/error
|
||||
#
|
||||
create table t1(c1 varchar(1));
|
||||
insert into t1(c1) values('#');
|
||||
select @@sql_mode like '%strict_all_tables%';
|
||||
@@sql_mode like '%strict_all_tables%'
|
||||
0
|
||||
create table t2 as select if(c1 = '#', c1 = 0, c1) as c1 from t1;
|
||||
ERROR 22007: Truncated incorrect DECIMAL value: '#'
|
||||
drop table t1;
|
||||
#
|
||||
# End of 10.3 tests
|
||||
#
|
||||
|
@ -1978,6 +1978,19 @@ create table t1 (c int(10) unsigned) engine=memory transactional=0;
|
||||
CREATE TABLE t1 ( id1 INT, id2 INT, CONSTRAINT `foo` PRIMARY KEY (id1), CONSTRAINT `bar` UNIQUE KEY(id2));
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-30342 Wrong "Truncated incorrect DECIMAL value" warning/error
|
||||
--echo #
|
||||
|
||||
create table t1(c1 varchar(1));
|
||||
insert into t1(c1) values('#');
|
||||
|
||||
select @@sql_mode like '%strict_all_tables%';
|
||||
--error ER_TRUNCATED_WRONG_VALUE
|
||||
create table t2 as select if(c1 = '#', c1 = 0, c1) as c1 from t1;
|
||||
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.3 tests
|
||||
--echo #
|
||||
|
@ -1042,4 +1042,17 @@ select * from t1;
|
||||
a
|
||||
deallocate prepare stmt;
|
||||
drop table t1,t2,t3;
|
||||
#
|
||||
# MDEV-30342 Wrong "Truncated incorrect DECIMAL value" warning/error
|
||||
#
|
||||
create table t1(c1 varchar(1));
|
||||
create table t2(c1 varchar(1));
|
||||
insert into t1(c1) values('#');
|
||||
select @@sql_mode like '%strict_all_tables%';
|
||||
@@sql_mode like '%strict_all_tables%'
|
||||
0
|
||||
insert into t2(c1) select if(c1 = '#', c1 = 0, c1) as c1 from t1;
|
||||
drop table t1, t2;
|
||||
#
|
||||
# End of 10.3 test
|
||||
#
|
||||
|
@ -595,4 +595,21 @@ deallocate prepare stmt;
|
||||
|
||||
drop table t1,t2,t3;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-30342 Wrong "Truncated incorrect DECIMAL value" warning/error
|
||||
--echo #
|
||||
|
||||
create table t1(c1 varchar(1));
|
||||
create table t2(c1 varchar(1));
|
||||
|
||||
insert into t1(c1) values('#');
|
||||
|
||||
select @@sql_mode like '%strict_all_tables%';
|
||||
insert into t2(c1) select if(c1 = '#', c1 = 0, c1) as c1 from t1;
|
||||
|
||||
drop table t1, t2;
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.3 test
|
||||
--echo #
|
||||
|
@ -5455,7 +5455,7 @@ class select_insert :public select_result_interceptor {
|
||||
int prepare(List<Item> &list, SELECT_LEX_UNIT *u);
|
||||
virtual int prepare2(JOIN *join);
|
||||
virtual int send_data(List<Item> &items);
|
||||
virtual bool store_values(List<Item> &values, bool ignore_errors);
|
||||
virtual bool store_values(List<Item> &values);
|
||||
virtual bool can_rollback_data() { return 0; }
|
||||
bool prepare_eof();
|
||||
bool send_ok_packet();
|
||||
@ -5497,7 +5497,7 @@ public:
|
||||
int prepare(List<Item> &list, SELECT_LEX_UNIT *u);
|
||||
|
||||
int binlog_show_create_table(TABLE **tables, uint count);
|
||||
bool store_values(List<Item> &values, bool ignore_errors);
|
||||
bool store_values(List<Item> &values);
|
||||
bool send_eof();
|
||||
virtual void abort_result_set();
|
||||
virtual bool can_rollback_data() { return 1; }
|
||||
|
@ -3928,7 +3928,7 @@ int select_insert::send_data(List<Item> &values)
|
||||
DBUG_RETURN(0);
|
||||
|
||||
thd->count_cuted_fields= CHECK_FIELD_WARN; // Calculate cuted fields
|
||||
if (store_values(values, info.ignore))
|
||||
if (store_values(values))
|
||||
DBUG_RETURN(1);
|
||||
thd->count_cuted_fields= CHECK_FIELD_ERROR_FOR_NULL;
|
||||
if (unlikely(thd->is_error()))
|
||||
@ -3986,17 +3986,17 @@ int select_insert::send_data(List<Item> &values)
|
||||
}
|
||||
|
||||
|
||||
bool select_insert::store_values(List<Item> &values, bool ignore_errors)
|
||||
bool select_insert::store_values(List<Item> &values)
|
||||
{
|
||||
DBUG_ENTER("select_insert::store_values");
|
||||
bool error;
|
||||
|
||||
if (fields->elements)
|
||||
error= fill_record_n_invoke_before_triggers(thd, table, *fields, values,
|
||||
ignore_errors, TRG_EVENT_INSERT);
|
||||
true, TRG_EVENT_INSERT);
|
||||
else
|
||||
error= fill_record_n_invoke_before_triggers(thd, table, table->field_to_fill(),
|
||||
values, ignore_errors, TRG_EVENT_INSERT);
|
||||
values, true, TRG_EVENT_INSERT);
|
||||
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
@ -4669,10 +4669,10 @@ select_create::binlog_show_create_table(TABLE **tables, uint count)
|
||||
return result;
|
||||
}
|
||||
|
||||
bool select_create::store_values(List<Item> &values, bool ignore_errors)
|
||||
bool select_create::store_values(List<Item> &values)
|
||||
{
|
||||
return fill_record_n_invoke_before_triggers(thd, table, field, values,
|
||||
ignore_errors, TRG_EVENT_INSERT);
|
||||
true, TRG_EVENT_INSERT);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user