MDEV-36026 Problem with INSERT SELECT on NOT NULL columns while having BEFORE UPDATE trigger
MDEV-8605 and MDEV-19761 didn't handle INSERT (columns) SELECT followup for a69da0c31e9
This commit is contained in:
parent
fbb6b50499
commit
cd7513995d
@ -399,4 +399,19 @@ Warnings:
|
|||||||
Warning 1364 Field 'c5' doesn't have a default value
|
Warning 1364 Field 'c5' doesn't have a default value
|
||||||
drop table t1;
|
drop table t1;
|
||||||
set sql_mode=default;
|
set sql_mode=default;
|
||||||
|
#
|
||||||
|
# MDEV-36026 Problem with INSERT SELECT on NOT NULL columns while having BEFORE UPDATE trigger
|
||||||
|
#
|
||||||
|
create table t1 (b int(11) not null);
|
||||||
|
create trigger t1bu before update on t1 for each row begin end;
|
||||||
|
insert t1 (b) select 1 union select 2;
|
||||||
|
create trigger trgi before insert on t1 for each row set new.b=ifnull(new.b,10);
|
||||||
|
insert t1 (b) select NULL union select 11;
|
||||||
|
select * from t1;
|
||||||
|
b
|
||||||
|
1
|
||||||
|
2
|
||||||
|
10
|
||||||
|
11
|
||||||
|
drop table t1;
|
||||||
# End of 10.5 tests
|
# End of 10.5 tests
|
||||||
|
@ -425,4 +425,15 @@ insert into t1 (c) values (1);
|
|||||||
drop table t1;
|
drop table t1;
|
||||||
set sql_mode=default;
|
set sql_mode=default;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-36026 Problem with INSERT SELECT on NOT NULL columns while having BEFORE UPDATE trigger
|
||||||
|
--echo #
|
||||||
|
create table t1 (b int(11) not null);
|
||||||
|
create trigger t1bu before update on t1 for each row begin end;
|
||||||
|
insert t1 (b) select 1 union select 2;
|
||||||
|
create trigger trgi before insert on t1 for each row set new.b=ifnull(new.b,10);
|
||||||
|
insert t1 (b) select NULL union select 11;
|
||||||
|
select * from t1;
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
--echo # End of 10.5 tests
|
--echo # End of 10.5 tests
|
||||||
|
@ -4126,6 +4126,7 @@ select_insert::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
|
|||||||
int select_insert::prepare2(JOIN *)
|
int select_insert::prepare2(JOIN *)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("select_insert::prepare2");
|
DBUG_ENTER("select_insert::prepare2");
|
||||||
|
switch_to_nullable_trigger_fields(*fields, table);
|
||||||
if (table->validate_default_values_of_unset_fields(thd))
|
if (table->validate_default_values_of_unset_fields(thd))
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
if (thd->lex->describe)
|
if (thd->lex->describe)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user