create table t1 (id int primary key, copy int)engine=tianmu;
create table t2 (id int primary key, data int)engine=tianmu;
insert into t2 values (1,1), (2,2);
create trigger t1_bi before insert on t1 for each row
set new.copy= (select data from t2 where id = new.id);
create trigger t1_bu before update on t1 for each row
set new.copy= (select data from t2 where id = new.id);
insert into t1 values (1,3), (2,4), (3,3);
update t1 set copy= 1 where id = 2;
select * from t1;
### Incorrect test results ###
+----+------+
| id | copy |
+----+------+
| 1 | NULL |
| 2 | NULL |
| 3 | NULL |
+----+------+
drop table t1, t2;
#Correct test results(note:Innodb test verification, test results are as follows)
select * from t1;
+----+------+
| id | copy |
+----+------+
| 1 | 1 |
| 2 | 2 |
| 3 | NULL |
+----+------+
Follow the test steps above
./mysqld Ver 5.7.36_v1.0.1_beta-StoneDB for Linux on x86_64 (build-)
build information as follow:
Repository address: https://github.com/stoneatom/stonedb.git:stonedb-5.7-dev
Branch name: stonedb-5.7-dev
Last commit ID: 208f79d
Last commit time: Date: Sat Sep 17 16:19:42 2022 +0800
Build time: Date: Sat Sep 17 17:59:04 CST 2022