| 1 |
create table t1(id int auto_increment primary key, handle int, data bigint not null default 0) engine = innodb; |
| 2 |
insert into t1(handle) values(12),(54),(NULL); |
| 3 |
select *, md5(handle) from t1; |
| 4 |
id handle data md5(handle) |
| 5 |
1 12 0 c20ad4d76fe97759aa27a0c99bff6710 |
| 6 |
2 54 0 a684eceee76fc522773286a895bc8436 |
| 7 |
3 NULL 0 NULL |
| 8 |
alter table t1 add index handle(handle), algorithm=inplace; |
| 9 |
alter table t1 add column hash varchar(32) as (md5(handle)) persistent, algorithm=inplace; |
| 10 |
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY |
| 11 |
alter table t1 add column hash varchar(32) as (md5(handle)) persistent, add unique index hash(hash), algorithm=inplace; |
| 12 |
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY |
| 13 |
alter table t1 add column hash varchar(32) as (md5(handle)) persistent, add unique index hash(hash), algorithm=copy; |
| 14 |
select * from t1; |
| 15 |
id handle data hash |
| 16 |
1 12 0 c20ad4d76fe97759aa27a0c99bff6710 |
| 17 |
2 54 0 a684eceee76fc522773286a895bc8436 |
| 18 |
3 NULL 0 NULL |
| 19 |
alter table t1 modify column hash varchar(32) as (md5(handle+1)) persistent, algorithm=inplace; |
| 20 |
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY |
| 21 |
alter table t1 modify column hash varchar(32) as (md5(handle+1)) persistent, algorithm=copy; |
| 22 |
select * from t1; |
| 23 |
id handle data hash |
| 24 |
1 12 0 c51ce410c124a10e0db5e4b97fc2af39 |
| 25 |
2 54 0 b53b3a3d6ab90ce0268229151c9bde11 |
| 26 |
3 NULL 0 NULL |
| 27 |
alter table t1 modify column handle int not null, algorithm=inplace; |
| 28 |
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY |
| 29 |
SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR |
| 30 |
alter table t1 modify column handle int not null, algorithm=copy; |
| 31 |
Warnings: |
| 32 |
Warning 1265 Data truncated for column 'handle' at row 3 |
| 33 |
select * from t1; |
| 34 |
id handle data hash |
| 35 |
1 12 0 c51ce410c124a10e0db5e4b97fc2af39 |
| 36 |
2 54 0 b53b3a3d6ab90ce0268229151c9bde11 |
| 37 |
3 0 0 c4ca4238a0b923820dcc509a6f75849b |
| 38 |
alter table t1 drop index handle, algorithm=inplace; |
| 39 |
create index data on t1(data) algorithm=inplace; |
| 40 |
alter table t1 drop column data, algorithm=inplace; |
| 41 |
alter table t1 add column sha varchar(32) as (sha1(handle)) persistent, algorithm=inplace; |
| 42 |
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY |
| 43 |
alter table t1 add column sha varchar(32), algorithm=inplace; |
| 44 |
alter table t1 drop column hash, algorithm=inplace; |
| 45 |
drop table t1; |