Debian Codegraph @

mysql-test/suite/s3/partition_move.result

raw
1 CREATE TABLE p0 (
2 c1 int primary key,
3 c2 int DEFAULT NULL
4 ) ENGINE=InnoDB;
5 insert into p0 select seq,seq from seq_1_to_99;
6 alter table p0 engine=s3 , rename to archive
7 PARTITION BY RANGE (c1)
8 (PARTITION p0 VALUES LESS THAN (100));
9 show create table archive;
10 Table Create Table
11 archive CREATE TABLE `archive` (
12 `c1` int(11) NOT NULL,
13 `c2` int(11) DEFAULT NULL,
14 PRIMARY KEY (`c1`)
15 ) ENGINE=S3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
16 PARTITION BY RANGE (`c1`)
17 (PARTITION `p0` VALUES LESS THAN (100) ENGINE = S3)
18 CREATE TABLE t1 (
19 c1 int primary key,
20 c2 int DEFAULT NULL
21 ) ENGINE=InnoDB
22 PARTITION BY RANGE (c1)
23 (PARTITION p1 VALUES LESS THAN (200),
24 PARTITION p2 VALUES LESS THAN (300),
25 PARTITION p3 VALUES LESS THAN (400));
26 insert into t1 select seq,seq from seq_100_to_399;
27 create table p1 like t1;
28 alter table p1 remove partitioning;
29 alter table t1 exchange partition p1 with table p1;
30 alter table t1 drop partition p1;
31 show create table p1;
32 Table Create Table
33 p1 CREATE TABLE `p1` (
34 `c1` int(11) NOT NULL,
35 `c2` int(11) DEFAULT NULL,
36 PRIMARY KEY (`c1`)
37 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
38 select count(*) from p1;
39 count(*)
40 100
41 alter table p1 engine=s3;
42 alter table archive add partition (partition p1 values less than (200));
43 alter table archive exchange partition p1 with table p1;
44 select count(*) from p1;
45 count(*)
46 0
47 drop table p1;
48 show create table t1;
49 Table Create Table
50 t1 CREATE TABLE `t1` (
51 `c1` int(11) NOT NULL,
52 `c2` int(11) DEFAULT NULL,
53 PRIMARY KEY (`c1`)
54 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
55 PARTITION BY RANGE (`c1`)
56 (PARTITION `p2` VALUES LESS THAN (300) ENGINE = InnoDB,
57 PARTITION `p3` VALUES LESS THAN (400) ENGINE = InnoDB)
58 show create table archive;
59 Table Create Table
60 archive CREATE TABLE `archive` (
61 `c1` int(11) NOT NULL,
62 `c2` int(11) DEFAULT NULL,
63 PRIMARY KEY (`c1`)
64 ) ENGINE=S3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
65 PARTITION BY RANGE (`c1`)
66 (PARTITION `p0` VALUES LESS THAN (100) ENGINE = S3,
67 PARTITION `p1` VALUES LESS THAN (200) ENGINE = S3)
68 select count(*) from t1;
69 count(*)
70 200
71 select count(*) from archive;
72 count(*)
73 199
74 drop table t1,archive;