| 1 |
create table t1 ( |
| 2 |
id1 bigint(20) not null, |
| 3 |
id2 bigint(20) not null, |
| 4 |
primary key (id1), |
| 5 |
unique key id2 (id2) |
| 6 |
) engine=innodb row_format=compressed key_block_size=8; |
| 7 |
show create table t1; |
| 8 |
Table Create Table |
| 9 |
t1 CREATE TABLE `t1` ( |
| 10 |
`id1` bigint(20) NOT NULL, |
| 11 |
`id2` bigint(20) NOT NULL, |
| 12 |
PRIMARY KEY (`id1`), |
| 13 |
UNIQUE KEY `id2` (`id2`) |
| 14 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8 |
| 15 |
SET innodb_strict_mode=ON; |
| 16 |
alter table t1 row_format=dynamic; |
| 17 |
ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'KEY_BLOCK_SIZE' |
| 18 |
SET innodb_strict_mode=OFF; |
| 19 |
alter table t1 row_format=dynamic; |
| 20 |
Warnings: |
| 21 |
Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=8 unless ROW_FORMAT=COMPRESSED. |
| 22 |
show create table t1; |
| 23 |
Table Create Table |
| 24 |
t1 CREATE TABLE `t1` ( |
| 25 |
`id1` bigint(20) NOT NULL, |
| 26 |
`id2` bigint(20) NOT NULL, |
| 27 |
PRIMARY KEY (`id1`), |
| 28 |
UNIQUE KEY `id2` (`id2`) |
| 29 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=8 |
| 30 |
SET innodb_strict_mode=ON; |
| 31 |
alter table t1 key_block_size=0; |
| 32 |
show create table t1; |
| 33 |
Table Create Table |
| 34 |
t1 CREATE TABLE `t1` ( |
| 35 |
`id1` bigint(20) NOT NULL, |
| 36 |
`id2` bigint(20) NOT NULL, |
| 37 |
PRIMARY KEY (`id1`) KEY_BLOCK_SIZE=8, |
| 38 |
UNIQUE KEY `id2` (`id2`) KEY_BLOCK_SIZE=8 |
| 39 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci ROW_FORMAT=DYNAMIC |
| 40 |
alter table t1 drop primary key, add primary key (id1), |
| 41 |
drop key id2, add unique (id2); |
| 42 |
show create table t1; |
| 43 |
Table Create Table |
| 44 |
t1 CREATE TABLE `t1` ( |
| 45 |
`id1` bigint(20) NOT NULL, |
| 46 |
`id2` bigint(20) NOT NULL, |
| 47 |
PRIMARY KEY (`id1`), |
| 48 |
UNIQUE KEY `id2` (`id2`) |
| 49 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci ROW_FORMAT=DYNAMIC |
| 50 |
drop table t1; |