Commit 23903255 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-9629 Disappearing PRI from Key column after creating a trigger

when creating shadow nullable fields, preserve all
original field flags (because we swap flags
back and forth in not_null_fields_have_null_values())
parent b24a04c6
...@@ -341,3 +341,17 @@ create trigger tr1 before update on t1 for each row do 1; ...@@ -341,3 +341,17 @@ create trigger tr1 before update on t1 for each row do 1;
create trigger tr2 after update on t2 for each row update t1 set a=new.f2; create trigger tr2 after update on t2 for each row update t1 set a=new.f2;
update t2 set f2=1 where f1=1; update t2 set f2=1 where f1=1;
drop table t1, t2; drop table t1, t2;
create table t1 (a int not null, primary key (a));
insert into t1 (a) values (1);
show columns from t1;
Field Type Null Key Default Extra
a int(11) NO PRI NULL
create trigger t1bu before update on t1 for each row begin end;
show columns from t1;
Field Type Null Key Default Extra
a int(11) NO PRI NULL
insert into t1 (a) values (3);
show columns from t1;
Field Type Null Key Default Extra
a int(11) NO PRI NULL
drop table t1;
...@@ -360,3 +360,15 @@ create trigger tr1 before update on t1 for each row do 1; ...@@ -360,3 +360,15 @@ create trigger tr1 before update on t1 for each row do 1;
create trigger tr2 after update on t2 for each row update t1 set a=new.f2; create trigger tr2 after update on t2 for each row update t1 set a=new.f2;
update t2 set f2=1 where f1=1; update t2 set f2=1 where f1=1;
drop table t1, t2; drop table t1, t2;
#
# MDEV-9629 Disappearing PRI from Key column after creating a trigger
#
create table t1 (a int not null, primary key (a));
insert into t1 (a) values (1);
show columns from t1;
create trigger t1bu before update on t1 for each row begin end;
show columns from t1;
insert into t1 (a) values (3);
show columns from t1;
drop table t1;
...@@ -1101,6 +1101,7 @@ bool Table_triggers_list::prepare_record_accessors(TABLE *table) ...@@ -1101,6 +1101,7 @@ bool Table_triggers_list::prepare_record_accessors(TABLE *table)
table == (*fld)->table))) table == (*fld)->table)))
return 1; return 1;
f->flags= (*fld)->flags;
f->null_ptr= null_ptr; f->null_ptr= null_ptr;
f->null_bit= null_bit; f->null_bit= null_bit;
if (null_bit == 128) if (null_bit == 128)
......
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