Debian Codegraph @

mysql-test/suite/innodb/t/alter_candidate_key.test

raw
1 --source include/have_innodb.inc
2 --source include/have_debug.inc
3 --source include/have_debug_sync.inc
4
5 CREATE TABLE t1 (f1 INT NOT NULL, f2 INT NOT NULL,
6 UNIQUE KEY uidx2(f1,f2),
7 UNIQUE KEY uidx1(f2)) ENGINE=InnoDB;
8 INSERT INTO t1 VALUES(1, 1);
9 SHOW CREATE TABLE t1;
10 SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter
11 SIGNAL conc_dml WAIT_FOR go_ahead';
12 --send ALTER TABLE t1 CHANGE COLUMN f1 f11 INT, ALGORITHM=INPLACE
13 connect (con1,localhost,root,,);
14 SET DEBUG_SYNC = 'now WAIT_FOR conc_dml';
15 DELETE FROM t1;
16 SET DEBUG_SYNC = 'now SIGNAL go_ahead';
17 connection default;
18 reap;
19 SHOW CREATE TABLE t1;
20 CHECK TABLE t1;
21 DROP TABLE t1;
22
23 CREATE TABLE t1(f1 INT, f2 INT,
24 PRIMARY KEY(f1, f2),
25 UNIQUE INDEX uidx2 (f1, f2),
26 UNIQUE INDEX uidx1 (f2))ENGINE=InnoDB;
27 INSERT INTO t1 VALUES(2, 2);
28 ALTER TABLE t1 DROP PRIMARY KEY;
29 SHOW CREATE TABLE t1;
30 SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter
31 SIGNAL conc_dml WAIT_FOR go_ahead';
32 --send ALTER TABLE t1 CHANGE COLUMN f1 f11 INT, ALGORITHM=INPLACE
33 connection con1;
34 SET DEBUG_SYNC = 'now WAIT_FOR conc_dml';
35 --error ER_DUP_ENTRY
36 INSERT INTO t1 VALUES(1, 1), (1, 1);
37 SET DEBUG_SYNC = 'now SIGNAL go_ahead';
38 connection default;
39 reap;
40 SHOW CREATE TABLE t1;
41 CHECK TABLE t1;
42 DROP TABLE t1;
43
44 SET SQL_MODE= strict_trans_tables;
45 CREATE TABLE t1(a INT UNIQUE) ENGINE=InnoDB;
46 INSERT INTO t1 VALUES(1);
47 SET DEBUG_SYNC='row_log_table_apply1_before SIGNAL dml WAIT_FOR dml_done';
48 --send ALTER TABLE t1 MODIFY COLUMN a INT NOT NULL
49 connection con1;
50 SET DEBUG_SYNC='now WAIT_FOR dml';
51 BEGIN;
52 INSERT INTO t1 SET a=NULL;
53 COMMIT;
54 set DEBUG_SYNC='now SIGNAL dml_done';
55 connection default;
56 --error ER_INVALID_USE_OF_NULL
57 reap;
58 DROP TABLE t1;
59 disconnect con1;
60 SET DEBUG_SYNC="RESET";
61 SET SQL_MODE=DEFAULT;
62
63 CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL, PRIMARY KEY(f1, f2),
64 UNIQUE KEY(f2))ENGINE=InnoDB;
65 ALTER TABLE t1 DROP PRIMARY KEY;
66 SHOW CREATE TABLE t1;
67 DROP TABLE t1;
68
69 CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL,
70 UNIQUE KEY(f2), UNIQUE KEY(f2))ENGINE=InnoDB;
71 SHOW CREATE TABLE t1;
72 ALTER TABLE t1 DROP INDEX f2, ALGORITHM=INPLACE;
73 SHOW CREATE TABLE t1;
74 DROP TABLE t1;