Hello mysql,
When trigger on table uses select from same table, then bulk insert into
this table cause error.
How to repeat:
create table t(i int not null, j int not null, n numeric(15,2), primary key(i,j));
create table s(i int not null, n numeric(15,2), primary key(i));
delimiter //
create trigger t_ai after insert on t for each row begin
declare sn numeric(15,2);
select sum(n) into sn from t where i=new.i;
replace into s values(new.i, sn);
end//
delimiter ;//
insert into t values
(1,1,10.00),(1,2,10.00),(1,3,10.00),(1,4,10.00),(1,5,10.00),
(1,6,10.00),(1,7,10.00),(1,8,10.00),(1,9,10.00),(1,10,10.00),
(1,11,10.00),(1,12,10.00),(1,13,10.00),(1,14,10.00),(1,15,10.00);
> ERROR 1030 (HY000) at line 12: Got error 124 from storage engine
1. Without "select sum(n) into sn from t" all OK.
2. insert into t values
(1,1,10.00),(1,2,10.00),(1,3,10.00),(1,4,10.00),(1,5,10.00);
- all OK.
Is this a bug?
--
Best regards,
Juri mailto:juri@stripped