| 1 |
# |
| 2 |
# MDEV-35169 ALTER TABLE...IMPORT TABLESPACE does not |
| 3 |
# work with INDEX DESC |
| 4 |
# |
| 5 |
# prepare cfg for primary key with desc column |
| 6 |
create table t1 (pk int, a int, primary key(pk desc)) engine=InnoDB; |
| 7 |
insert into t1 values (1,10),(2,20),(3,15); |
| 8 |
flush table t1 for export; |
| 9 |
unlock tables; |
| 10 |
drop table t1; |
| 11 |
# prepare cfg for secondary index with desc column |
| 12 |
create table t1 (pk int primary key, a int,key(a desc)) engine=InnoDB; |
| 13 |
insert into t1 values (1,10),(2,20),(3,15); |
| 14 |
flush table t1 for export; |
| 15 |
unlock tables; |
| 16 |
drop table t1; |
| 17 |
# prepare cfg for secondary index with ascending column |
| 18 |
create table t1 (pk int primary key, a int, key(a)) engine=InnoDB; |
| 19 |
insert into t1 values (1,10),(2,20),(3,15); |
| 20 |
flush table t1 for export; |
| 21 |
unlock tables; |
| 22 |
drop table t1; |
| 23 |
# Import desc tablespace into desc frm |
| 24 |
# Import into table with desc primary key column |
| 25 |
create table t1 (pk int, a int, primary key(pk desc)) engine=InnoDB; |
| 26 |
alter table t1 discard tablespace; |
| 27 |
alter table t1 import tablespace; |
| 28 |
check table t1 extended; |
| 29 |
Table Op Msg_type Msg_text |
| 30 |
test.t1 check status OK |
| 31 |
drop table t1; |
| 32 |
# Import into table with desc secondary index |
| 33 |
create table t1 (pk int primary key, a int, key(a desc))engine=InnoDB; |
| 34 |
alter table t1 discard tablespace; |
| 35 |
alter table t1 import tablespace; |
| 36 |
check table t1 extended; |
| 37 |
Table Op Msg_type Msg_text |
| 38 |
test.t1 check status OK |
| 39 |
drop table t1; |
| 40 |
# Import asc tablespace into desc frm |
| 41 |
create table t1 (pk int primary key, a int, key(a desc))engine=InnoDB; |
| 42 |
alter table t1 discard tablespace; |
| 43 |
alter table t1 import tablespace; |
| 44 |
ERROR HY000: Schema mismatch (Index a field a is DESC which does not match with .cfg file) |
| 45 |
check table t1 extended; |
| 46 |
Table Op Msg_type Msg_text |
| 47 |
test.t1 check Error Tablespace has been discarded for table `t1` |
| 48 |
test.t1 check error Corrupt |
| 49 |
drop table t1; |
| 50 |
# Import desc tablespace into asc frm |
| 51 |
create table t1 (pk int primary key, a int, key(a)) engine=InnoDB; |
| 52 |
alter table t1 discard tablespace; |
| 53 |
alter table t1 import tablespace; |
| 54 |
ERROR HY000: Schema mismatch (Index a field a is ASC which does not match with .cfg file) |
| 55 |
check table t1 extended; |
| 56 |
Table Op Msg_type Msg_text |
| 57 |
test.t1 check Error Tablespace has been discarded for table `t1` |
| 58 |
test.t1 check error Corrupt |
| 59 |
drop table t1; |
| 60 |
# Import asc tablespace into asc frm |
| 61 |
create table t1 (pk int primary key, a int, key(a)) engine=InnoDB; |
| 62 |
alter table t1 discard tablespace; |
| 63 |
alter table t1 import tablespace; |
| 64 |
check table t1 extended; |
| 65 |
Table Op Msg_type Msg_text |
| 66 |
test.t1 check status OK |
| 67 |
drop table t1; |