Commit 6ce20fb2 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-9428 NO_AUTO_VALUE_ON_ZERO is ignored when a trigger before insert is defined

fix the *other* fill_record() too, arrgh!
parent 9c38308d
...@@ -318,9 +318,8 @@ id ...@@ -318,9 +318,8 @@ id
delete from t1; delete from t1;
create trigger t1_bi before insert on t1 for each row begin end; create trigger t1_bi before insert on t1 for each row begin end;
insert t1 values (0); insert t1 values (0);
select * from t1; insert t1 (id) values (0);
id ERROR 23000: Duplicate entry '0' for key 'PRIMARY'
0
drop table t1; drop table t1;
create table t1 (a int not null, b int); create table t1 (a int not null, b int);
create trigger trgi before update on t1 for each row do 1; create trigger trgi before update on t1 for each row do 1;
......
...@@ -336,7 +336,8 @@ select * from t1; ...@@ -336,7 +336,8 @@ select * from t1;
delete from t1; delete from t1;
create trigger t1_bi before insert on t1 for each row begin end; create trigger t1_bi before insert on t1 for each row begin end;
insert t1 values (0); insert t1 values (0);
select * from t1; --error ER_DUP_ENTRY
insert t1 (id) values (0);
drop table t1; drop table t1;
# #
......
...@@ -8728,7 +8728,8 @@ fill_record(THD *thd, TABLE *table_arg, List<Item> &fields, List<Item> &values, ...@@ -8728,7 +8728,8 @@ fill_record(THD *thd, TABLE *table_arg, List<Item> &fields, List<Item> &values,
value=v++; value=v++;
Field *rfield= field->field; Field *rfield= field->field;
TABLE* table= rfield->table; TABLE* table= rfield->table;
if (rfield == table->next_number_field) if (table->next_number_field &&
rfield->field_index == table->next_number_field->field_index)
table->auto_increment_field_not_null= TRUE; table->auto_increment_field_not_null= TRUE;
if (rfield->vcol_info && if (rfield->vcol_info &&
value->type() != Item::DEFAULT_VALUE_ITEM && value->type() != Item::DEFAULT_VALUE_ITEM &&
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment