summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/main/invisible_field.result5
-rw-r--r--mysql-test/main/invisible_field.test8
-rw-r--r--sql/sql_trigger.cc1
3 files changed, 14 insertions, 0 deletions
diff --git a/mysql-test/main/invisible_field.result b/mysql-test/main/invisible_field.result
index c331f3fca88..5cea77f5b0c 100644
--- a/mysql-test/main/invisible_field.result
+++ b/mysql-test/main/invisible_field.result
@@ -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;
diff --git a/mysql-test/main/invisible_field.test b/mysql-test/main/invisible_field.test
index 884abb1238d..cfe89d77230 100644
--- a/mysql-test/main/invisible_field.test
+++ b/mysql-test/main/invisible_field.test
@@ -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;
diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc
index 4c1e2a51fbf..d523779cda7 100644
--- a/sql/sql_trigger.cc
+++ b/sql/sql_trigger.cc
@@ -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)