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.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,
24
# A subsequent creating unique index should not trigger
25
# any error message. Unique index would be ranked ahead
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.
35
create index idx on bug47622(seq, arg_id);
37
ALTER TABLE bug47622 ADD UNIQUE IDX_X (rule_key,else_ind,seq,action);
41
# Create a table with one Primary key and a non-unique key
42
CREATE TABLE bug47622 (
44
`b` int(11) DEFAULT NULL,
45
`c` char(10) DEFAULT NULL,
46
`d` varchar(20) DEFAULT NULL,
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);