mySQL 5.0.11 sources for tomato
[tomato.git] / release / src / router / mysql / mysql-test / suite / innodb_plugin / t / innodb_bug47622.test
blobec544bd7962df98f8c5de3212fcc5f43a32cea5b
1 # This is the test for bug 47622. There could be index
2 # metadata sequence mismatch between MySQL and Innodb
3 # after creating index through FIC interfaces.
4 # We resolve the problem by sync the index sequence
5 # up when opening the table.
7 -- source include/have_innodb_plugin.inc
9 connect (a,localhost,root,,);
10 connect (b,localhost,root,,);
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;
22 connection a;
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);
29 drop index IDX_B on bug47622;
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);
37 ALTER TABLE bug47622 ADD UNIQUE IDX_X (rule_key,else_ind,seq,action);
39 drop table bug47622;
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;
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);
55 drop table bug47622;