Debian Codegraph @

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

raw
1 --source include/have_innodb.inc
2 # This is the test for bug 47622. There could be index
3 # metadata sequence mismatch between MySQL and Innodb
4 # after creating index through FIC interfaces.
5 # We resolve the problem by sync the index sequence
6 # up when opening the table.
7
8
9 connect (a,localhost,root,,);
10 connect (b,localhost,root,,);
11
12 # Create a table with a non-unique index
13 CREATE TABLE bug47622(
14 `rule_key` int(11) NOT NULL DEFAULT '0',
15 `seq` smallint(6) NOT NULL DEFAULT '0',
16 `action` smallint(6) NOT NULL DEFAULT '0',
17 `arg_id` smallint(6) DEFAULT NULL,
18 `else_ind` TINYINT NOT NULL,
19 KEY IDX_A (`arg_id`)
20 ) ENGINE=InnoDB;
21
22 connection a;
23
24 # A subsequent creating unique index should not trigger
25 # any error message. Unique index would be ranked ahead
26 # of regular index.
27 ALTER TABLE bug47622 ADD UNIQUE IDX_B (rule_key,else_ind,seq,action,arg_id);
28
29 drop index IDX_B on bug47622;
30
31 # In another connection, create additional set of normal
32 # index and unique index. Again, unique index would be ranked
33 # ahead of regular index.
34 connection b;
35 create index idx on bug47622(seq, arg_id);
36
37 ALTER TABLE bug47622 ADD UNIQUE IDX_X (rule_key,else_ind,seq,action);
38
39 drop table bug47622;
40
41 # Create a table with one Primary key and a non-unique key
42 CREATE TABLE bug47622 (
43 `a` int(11) NOT NULL,
44 `b` int(11) DEFAULT NULL,
45 `c` char(10) DEFAULT NULL,
46 `d` varchar(20) DEFAULT NULL,
47 PRIMARY KEY (`a`),
48 KEY `b` (`b`)
49 ) ENGINE=InnoDB;
50
51 # Add two index with one unique and one non-unique.
52 # Index sequence is "PRIMARY", "c", "b" and "d"
53 alter table bug47622 add unique index (c), add index (d);
54
55 drop table bug47622;