29
29
CREATE TABLE t2 (id INTEGER PRIMARY KEY);
30
30
CREATE TABLE t3 (a CHAR(32) PRIMARY KEY,id INTEGER);
31
31
eval CREATE TABLE t4 (a CHAR(32) PRIMARY KEY,id INTEGER) ENGINE=$other_engine_type;
33
33
INSERT INTO t1 (id) VALUES (1);
34
34
INSERT INTO t1 SELECT id+1 FROM t1;
35
35
INSERT INTO t1 SELECT id+2 FROM t1;
61
61
DROP TABLE t1,t2,t3,t4;
64
# Bug#24989: The DEADLOCK error is improperly handled by InnoDB.
66
CREATE TABLE t1 (f1 int NOT NULL) ENGINE=InnoDB;
67
CREATE TABLE t2 (f2 int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
69
CREATE TRIGGER t1_bi before INSERT
72
DECLARE CONTINUE HANDLER FOR SQLSTATE '40001' SET @a:= 'deadlock';
73
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET @a:= 'exception';
74
INSERT INTO t2 (f2) VALUES (1);
75
DELETE FROM t2 WHERE f2 = 1;
78
CREATE PROCEDURE proc24989()
80
DECLARE CONTINUE HANDLER FOR SQLSTATE '40001' SET @b:= 'deadlock';
81
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET @a:= 'exception';
82
INSERT INTO t2 (f2) VALUES (1);
83
DELETE FROM t2 WHERE f2 = 1;
86
create procedure proc24989_2()
89
declare continue handler for sqlexception
90
select 'Outer handler' as 'exception';
92
insert into t1 values(1);
98
connect (con1,localhost,root,,);
99
connect (con2,localhost,root,,);
103
insert into t1 values(1);
107
insert into t2 values(123);
108
send insert into t1 values(1);
112
insert into t1 values(1);
118
# check that the whole transaction was rolled back
124
insert into t1 values(1);
128
insert into t2 values(123);
129
send call proc24989();
133
insert into t1 values(1);
138
# check that the whole transaction was rolled back
144
insert into t1 values(1);
148
insert into t2 values(123);
149
send call proc24989_2();
153
insert into t1 values(1);
158
# check that the whole transaction was rolled back
164
drop procedure proc24989;
165
drop procedure proc24989_2;