1use test;
2
3--disable_result_log
4--disable_query_log
5--source suite/parts/inc/part_exch_tabs.inc
6--enable_result_log
7--enable_query_log
8
9--sorted_result
10SELECT * FROM t_10;
11--sorted_result
12SELECT * FROM t_100;
13--sorted_result
14SELECT * FROM t_1000;
15--sorted_result
16SELECT * FROM tp;
17--sorted_result
18SELECT * FROM tsp;
19--sorted_result
20SELECT * FROM tsp_00;
21--sorted_result
22SELECT * FROM tsp_01;
23--sorted_result
24SELECT * FROM tsp_02;
25--sorted_result
26SELECT * FROM tsp_03;
27--sorted_result
28SELECT * FROM tsp_04;
29
30# 1) Valid exchange with partitions.
31# exchange of values < 10 of tp to t and complete contents of t to p0 and back.
32ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t_10;
33--sorted_result
34SELECT * FROM t_10;
35--sorted_result
36SELECT * FROM tp WHERE a BETWEEN 0 AND 10;
37# Back to the former contents.
38ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t_10;
39--sorted_result
40SELECT * FROM t_10;
41--sorted_result
42SELECT * FROM tp WHERE a BETWEEN 0 AND 10;
43
44# Exchange with empty table.
45ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t_empty;
46--sorted_result
47SELECT * FROM t_empty;
48--sorted_result
49SELECT * FROM tp WHERE a BETWEEN 0 AND 10;
50# Back to the former contents.
51ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t_empty;
52--sorted_result
53SELECT * FROM t_empty;
54--sorted_result
55SELECT * FROM tp WHERE a BETWEEN 0 AND 10;
56
57# Exchange with null table.
58ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t_null;
59--sorted_result
60SELECT * FROM t_null;
61--sorted_result
62SELECT * FROM tp WHERE a BETWEEN 0 AND 10;
63# Back to the former contents.
64ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t_null;
65--sorted_result
66SELECT * FROM t_null;
67--sorted_result
68SELECT * FROM tp WHERE a BETWEEN 0 AND 10;
69
70# exchange of values < 100 of tp to t and complete contents of t to p1 and back.
71ALTER TABLE tp EXCHANGE PARTITION p1 WITH TABLE t_100;
72--sorted_result
73SELECT * FROM t_100;
74--sorted_result
75SELECT * FROM tp WHERE a BETWEEN 10 AND 100;
76# Back to the former contents.
77ALTER TABLE tp EXCHANGE PARTITION p1 WITH TABLE t_100;
78--sorted_result
79SELECT * FROM t_100;
80--sorted_result
81SELECT * FROM tp WHERE a BETWEEN 10 AND 100;
82
83# exchange of values < 1000 of tp to t and complete contents of t to p2 and back.
84ALTER TABLE tp EXCHANGE PARTITION p2 WITH TABLE t_1000;
85--sorted_result
86SELECT * FROM t_1000;
87--sorted_result
88SELECT * FROM tp WHERE a BETWEEN 100 AND 1000;
89# Back to the former contents.
90ALTER TABLE tp EXCHANGE PARTITION p2 WITH TABLE t_1000;
91--sorted_result
92SELECT * FROM t_1000;
93--sorted_result
94SELECT * FROM tp WHERE a BETWEEN 100 AND 1000;
95
96# 2) Valid exchange of subpartitions.
97# exchange of values < 10 of tsp to t and complete contents of t to p0 and back.
98ALTER TABLE tsp EXCHANGE PARTITION sp00 WITH TABLE tsp_00;
99ALTER TABLE tsp EXCHANGE PARTITION sp01 WITH TABLE tsp_01;
100ALTER TABLE tsp EXCHANGE PARTITION sp02 WITH TABLE tsp_02;
101ALTER TABLE tsp EXCHANGE PARTITION sp03 WITH TABLE tsp_03;
102ALTER TABLE tsp EXCHANGE PARTITION sp04 WITH TABLE tsp_04;
103--sorted_result
104SELECT * FROM tsp_00;
105--sorted_result
106SELECT * FROM tsp_01;
107--sorted_result
108SELECT * FROM tsp_02;
109--sorted_result
110SELECT * FROM tsp_03;
111--sorted_result
112SELECT * FROM tsp_04;
113--sorted_result
114SELECT * FROM tsp WHERE a BETWEEN 0 AND 10;
115# Back to the former contents.
116ALTER TABLE tsp EXCHANGE PARTITION sp00 WITH TABLE tsp_00;
117ALTER TABLE tsp EXCHANGE PARTITION sp01 WITH TABLE tsp_01;
118ALTER TABLE tsp EXCHANGE PARTITION sp02 WITH TABLE tsp_02;
119ALTER TABLE tsp EXCHANGE PARTITION sp03 WITH TABLE tsp_03;
120ALTER TABLE tsp EXCHANGE PARTITION sp04 WITH TABLE tsp_04;
121--sorted_result
122SELECT * FROM tsp_00;
123--sorted_result
124SELECT * FROM tsp_01;
125--sorted_result
126SELECT * FROM tsp_02;
127--sorted_result
128SELECT * FROM tsp_03;
129--sorted_result
130SELECT * FROM tsp_04;
131--sorted_result
132SELECT * FROM tsp WHERE a BETWEEN 0 AND 10;
133
134# Exchange with null table.
135ALTER TABLE tsp EXCHANGE PARTITION sp01 WITH TABLE t_null;
136--sorted_result
137SELECT * FROM t_null;
138--sorted_result
139SELECT * FROM tsp WHERE a BETWEEN 0 AND 10;
140# Back to the former contents.
141ALTER TABLE tsp EXCHANGE PARTITION sp01 WITH TABLE t_null;
142--sorted_result
143SELECT * FROM t_null;
144--sorted_result
145SELECT * FROM tsp WHERE a BETWEEN 0 AND 10;
146
147--source suite/parts/inc/part_exch_drop_tabs.inc
148
149