Commit dde0ba5a authored by Sachin Setiya's avatar Sachin Setiya

MDEV-15754 Server crashes in fill_record_n_invoke_before_triggers upon ...

insert into table with TIMESTAMP INVISIBLE

Problem:- The segfault occurs because value is null but since timestamp field
is VISIBLE it expects a value , and it tries to call value->save_in_field(..
Timestamp field should not be visible this is the problem.

Solution:- While we clone field for record0_field we don't honor the field
_visibility , this patch changes that.
parent fa68b88b
......@@ -551,3 +551,8 @@ select * from t1 natural join t2;
b c a d
2 3 1 4
drop table t1, t2;
CREATE TABLE t1 (c CHAR(3), t TIMESTAMP invisible);
INSERT INTO t1 (c,t) VALUES ('foo','2000-01-01 00:00:00');
CREATE TRIGGER tr BEFORE INSERT ON t1 FOR EACH ROW SET @a= 1;
INSERT INTO t1 SELECT * FROM t1;
DROP TABLE t1;
......@@ -238,3 +238,11 @@ insert t2 (a,b,d) values (1,2,4), (10, 30, 40);
select * from t1 join t2 using (a);
select * from t1 natural join t2;
drop table t1, t2;
## Triggers MDEV-15754
CREATE TABLE t1 (c CHAR(3), t TIMESTAMP invisible);
INSERT INTO t1 (c,t) VALUES ('foo','2000-01-01 00:00:00');
CREATE TRIGGER tr BEFORE INSERT ON t1 FOR EACH ROW SET @a= 1;
INSERT INTO t1 SELECT * FROM t1;
# Cleanup
DROP TABLE t1;
......@@ -1240,6 +1240,7 @@ bool Table_triggers_list::prepare_record_accessors(TABLE *table)
return 1;
f->flags= (*fld)->flags;
f->invisible= (*fld)->invisible;
f->null_ptr= null_ptr;
f->null_bit= null_bit;
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