1
################################################################################
2
# inc/partition_alter_11.inc #
5
# Check ALTER partitioned table and the state of the table afterwards #
6
# The partitioning function use the column f_int1 #
8
# For all partitioning methods #
9
# PARTITION BY HASH/KEY/LIST/RANGE #
10
# PARTITION BY RANGE/LIST ... SUBPARTITION BY HASH/KEY ... #
12
# 1. Create the partitioned table #
13
# 2. Execute inc/partition_alter_1.inc, which will #
14
# - Insert the first half of the table t0_template into t1 #
15
# - Execute the ALTER TABLE statement #
16
# - Insert the second half of the table t0_template into t1 #
17
# - Execute the usability test include/partition_check.inc #
18
# - Drop the table t1 #
22
# $unique -- PRIMARY KEY or UNIQUE INDEXes to be created within the #
23
# CREATE TABLE STATEMENT #
24
# $alter -- ALTER TABLE statement, which has to be executed #
25
# have to be set before sourcing this routine. #
27
# let $unique= , UNIQUE INDEX uidx1 (f_int1); #
28
# let $alter= ALTER TABLE t1 DROP UNIQUE INDEX uidx1; #
29
# inc/partition_alter1.inc #
31
# Attention: The routine include/partition_alter_13.inc is very similar #
32
# to this one. So if something has to be changed here it #
33
# might be necessary to do it also there #
35
#------------------------------------------------------------------------------#
36
# Original Author: mleich #
37
# Original Date: 2006-03-05 #
41
################################################################################
44
DROP TABLE IF EXISTS t1;
48
#----------- PARTITION BY HASH
49
if ($with_partitioning)
51
let $partitioning= PARTITION BY HASH(f_int1) PARTITIONS 2;
53
eval CREATE TABLE t1 (
58
--source suite/parts/inc/partition_alter_1.inc
60
#----------- PARTITION BY KEY
61
if ($with_partitioning)
63
let $partitioning= PARTITION BY KEY(f_int1) PARTITIONS 5;
65
eval CREATE TABLE t1 (
70
--source suite/parts/inc/partition_alter_1.inc
72
#----------- PARTITION BY LIST
73
if ($with_partitioning)
75
let $partitioning= PARTITION BY LIST(MOD(f_int1,4))
76
(PARTITION part_3 VALUES IN (-3),
77
PARTITION part_2 VALUES IN (-2),
78
PARTITION part_1 VALUES IN (-1),
79
PARTITION part_N VALUES IN (NULL),
80
PARTITION part0 VALUES IN (0),
81
PARTITION part1 VALUES IN (1),
82
PARTITION part2 VALUES IN (2),
83
PARTITION part3 VALUES IN (3));
85
eval CREATE TABLE t1 (
90
--source suite/parts/inc/partition_alter_1.inc
92
#----------- PARTITION BY RANGE
93
if ($with_partitioning)
95
let $partitioning= PARTITION BY RANGE(f_int1)
96
(PARTITION parta VALUES LESS THAN (0),
97
PARTITION partb VALUES LESS THAN ($max_row_div4),
98
PARTITION partc VALUES LESS THAN ($max_row_div2),
99
PARTITION partd VALUES LESS THAN ($max_row_div2 + $max_row_div4),
100
PARTITION parte VALUES LESS THAN ($max_row),
101
PARTITION partf VALUES LESS THAN $MAX_VALUE);
103
eval CREATE TABLE t1 (
108
--source suite/parts/inc/partition_alter_1.inc
110
#----------- PARTITION BY RANGE -- SUBPARTITION BY HASH
111
if ($with_partitioning)
113
let $partitioning= PARTITION BY RANGE(f_int1 DIV 2) SUBPARTITION BY HASH(f_int1) SUBPARTITIONS 2
114
(PARTITION parta VALUES LESS THAN (0),
115
PARTITION partb VALUES LESS THAN ($max_row_div4),
116
PARTITION partc VALUES LESS THAN ($max_row_div2),
117
PARTITION partd VALUES LESS THAN $MAX_VALUE);
119
eval CREATE TABLE t1 (
124
--source suite/parts/inc/partition_alter_1.inc
126
#----------- PARTITION BY RANGE -- SUBPARTITION BY KEY
127
if ($with_partitioning)
129
let $partitioning= PARTITION BY RANGE(f_int1) SUBPARTITION BY KEY(f_int1)
130
(PARTITION part1 VALUES LESS THAN (0)
131
(SUBPARTITION subpart11, SUBPARTITION subpart12),
132
PARTITION part2 VALUES LESS THAN ($max_row_div4)
133
(SUBPARTITION subpart21, SUBPARTITION subpart22),
134
PARTITION part3 VALUES LESS THAN ($max_row_div2)
135
(SUBPARTITION subpart31, SUBPARTITION subpart32),
136
PARTITION part4 VALUES LESS THAN $MAX_VALUE
137
(SUBPARTITION subpart41, SUBPARTITION subpart42));
139
eval CREATE TABLE t1 (
144
--source suite/parts/inc/partition_alter_1.inc
146
#----------- PARTITION BY LIST -- SUBPARTITION BY HASH
147
if ($with_partitioning)
149
let $partitioning= PARTITION BY LIST(ABS(MOD(f_int1,3))) SUBPARTITION BY HASH(f_int1 + 1)
150
(PARTITION part1 VALUES IN (0)
151
(SUBPARTITION sp11, SUBPARTITION sp12),
152
PARTITION part2 VALUES IN (1)
153
(SUBPARTITION sp21, SUBPARTITION sp22),
154
PARTITION part3 VALUES IN (2)
155
(SUBPARTITION sp31, SUBPARTITION sp32),
156
PARTITION part4 VALUES IN (NULL)
157
(SUBPARTITION sp41, SUBPARTITION sp42));
159
eval CREATE TABLE t1 (
164
--source suite/parts/inc/partition_alter_1.inc
166
#----------- PARTITION BY LIST -- SUBPARTITION BY KEY
167
if ($with_partitioning)
169
let $partitioning= PARTITION BY LIST(ABS(MOD(f_int1,2)))
170
SUBPARTITION BY KEY(f_int1) SUBPARTITIONS $sub_part_no
171
(PARTITION part1 VALUES IN (0),
172
PARTITION part2 VALUES IN (1),
173
PARTITION part3 VALUES IN (NULL));
175
eval CREATE TABLE t1 (
180
--source suite/parts/inc/partition_alter_1.inc