Description:
The following script fails with the wrong error :
let $engine_type = ndbcluster;
set autocommit=1;
--disable_warnings
drop table if exists t1;
drop table if exists t2;
drop table if exists t3;
drop function if exists f2;
drop procedure if exists p1;
--enable_warnings
eval create table t1 (a int) engine = $engine_type;
eval create table t2 (a int unique) engine = $engine_type;
eval create table t3 (a int) engine = $engine_type;
insert into t1 (a) values (1), (2);
insert into t3 (a) values (1), (2);
delimiter //;
## Cause a failure every time
create function f2(x int) returns int
begin
insert into t2 (a) values (x);
insert into t2 (a) values (x);
return x;
end//
delimiter ;//
set autocommit=0;
insert into t2 (a) values (1001);
--error ER_DUP_ENTRY
insert into t1 (a) values (f2(1));
select * from t2;
rollback;
select * from t2;
commit;
---------
The select after the failed insert statement causes :
mysqltest: At line 54: query 'select * from t2' failed: 1296: Got error 4350 'Transaction already aborted' from ndbcluster
The expected result is :
- a select that returns no rows, since a *statement* rollback should occur
on the insert
- a proper *transaction* rollback on the rollback statement.
Note that the same test with BDB or InnoDB works as expected.
How to repeat:
See above
Suggested fix:
N/A