You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1.6 KiB

  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.
  6. --source include/have_innodb.inc
  7. connect (a,localhost,root,,);
  8. connect (b,localhost,root,,);
  9. # Create a table with a non-unique index
  10. CREATE TABLE bug47622(
  11. `rule_key` int(11) NOT NULL DEFAULT '0',
  12. `seq` smallint(6) NOT NULL DEFAULT '0',
  13. `action` smallint(6) NOT NULL DEFAULT '0',
  14. `arg_id` smallint(6) DEFAULT NULL,
  15. `else_ind` TINYINT NOT NULL,
  16. KEY IDX_A (`arg_id`)
  17. ) ENGINE=InnoDB;
  18. connection a;
  19. # A subsequent creating unique index should not trigger
  20. # any error message. Unique index would be ranked ahead
  21. # of regular index.
  22. ALTER TABLE bug47622 ADD UNIQUE IDX_B (rule_key,else_ind,seq,action,arg_id);
  23. drop index IDX_B on bug47622;
  24. # In another connection, create additional set of normal
  25. # index and unique index. Again, unique index would be ranked
  26. # ahead of regular index.
  27. connection b;
  28. create index idx on bug47622(seq, arg_id);
  29. ALTER TABLE bug47622 ADD UNIQUE IDX_X (rule_key,else_ind,seq,action);
  30. drop table bug47622;
  31. # Create a table with one Primary key and a non-unique key
  32. CREATE TABLE bug47622 (
  33. `a` int(11) NOT NULL,
  34. `b` int(11) DEFAULT NULL,
  35. `c` char(10) DEFAULT NULL,
  36. `d` varchar(20) DEFAULT NULL,
  37. PRIMARY KEY (`a`),
  38. KEY `b` (`b`)
  39. ) ENGINE=InnoDB;
  40. # Add two index with one unique and one non-unique.
  41. # Index sequence is "PRIMARY", "c", "b" and "d"
  42. alter table bug47622 add unique index (c), add index (d);
  43. drop table bug47622;