5 --source suite/parts/inc/part_exch_tabs.inc
30 # 1) Valid exchange with partitions.
31 # exchange of values < 10 of tp to t and complete contents of t to p0 and back.
32 ALTER
TABLE tp EXCHANGE PARTITION p0 WITH
TABLE t_10;
36 SELECT * FROM tp WHERE a BETWEEN 0 AND 10;
37 # Back to the former contents.
38 ALTER
TABLE tp EXCHANGE PARTITION p0 WITH
TABLE t_10;
42 SELECT * FROM tp WHERE a BETWEEN 0 AND 10;
44 # Exchange with empty table.
45 ALTER
TABLE tp EXCHANGE PARTITION p0 WITH
TABLE t_empty;
47 SELECT * FROM t_empty;
49 SELECT * FROM tp WHERE a BETWEEN 0 AND 10;
50 # Back to the former contents.
51 ALTER
TABLE tp EXCHANGE PARTITION p0 WITH
TABLE t_empty;
53 SELECT * FROM t_empty;
55 SELECT * FROM tp WHERE a BETWEEN 0 AND 10;
57 # Exchange with null table.
58 ALTER
TABLE tp EXCHANGE PARTITION p0 WITH
TABLE t_null;
62 SELECT * FROM tp WHERE a BETWEEN 0 AND 10;
63 # Back to the former contents.
64 ALTER
TABLE tp EXCHANGE PARTITION p0 WITH
TABLE t_null;
68 SELECT * FROM tp WHERE a BETWEEN 0 AND 10;
70 # exchange of values < 100 of tp to t and complete contents of t to p1 and back.
71 ALTER
TABLE tp EXCHANGE PARTITION p1 WITH
TABLE t_100;
75 SELECT * FROM tp WHERE a BETWEEN 10 AND 100;
76 # Back to the former contents.
77 ALTER
TABLE tp EXCHANGE PARTITION p1 WITH
TABLE t_100;
81 SELECT * FROM tp WHERE a BETWEEN 10 AND 100;
83 # exchange of values < 1000 of tp to t and complete contents of t to p2 and back.
84 ALTER
TABLE tp EXCHANGE PARTITION p2 WITH
TABLE t_1000;
88 SELECT * FROM tp WHERE a BETWEEN 100 AND 1000;
89 # Back to the former contents.
90 ALTER
TABLE tp EXCHANGE PARTITION p2 WITH
TABLE t_1000;
94 SELECT * FROM tp WHERE a BETWEEN 100 AND 1000;
96 # 2) Valid exchange of subpartitions.
97 # exchange of values < 10 of tsp to t and complete contents of t to p0 and back.
98 ALTER
TABLE tsp EXCHANGE PARTITION sp00 WITH
TABLE tsp_00;
99 ALTER
TABLE tsp EXCHANGE PARTITION sp01 WITH
TABLE tsp_01;
100 ALTER
TABLE tsp EXCHANGE PARTITION sp02 WITH
TABLE tsp_02;
101 ALTER
TABLE tsp EXCHANGE PARTITION sp03 WITH
TABLE tsp_03;
102 ALTER
TABLE tsp EXCHANGE PARTITION sp04 WITH
TABLE tsp_04;
104 SELECT * FROM tsp_00;
106 SELECT * FROM tsp_01;
108 SELECT * FROM tsp_02;
110 SELECT * FROM tsp_03;
112 SELECT * FROM tsp_04;
114 SELECT * FROM tsp WHERE a BETWEEN 0 AND 10;
115 # Back to the former contents.
116 ALTER
TABLE tsp EXCHANGE PARTITION sp00 WITH
TABLE tsp_00;
117 ALTER
TABLE tsp EXCHANGE PARTITION sp01 WITH
TABLE tsp_01;
118 ALTER
TABLE tsp EXCHANGE PARTITION sp02 WITH
TABLE tsp_02;
119 ALTER
TABLE tsp EXCHANGE PARTITION sp03 WITH
TABLE tsp_03;
120 ALTER
TABLE tsp EXCHANGE PARTITION sp04 WITH
TABLE tsp_04;
122 SELECT * FROM tsp_00;
124 SELECT * FROM tsp_01;
126 SELECT * FROM tsp_02;
128 SELECT * FROM tsp_03;
130 SELECT * FROM tsp_04;
132 SELECT * FROM tsp WHERE a BETWEEN 0 AND 10;
134 # Exchange with null table.
135 ALTER
TABLE tsp EXCHANGE PARTITION sp01 WITH
TABLE t_null;
137 SELECT * FROM t_null;
139 SELECT * FROM tsp WHERE a BETWEEN 0 AND 10;
140 # Back to the former contents.
141 ALTER
TABLE tsp EXCHANGE PARTITION sp01 WITH
TABLE t_null;
143 SELECT * FROM t_null;
145 SELECT * FROM tsp WHERE a BETWEEN 0 AND 10;
147 --source suite/parts/inc/part_exch_drop_tabs.inc