summaryrefslogtreecommitdiff
path: root/mysql-test/suite/innodb/r/foreign_key_debug.result
blob: 10a7e6f36e924ecabb3dad1fd2497454a2c5a874 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
create table t1 (f1 int primary key) engine=innodb;
create table t2 (f2 int primary key) engine=innodb;
create table t3 (f3 int primary key, foreign key (f3) references t2(f2)) engine=innodb;
insert into t1 values (1),(2),(3),(4),(5);
insert into t2 values (1),(2),(3),(4),(5);
insert into t3 values (1),(2),(3),(4),(5);
connect con1,localhost,root;
set debug_sync='alter_table_before_rename_result_table signal g1 wait_for g2';
alter table t2 add constraint foreign key (f2) references t1(f1) on delete cascade on update cascade;
connection default;
set debug_sync='before_execute_sql_command wait_for g1';
update t1 set f1 = f1 + 100000 limit 2;
connect con2,localhost,root;
kill query UPDATE;
disconnect con2;
connection default;
ERROR 70100: Query execution was interrupted
set debug_sync='now signal g2';
connection con1;
show create table t2;
Table	Create Table
t2	CREATE TABLE `t2` (
  `f2` int(11) NOT NULL,
  PRIMARY KEY (`f2`),
  CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f2`) REFERENCES `t1` (`f1`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1
disconnect con1;
connection default;
select * from t2 where f2 not in (select f1 from t1);
f2
select * from t3 where f3 not in (select f2 from t2);
f3
drop table t3;
drop table t2;
drop table t1;
set debug_sync='reset';
#
# MDEV-16060 - InnoDB: Failing assertion: ut_strcmp(index->name, key->name)
#
CREATE TABLE t1 (`pk` INT PRIMARY KEY) ENGINE=InnoDB;
CREATE TABLE t2 LIKE t1;
FLUSH TABLES;
SET debug_sync='alter_table_intermediate_table_created SIGNAL ready WAIT_FOR go';
ALTER TABLE t1 ADD FOREIGN KEY(pk) REFERENCES t2(pk) ON UPDATE CASCADE;
connect con1, localhost, root;
SET debug_sync='now WAIT_FOR ready';
SET lock_wait_timeout=0;
UPDATE t2 SET pk=10 WHERE pk=1;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
PREPARE stmt FROM 'UPDATE t2 SET pk=10 WHERE pk=1';
DEALLOCATE PREPARE stmt;
SET debug_sync='now SIGNAL go';
connection default;
disconnect con1;
connection default;
SET debug_sync='reset';
SHOW OPEN TABLES FROM test;
Database	Table	In_use	Name_locked
test	t2	0	0
DROP TABLE t1, t2;