| 1 |
call mtr.add_suppression("Table .* has a primary key in InnoDB data dictionary, but not in MariaDB"); |
| 2 |
call mtr.add_suppression("InnoDB: Table .* contains .* indexes inside InnoDB"); |
| 3 |
create table t1 (pk int, i int, key(i)) engine=InnoDB; |
| 4 |
insert into t1 values (1,1),(2,2); |
| 5 |
flush tables; |
| 6 |
# Save the .frm file without the PK |
| 7 |
alter table t1 add primary key (pk); |
| 8 |
# Stop the server, replace the frm with the old one and restart the server |
| 9 |
show create table t1; |
| 10 |
Table Create Table |
| 11 |
t1 CREATE TABLE `t1` ( |
| 12 |
`pk` int(11) DEFAULT NULL, |
| 13 |
`i` int(11) DEFAULT NULL, |
| 14 |
KEY `i` (`i`) |
| 15 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci |
| 16 |
Warnings: |
| 17 |
Warning 1082 InnoDB: Table test/t1 has a primary key in InnoDB data dictionary, but not in MariaDB! |
| 18 |
Warning 1082 InnoDB: Table test/t1 contains 2 indexes inside InnoDB, which is different from the number of indexes 1 defined in the MariaDB |
| 19 |
select * from t1; |
| 20 |
pk i |
| 21 |
1 1 |
| 22 |
2 2 |
| 23 |
alter table t1 add j int; |
| 24 |
Warnings: |
| 25 |
Warning 1082 InnoDB: Table test/t1 contains 2 indexes inside InnoDB, which is different from the number of indexes 1 defined in the MariaDB |
| 26 |
show warnings; |
| 27 |
Level Code Message |
| 28 |
Warning 1082 InnoDB: Table test/t1 contains 2 indexes inside InnoDB, which is different from the number of indexes 1 defined in the MariaDB |
| 29 |
show create table t1; |
| 30 |
Table Create Table |
| 31 |
t1 CREATE TABLE `t1` ( |
| 32 |
`pk` int(11) DEFAULT NULL, |
| 33 |
`i` int(11) DEFAULT NULL, |
| 34 |
`j` int(11) DEFAULT NULL, |
| 35 |
KEY `i` (`i`) |
| 36 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci |
| 37 |
alter table t1 add primary key (pk); |
| 38 |
show warnings; |
| 39 |
Level Code Message |
| 40 |
show create table t1; |
| 41 |
Table Create Table |
| 42 |
t1 CREATE TABLE `t1` ( |
| 43 |
`pk` int(11) NOT NULL, |
| 44 |
`i` int(11) DEFAULT NULL, |
| 45 |
`j` int(11) DEFAULT NULL, |
| 46 |
PRIMARY KEY (`pk`), |
| 47 |
KEY `i` (`i`) |
| 48 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci |
| 49 |
drop table t1; |