~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysql-test/suite/parts/r/partition_syntax_ndb.result

  • Committer: brian
  • Date: 2008-06-25 05:29:13 UTC
  • Revision ID: brian@localhost.localdomain-20080625052913-6upwo0jsrl4lnapl
clean slate

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
SET @max_row = 20;
 
2
SET @@session.storage_engine = 'ndbcluster';
 
3
 
 
4
#------------------------------------------------------------------------
 
5
# There are several testcases disabled because of the open bugs
 
6
# #15890
 
7
# #18730, Bug#18735
 
8
# The expected results suffer from the following bugs
 
9
# harmless #17455, #19305
 
10
# which cannot be suppressed because of technical reasons.
 
11
#------------------------------------------------------------------------
 
12
 
 
13
#------------------------------------------------------------------------
 
14
#  0. Setting of auxiliary variables + Creation of an auxiliary tables
 
15
#     needed in many testcases
 
16
#------------------------------------------------------------------------
 
17
SELECT @max_row DIV 2 INTO @max_row_div2;
 
18
SELECT @max_row DIV 3 INTO @max_row_div3;
 
19
SELECT @max_row DIV 4 INTO @max_row_div4;
 
20
SET @max_int_4 = 2147483647;
 
21
DROP TABLE IF EXISTS t0_template;
 
22
CREATE TABLE t0_template (
 
23
f_int1 INTEGER,
 
24
f_int2 INTEGER,
 
25
f_char1 CHAR(20),
 
26
f_char2 CHAR(20),
 
27
f_charbig VARCHAR(1000) ,
 
28
PRIMARY KEY(f_int1))
 
29
ENGINE = MEMORY;
 
30
#     Logging of <max_row> INSERTs into t0_template suppressed
 
31
DROP TABLE IF EXISTS t0_definition;
 
32
CREATE TABLE t0_definition (
 
33
state CHAR(3),
 
34
create_command VARBINARY(5000),
 
35
file_list      VARBINARY(5000),
 
36
PRIMARY KEY (state)
 
37
) ENGINE = MEMORY;
 
38
DROP TABLE IF EXISTS t0_aux;
 
39
CREATE TABLE t0_aux ( f_int1 INTEGER,
 
40
f_int2 INTEGER,
 
41
f_char1 CHAR(20),
 
42
f_char2 CHAR(20),
 
43
f_charbig VARCHAR(1000) )
 
44
ENGINE = MEMORY;
 
45
SET AUTOCOMMIT= 1;
 
46
SET @@session.sql_mode= '';
 
47
# End of basic preparations needed for all tests
 
48
#-----------------------------------------------
 
49
 
 
50
#========================================================================
 
51
#  1.    Any PRIMARY KEYs or UNIQUE INDEXes must contain the columns used
 
52
#        within the partitioning functions
 
53
#========================================================================
 
54
DROP TABLE IF EXISTS t1;
 
55
#------------------------------------------------------------------------
 
56
#  1.1 column of partitioning function not included in PRIMARY KEY
 
57
#               PARTITION BY HASH/KEY/LIST/RANGE
 
58
#------------------------------------------------------------------------
 
59
CREATE TABLE t1 (
 
60
f_int1 INTEGER,
 
61
f_int2 INTEGER,
 
62
f_char1 CHAR(20),
 
63
f_char2 CHAR(20),
 
64
f_charbig VARCHAR(1000),
 
65
PRIMARY KEY (f_int2)
 
66
)
 
67
PARTITION BY HASH(f_int1) PARTITIONS 2;
 
68
ERROR HY000: A PRIMARY KEY need to include all fields in the partition function
 
69
CREATE TABLE t1 (
 
70
f_int1 INTEGER,
 
71
f_int2 INTEGER,
 
72
f_char1 CHAR(20),
 
73
f_char2 CHAR(20),
 
74
f_charbig VARCHAR(1000),
 
75
PRIMARY KEY (f_int2)
 
76
)
 
77
PARTITION BY HASH(f_int1 + f_int2) PARTITIONS 2;
 
78
ERROR HY000: A PRIMARY KEY need to include all fields in the partition function
 
79
CREATE TABLE t1 (
 
80
f_int1 INTEGER,
 
81
f_int2 INTEGER,
 
82
f_char1 CHAR(20),
 
83
f_char2 CHAR(20),
 
84
f_charbig VARCHAR(1000),
 
85
PRIMARY KEY (f_int2)
 
86
)
 
87
PARTITION BY KEY(f_int1) PARTITIONS 2;
 
88
ERROR HY000: A PRIMARY KEY need to include all fields in the partition function
 
89
CREATE TABLE t1 (
 
90
f_int1 INTEGER,
 
91
f_int2 INTEGER,
 
92
f_char1 CHAR(20),
 
93
f_char2 CHAR(20),
 
94
f_charbig VARCHAR(1000),
 
95
PRIMARY KEY (f_int2)
 
96
)
 
97
PARTITION BY KEY(f_int1,f_int2) PARTITIONS 2;
 
98
ERROR HY000: A PRIMARY KEY need to include all fields in the partition function
 
99
CREATE TABLE t1 (
 
100
f_int1 INTEGER,
 
101
f_int2 INTEGER,
 
102
f_char1 CHAR(20),
 
103
f_char2 CHAR(20),
 
104
f_charbig VARCHAR(1000),
 
105
PRIMARY KEY (f_int2)
 
106
)
 
107
PARTITION BY LIST(f_int1)
 
108
(PARTITION part1 VALUES IN (1));
 
109
ERROR HY000: A PRIMARY KEY need to include all fields in the partition function
 
110
CREATE TABLE t1 (
 
111
f_int1 INTEGER,
 
112
f_int2 INTEGER,
 
113
f_char1 CHAR(20),
 
114
f_char2 CHAR(20),
 
115
f_charbig VARCHAR(1000),
 
116
PRIMARY KEY (f_int2)
 
117
)
 
118
PARTITION BY LIST(f_int1 + f_int2)
 
119
(PARTITION part1 VALUES IN (1));
 
120
ERROR HY000: A PRIMARY KEY need to include all fields in the partition function
 
121
CREATE TABLE t1 (
 
122
f_int1 INTEGER,
 
123
f_int2 INTEGER,
 
124
f_char1 CHAR(20),
 
125
f_char2 CHAR(20),
 
126
f_charbig VARCHAR(1000),
 
127
PRIMARY KEY (f_int2)
 
128
)
 
129
PARTITION BY RANGE(f_int1)
 
130
(PARTITION part1 VALUES LESS THAN (1));
 
131
ERROR HY000: A PRIMARY KEY need to include all fields in the partition function
 
132
CREATE TABLE t1 (
 
133
f_int1 INTEGER,
 
134
f_int2 INTEGER,
 
135
f_char1 CHAR(20),
 
136
f_char2 CHAR(20),
 
137
f_charbig VARCHAR(1000),
 
138
PRIMARY KEY (f_int2)
 
139
)
 
140
PARTITION BY RANGE(f_int1 + f_int2)
 
141
(PARTITION part1 VALUES LESS THAN (1));
 
142
ERROR HY000: A PRIMARY KEY need to include all fields in the partition function
 
143
#------------------------------------------------------------------------
 
144
#  1.2 column of partitioning function not included in UNIQUE INDEX
 
145
#               PARTITION BY HASH/KEY/LIST/RANGE
 
146
#      Variant a) Without additional PRIMARY KEY        
 
147
#      Variant b) With correct additional PRIMARY KEY        
 
148
#      Variant 1) one column in partitioning function
 
149
#      Variant 2) two columns in partitioning function
 
150
#------------------------------------------------------------------------
 
151
CREATE TABLE t1 (
 
152
f_int1 INTEGER,
 
153
f_int2 INTEGER,
 
154
f_char1 CHAR(20),
 
155
f_char2 CHAR(20),
 
156
f_charbig VARCHAR(1000),
 
157
UNIQUE INDEX (f_int2)
 
158
)
 
159
PARTITION BY HASH(f_int1) PARTITIONS 2;
 
160
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
 
161
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
 
162
DROP TABLE t1;
 
163
CREATE TABLE t1 (
 
164
f_int1 INTEGER,
 
165
f_int2 INTEGER,
 
166
f_char1 CHAR(20),
 
167
f_char2 CHAR(20),
 
168
f_charbig VARCHAR(1000),
 
169
PRIMARY KEY(f_int1,f_int2), UNIQUE INDEX (f_int2)
 
170
)
 
171
PARTITION BY HASH(f_int1) PARTITIONS 2;
 
172
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
 
173
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
 
174
DROP TABLE t1;
 
175
CREATE TABLE t1 (
 
176
f_int1 INTEGER,
 
177
f_int2 INTEGER,
 
178
f_char1 CHAR(20),
 
179
f_char2 CHAR(20),
 
180
f_charbig VARCHAR(1000),
 
181
UNIQUE INDEX (f_int2)
 
182
)
 
183
PARTITION BY HASH(f_int1 + f_int2) PARTITIONS 2;
 
184
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
 
185
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
 
186
DROP TABLE t1;
 
187
CREATE TABLE t1 (
 
188
f_int1 INTEGER,
 
189
f_int2 INTEGER,
 
190
f_char1 CHAR(20),
 
191
f_char2 CHAR(20),
 
192
f_charbig VARCHAR(1000),
 
193
PRIMARY KEY(f_int1,f_int2), UNIQUE INDEX (f_int2)
 
194
)
 
195
PARTITION BY HASH(f_int1 + f_int2) PARTITIONS 2;
 
196
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
 
197
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
 
198
DROP TABLE t1;
 
199
CREATE TABLE t1 (
 
200
f_int1 INTEGER,
 
201
f_int2 INTEGER,
 
202
f_char1 CHAR(20),
 
203
f_char2 CHAR(20),
 
204
f_charbig VARCHAR(1000),
 
205
UNIQUE INDEX (f_int2)
 
206
)
 
207
PARTITION BY KEY(f_int1) PARTITIONS 2;
 
208
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
 
209
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
 
210
DROP TABLE t1;
 
211
CREATE TABLE t1 (
 
212
f_int1 INTEGER,
 
213
f_int2 INTEGER,
 
214
f_char1 CHAR(20),
 
215
f_char2 CHAR(20),
 
216
f_charbig VARCHAR(1000),
 
217
PRIMARY KEY(f_int1,f_int2), UNIQUE INDEX (f_int2)
 
218
)
 
219
PARTITION BY KEY(f_int1) PARTITIONS 2;
 
220
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
 
221
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
 
222
DROP TABLE t1;
 
223
CREATE TABLE t1 (
 
224
f_int1 INTEGER,
 
225
f_int2 INTEGER,
 
226
f_char1 CHAR(20),
 
227
f_char2 CHAR(20),
 
228
f_charbig VARCHAR(1000),
 
229
UNIQUE INDEX (f_int2)
 
230
)
 
231
PARTITION BY KEY(f_int1,f_int2) PARTITIONS 2;
 
232
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
 
233
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
 
234
DROP TABLE t1;
 
235
CREATE TABLE t1 (
 
236
f_int1 INTEGER,
 
237
f_int2 INTEGER,
 
238
f_char1 CHAR(20),
 
239
f_char2 CHAR(20),
 
240
f_charbig VARCHAR(1000),
 
241
PRIMARY KEY(f_int1,f_int2), UNIQUE INDEX (f_int2)
 
242
)
 
243
PARTITION BY KEY(f_int1,f_int2) PARTITIONS 2;
 
244
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
 
245
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
 
246
DROP TABLE t1;
 
247
CREATE TABLE t1 (
 
248
f_int1 INTEGER,
 
249
f_int2 INTEGER,
 
250
f_char1 CHAR(20),
 
251
f_char2 CHAR(20),
 
252
f_charbig VARCHAR(1000),
 
253
UNIQUE INDEX (f_int2)
 
254
)
 
255
PARTITION BY LIST(MOD(f_int1,3))
 
256
(PARTITION partN VALUES IN (NULL),
 
257
PARTITION part0 VALUES IN (0),
 
258
PARTITION part1 VALUES IN (1),
 
259
PARTITION part2 VALUES IN (2));
 
260
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
 
261
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
 
262
DROP TABLE t1;
 
263
CREATE TABLE t1 (
 
264
f_int1 INTEGER,
 
265
f_int2 INTEGER,
 
266
f_char1 CHAR(20),
 
267
f_char2 CHAR(20),
 
268
f_charbig VARCHAR(1000),
 
269
PRIMARY KEY(f_int1,f_int2), UNIQUE INDEX (f_int2)
 
270
)
 
271
PARTITION BY LIST(MOD(f_int1,3))
 
272
(PARTITION partN VALUES IN (NULL),
 
273
PARTITION part0 VALUES IN (0),
 
274
PARTITION part1 VALUES IN (1),
 
275
PARTITION part2 VALUES IN (2));
 
276
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
 
277
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
 
278
DROP TABLE t1;
 
279
CREATE TABLE t1 (
 
280
f_int1 INTEGER,
 
281
f_int2 INTEGER,
 
282
f_char1 CHAR(20),
 
283
f_char2 CHAR(20),
 
284
f_charbig VARCHAR(1000),
 
285
UNIQUE INDEX (f_int2)
 
286
)
 
287
PARTITION BY LIST(MOD(f_int1 + f_int2,3))
 
288
(PARTITION partN VALUES IN (NULL),
 
289
PARTITION part0 VALUES IN (0),
 
290
PARTITION part1 VALUES IN (1),
 
291
PARTITION part2 VALUES IN (2));
 
292
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
 
293
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
 
294
DROP TABLE t1;
 
295
CREATE TABLE t1 (
 
296
f_int1 INTEGER,
 
297
f_int2 INTEGER,
 
298
f_char1 CHAR(20),
 
299
f_char2 CHAR(20),
 
300
f_charbig VARCHAR(1000),
 
301
PRIMARY KEY(f_int1,f_int2), UNIQUE INDEX (f_int2)
 
302
)
 
303
PARTITION BY LIST(MOD(f_int1 + f_int2,3))
 
304
(PARTITION partN VALUES IN (NULL),
 
305
PARTITION part0 VALUES IN (0),
 
306
PARTITION part1 VALUES IN (1),
 
307
PARTITION part2 VALUES IN (2));
 
308
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
 
309
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
 
310
DROP TABLE t1;
 
311
CREATE TABLE t1 (
 
312
f_int1 INTEGER,
 
313
f_int2 INTEGER,
 
314
f_char1 CHAR(20),
 
315
f_char2 CHAR(20),
 
316
f_charbig VARCHAR(1000),
 
317
UNIQUE INDEX (f_int2)
 
318
)
 
319
PARTITION BY RANGE(f_int1)
 
320
(PARTITION part1 VALUES LESS THAN (1),
 
321
PARTITION part2 VALUES LESS THAN (2147483646));
 
322
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
 
323
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
 
324
DROP TABLE t1;
 
325
CREATE TABLE t1 (
 
326
f_int1 INTEGER,
 
327
f_int2 INTEGER,
 
328
f_char1 CHAR(20),
 
329
f_char2 CHAR(20),
 
330
f_charbig VARCHAR(1000),
 
331
PRIMARY KEY(f_int1,f_int2), UNIQUE INDEX (f_int2)
 
332
)
 
333
PARTITION BY RANGE(f_int1)
 
334
(PARTITION part1 VALUES LESS THAN (1),
 
335
PARTITION part2 VALUES LESS THAN (2147483646));
 
336
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
 
337
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
 
338
DROP TABLE t1;
 
339
CREATE TABLE t1 (
 
340
f_int1 INTEGER,
 
341
f_int2 INTEGER,
 
342
f_char1 CHAR(20),
 
343
f_char2 CHAR(20),
 
344
f_charbig VARCHAR(1000),
 
345
UNIQUE INDEX (f_int2)
 
346
)
 
347
PARTITION BY RANGE(f_int1 + f_int2)
 
348
(PARTITION part1 VALUES LESS THAN (1),
 
349
PARTITION part2 VALUES LESS THAN (2147483646));
 
350
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
 
351
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
 
352
DROP TABLE t1;
 
353
CREATE TABLE t1 (
 
354
f_int1 INTEGER,
 
355
f_int2 INTEGER,
 
356
f_char1 CHAR(20),
 
357
f_char2 CHAR(20),
 
358
f_charbig VARCHAR(1000),
 
359
PRIMARY KEY(f_int1,f_int2), UNIQUE INDEX (f_int2)
 
360
)
 
361
PARTITION BY RANGE(f_int1 + f_int2)
 
362
(PARTITION part1 VALUES LESS THAN (1),
 
363
PARTITION part2 VALUES LESS THAN (2147483646));
 
364
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
 
365
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
 
366
DROP TABLE t1;
 
367
#------------------------------------------------------------------------
 
368
#  1.3 column of subpartitioning function not included in PRIMARY KEY
 
369
#               PARTITION BY RANGE/LIST -- SUBPARTITION BY HASH/KEY
 
370
#------------------------------------------------------------------------
 
371
CREATE TABLE t1 (
 
372
f_int1 INTEGER,
 
373
f_int2 INTEGER,
 
374
f_char1 CHAR(20),
 
375
f_char2 CHAR(20),
 
376
f_charbig VARCHAR(1000),
 
377
PRIMARY KEY (f_int2)
 
378
)
 
379
PARTITION BY RANGE(f_int2) SUBPARTITION BY HASH(f_int1)
 
380
(PARTITION part1 VALUES LESS THAN (1)
 
381
(SUBPARTITION subpart1));
 
382
ERROR HY000: A PRIMARY KEY need to include all fields in the partition function
 
383
CREATE TABLE t1 (
 
384
f_int1 INTEGER,
 
385
f_int2 INTEGER,
 
386
f_char1 CHAR(20),
 
387
f_char2 CHAR(20),
 
388
f_charbig VARCHAR(1000),
 
389
PRIMARY KEY (f_int2)
 
390
)
 
391
PARTITION BY RANGE(f_int2) SUBPARTITION BY KEY(f_int1)
 
392
(PARTITION part1 VALUES LESS THAN (1)
 
393
(SUBPARTITION subpart1));
 
394
ERROR HY000: A PRIMARY KEY need to include all fields in the partition function
 
395
CREATE TABLE t1 (
 
396
f_int1 INTEGER,
 
397
f_int2 INTEGER,
 
398
f_char1 CHAR(20),
 
399
f_char2 CHAR(20),
 
400
f_charbig VARCHAR(1000),
 
401
PRIMARY KEY (f_int2)
 
402
)
 
403
PARTITION BY LIST(f_int2) SUBPARTITION BY HASH(f_int1)
 
404
(PARTITION part1 VALUES IN (1)
 
405
(SUBPARTITION subpart1));
 
406
ERROR HY000: A PRIMARY KEY need to include all fields in the partition function
 
407
CREATE TABLE t1 (
 
408
f_int1 INTEGER,
 
409
f_int2 INTEGER,
 
410
f_char1 CHAR(20),
 
411
f_char2 CHAR(20),
 
412
f_charbig VARCHAR(1000),
 
413
PRIMARY KEY (f_int2)
 
414
)
 
415
PARTITION BY LIST(f_int2) SUBPARTITION BY KEY(f_int1)
 
416
(PARTITION part1 VALUES IN (1)
 
417
(SUBPARTITION subpart1));
 
418
ERROR HY000: A PRIMARY KEY need to include all fields in the partition function
 
419
#------------------------------------------------------------------------
 
420
#  1.4 column of subpartitioning function not included in UNIQUE INDEX
 
421
#               PARTITION BY RANGE/LIST -- SUBPARTITION BY HASH/KEY
 
422
#      Variant a) Without additional PRIMARY KEY        
 
423
#      Variant b) With correct additional PRIMARY KEY        
 
424
#------------------------------------------------------------------------
 
425
CREATE TABLE t1 (
 
426
f_int1 INTEGER,
 
427
f_int2 INTEGER,
 
428
f_char1 CHAR(20),
 
429
f_char2 CHAR(20),
 
430
f_charbig VARCHAR(1000),
 
431
UNIQUE INDEX (f_int2)
 
432
)
 
433
PARTITION BY RANGE(f_int2)
 
434
SUBPARTITION BY HASH(f_int1) SUBPARTITIONS 3
 
435
(PARTITION part1 VALUES LESS THAN (1),
 
436
PARTITION part2 VALUES LESS THAN (2147483646));
 
437
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
 
438
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
 
439
DROP TABLE t1;
 
440
CREATE TABLE t1 (
 
441
f_int1 INTEGER,
 
442
f_int2 INTEGER,
 
443
f_char1 CHAR(20),
 
444
f_char2 CHAR(20),
 
445
f_charbig VARCHAR(1000),
 
446
PRIMARY KEY(f_int1,f_int2), UNIQUE INDEX (f_int2)
 
447
)
 
448
PARTITION BY RANGE(f_int2)
 
449
SUBPARTITION BY HASH(f_int1) SUBPARTITIONS 3
 
450
(PARTITION part1 VALUES LESS THAN (1),
 
451
PARTITION part2 VALUES LESS THAN (2147483646));
 
452
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
 
453
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
 
454
DROP TABLE t1;
 
455
CREATE TABLE t1 (
 
456
f_int1 INTEGER,
 
457
f_int2 INTEGER,
 
458
f_char1 CHAR(20),
 
459
f_char2 CHAR(20),
 
460
f_charbig VARCHAR(1000),
 
461
UNIQUE INDEX (f_int2)
 
462
)
 
463
PARTITION BY RANGE(f_int2)
 
464
SUBPARTITION BY KEY(f_int1) SUBPARTITIONS 3
 
465
(PARTITION part1 VALUES LESS THAN (1),
 
466
PARTITION part2 VALUES LESS THAN (2147483646));
 
467
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
 
468
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
 
469
DROP TABLE t1;
 
470
CREATE TABLE t1 (
 
471
f_int1 INTEGER,
 
472
f_int2 INTEGER,
 
473
f_char1 CHAR(20),
 
474
f_char2 CHAR(20),
 
475
f_charbig VARCHAR(1000),
 
476
PRIMARY KEY(f_int1,f_int2), UNIQUE INDEX (f_int2)
 
477
)
 
478
PARTITION BY RANGE(f_int2)
 
479
SUBPARTITION BY KEY(f_int1) SUBPARTITIONS 3
 
480
(PARTITION part1 VALUES LESS THAN (1),
 
481
PARTITION part2 VALUES LESS THAN (2147483646));
 
482
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
 
483
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
 
484
DROP TABLE t1;
 
485
CREATE TABLE t1 (
 
486
f_int1 INTEGER,
 
487
f_int2 INTEGER,
 
488
f_char1 CHAR(20),
 
489
f_char2 CHAR(20),
 
490
f_charbig VARCHAR(1000),
 
491
UNIQUE INDEX (f_int2)
 
492
)
 
493
PARTITION BY LIST(MOD(f_int2,3))
 
494
SUBPARTITION BY HASH(f_int1) SUBPARTITIONS 2
 
495
(PARTITION partN VALUES IN (NULL),
 
496
PARTITION part0 VALUES IN (0),
 
497
PARTITION part1 VALUES IN (1),
 
498
PARTITION part2 VALUES IN (2));
 
499
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
 
500
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
 
501
DROP TABLE t1;
 
502
CREATE TABLE t1 (
 
503
f_int1 INTEGER,
 
504
f_int2 INTEGER,
 
505
f_char1 CHAR(20),
 
506
f_char2 CHAR(20),
 
507
f_charbig VARCHAR(1000),
 
508
PRIMARY KEY(f_int1,f_int2), UNIQUE INDEX (f_int2)
 
509
)
 
510
PARTITION BY LIST(MOD(f_int2,3))
 
511
SUBPARTITION BY HASH(f_int1) SUBPARTITIONS 2
 
512
(PARTITION partN VALUES IN (NULL),
 
513
PARTITION part0 VALUES IN (0),
 
514
PARTITION part1 VALUES IN (1),
 
515
PARTITION part2 VALUES IN (2));
 
516
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
 
517
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
 
518
DROP TABLE t1;
 
519
CREATE TABLE t1 (
 
520
f_int1 INTEGER,
 
521
f_int2 INTEGER,
 
522
f_char1 CHAR(20),
 
523
f_char2 CHAR(20),
 
524
f_charbig VARCHAR(1000),
 
525
UNIQUE INDEX (f_int2)
 
526
)
 
527
PARTITION BY LIST(MOD(f_int2,3))
 
528
SUBPARTITION BY KEY(f_int1) SUBPARTITIONS 2
 
529
(PARTITION partN VALUES IN (NULL),
 
530
PARTITION part0 VALUES IN (0),
 
531
PARTITION part1 VALUES IN (1),
 
532
PARTITION part2 VALUES IN (2));
 
533
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
 
534
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
 
535
DROP TABLE t1;
 
536
CREATE TABLE t1 (
 
537
f_int1 INTEGER,
 
538
f_int2 INTEGER,
 
539
f_char1 CHAR(20),
 
540
f_char2 CHAR(20),
 
541
f_charbig VARCHAR(1000),
 
542
PRIMARY KEY(f_int1,f_int2), UNIQUE INDEX (f_int2)
 
543
)
 
544
PARTITION BY LIST(MOD(f_int2,3))
 
545
SUBPARTITION BY KEY(f_int1) SUBPARTITIONS 2
 
546
(PARTITION partN VALUES IN (NULL),
 
547
PARTITION part0 VALUES IN (0),
 
548
PARTITION part1 VALUES IN (1),
 
549
PARTITION part2 VALUES IN (2));
 
550
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
 
551
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
 
552
DROP TABLE t1;
 
553
 
 
554
#========================================================================
 
555
#  2   Some properties around subpartitioning
 
556
#========================================================================
 
557
#------------------------------------------------------------------------
 
558
#  2.1 Subpartioned table without subpartitioning rule must be rejected
 
559
#------------------------------------------------------------------------
 
560
DROP TABLE IF EXISTS t1;
 
561
CREATE TABLE t1 (
 
562
f_int1 INTEGER,
 
563
f_int2 INTEGER,
 
564
f_char1 CHAR(20),
 
565
f_char2 CHAR(20),
 
566
f_charbig VARCHAR(1000)
 
567
)
 
568
PARTITION BY RANGE(f_int1)
 
569
( PARTITION part1 VALUES LESS THAN (1000) (SUBPARTITION subpart11));
 
570
ERROR HY000: It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning
 
571
#------------------------------------------------------------------------
 
572
#  2.2 Every partition must have the same number of subpartitions.
 
573
#      This is a limitation of MySQL 5.1, which could be removed in
 
574
#      later releases.
 
575
#------------------------------------------------------------------------
 
576
CREATE TABLE t1 (
 
577
f_int1 INTEGER,
 
578
f_int2 INTEGER,
 
579
f_char1 CHAR(20),
 
580
f_char2 CHAR(20),
 
581
f_charbig VARCHAR(1000),
 
582
PRIMARY KEY (f_int1)
 
583
)
 
584
PARTITION BY RANGE(f_int1) SUBPARTITION BY KEY(f_int1)
 
585
(
 
586
PARTITION part1 VALUES LESS THAN (0)
 
587
(SUBPARTITION subpart1),
 
588
PARTITION part2 VALUES LESS THAN (5)
 
589
(SUBPARTITION subpart1, SUBPARTITION subpart2));
 
590
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near '))' at line 14
 
591
 
 
592
#========================================================================
 
593
#  3   VALUES clauses
 
594
#========================================================================
 
595
#------------------------------------------------------------------------
 
596
#  3.1 The constants in VALUES IN clauses must differ
 
597
#------------------------------------------------------------------------
 
598
CREATE TABLE t1 (
 
599
f_int1 INTEGER,
 
600
f_int2 INTEGER,
 
601
f_char1 CHAR(20),
 
602
f_char2 CHAR(20),
 
603
f_charbig VARCHAR(1000)
 
604
)
 
605
PARTITION BY LIST(MOD(f_int1,2))
 
606
( PARTITION part1 VALUES IN (-1),
 
607
PARTITION part2 VALUES IN (0),
 
608
PARTITION part3 VALUES IN (-1));
 
609
ERROR HY000: Multiple definition of same constant in list partitioning
 
610
CREATE TABLE t1 (f1 BIGINT, f2 BIGINT)
 
611
PARTITION BY RANGE(f1)
 
612
(PARTITION part1 VALUES LESS THAN (0),
 
613
PARTITION part2 VALUES LESS THAN (0),
 
614
PARTITION part3 VALUES LESS THAN (10000));
 
615
ERROR HY000: VALUES LESS THAN value must be strictly increasing for each partition
 
616
#------------------------------------------------------------------------
 
617
#  3.2 The constants in VALUES LESS must be in increasing order
 
618
#------------------------------------------------------------------------
 
619
CREATE TABLE t1 (f1 BIGINT, f2 BIGINT)
 
620
PARTITION BY RANGE(f1)
 
621
(PARTITION part1 VALUES LESS THAN (0),
 
622
PARTITION part2 VALUES LESS THAN (-1),
 
623
PARTITION part3 VALUES LESS THAN (10000));
 
624
ERROR HY000: VALUES LESS THAN value must be strictly increasing for each partition
 
625
#------------------------------------------------------------------------
 
626
#  3.3 LIST partitions must be defined with VALUES IN
 
627
#------------------------------------------------------------------------
 
628
CREATE TABLE t1 (
 
629
f_int1 INTEGER,
 
630
f_int2 INTEGER,
 
631
f_char1 CHAR(20),
 
632
f_char2 CHAR(20),
 
633
f_charbig VARCHAR(1000)
 
634
)
 
635
PARTITION BY LIST(MOD(f_int1,2))
 
636
( PARTITION part1 VALUES LESS THAN (-1),
 
637
PARTITION part2 VALUES LESS THAN (0),
 
638
PARTITION part3 VALUES LESS THAN (1000));
 
639
ERROR HY000: Only RANGE PARTITIONING can use VALUES LESS THAN in partition definition
 
640
#------------------------------------------------------------------------
 
641
#  3.4 RANGE partitions must be defined with VALUES LESS THAN
 
642
#------------------------------------------------------------------------
 
643
CREATE TABLE t1 (
 
644
f_int1 INTEGER,
 
645
f_int2 INTEGER,
 
646
f_char1 CHAR(20),
 
647
f_char2 CHAR(20),
 
648
f_charbig VARCHAR(1000)
 
649
)
 
650
PARTITION BY RANGE(f_int1)
 
651
( PARTITION part1 VALUES IN (-1),
 
652
PARTITION part2 VALUES IN (0),
 
653
PARTITION part3 VALUES IN (1000));
 
654
ERROR HY000: Only LIST PARTITIONING can use VALUES IN in partition definition
 
655
#------------------------------------------------------------------------
 
656
#  3.5 Use of NULL in VALUES clauses
 
657
#------------------------------------------------------------------------
 
658
#  3.5.1 NULL in RANGE partitioning clause
 
659
#  3.5.1.1 VALUE LESS THAN (NULL) is not allowed
 
660
CREATE TABLE t1 (
 
661
f_int1 INTEGER,
 
662
f_int2 INTEGER,
 
663
f_char1 CHAR(20),
 
664
f_char2 CHAR(20),
 
665
f_charbig VARCHAR(1000)
 
666
)
 
667
PARTITION BY RANGE(f_int1)
 
668
( PARTITION part1 VALUES LESS THAN (NULL),
 
669
PARTITION part2 VALUES LESS THAN (1000));
 
670
ERROR 42000: Not allowed to use NULL value in VALUES LESS THAN near '),
 
671
PARTITION part2 VALUES LESS THAN (1000))' at line 9
 
672
#  3.5.1.2 VALUE LESS THAN (CAST(NULL AS SIGNED INTEGER)) is not allowed
 
673
CREATE TABLE t1 (
 
674
f_int1 INTEGER,
 
675
f_int2 INTEGER,
 
676
f_char1 CHAR(20),
 
677
f_char2 CHAR(20),
 
678
f_charbig VARCHAR(1000)
 
679
)
 
680
PARTITION BY RANGE(f_int1)
 
681
( PARTITION part1 VALUES LESS THAN (CAST(NULL AS SIGNED INTEGER)),
 
682
PARTITION part2 VALUES LESS THAN (1000));
 
683
ERROR 42000: Not allowed to use NULL value in VALUES LESS THAN near '),
 
684
PARTITION part2 VALUES LESS THAN (1000))' at line 9
 
685
#  3.5.2 NULL in LIST partitioning clause
 
686
#  3.5.2.1 VALUE IN (NULL)
 
687
CREATE TABLE t1 (
 
688
f_int1 INTEGER,
 
689
f_int2 INTEGER,
 
690
f_char1 CHAR(20),
 
691
f_char2 CHAR(20),
 
692
f_charbig VARCHAR(1000)
 
693
)
 
694
PARTITION BY LIST(MOD(f_int1,2))
 
695
( PARTITION part1 VALUES IN (NULL),
 
696
PARTITION part2 VALUES IN (0),
 
697
PARTITION part3 VALUES IN (1));
 
698
DROP TABLE t1;
 
699
#  3.5.2.2 VALUE IN (CAST(NULL AS SIGNED INTEGER))
 
700
CREATE TABLE t1 (
 
701
f_int1 INTEGER,
 
702
f_int2 INTEGER,
 
703
f_char1 CHAR(20),
 
704
f_char2 CHAR(20),
 
705
f_charbig VARCHAR(1000)
 
706
)
 
707
PARTITION BY LIST(MOD(f_int1,2))
 
708
( PARTITION part1 VALUES IN (CAST(NULL AS SIGNED INTEGER)),
 
709
PARTITION part3 VALUES IN (1));
 
710
create_command
 
711
SHOW CREATE TABLE t1;
 
712
Table   Create Table
 
713
t1      CREATE TABLE `t1` (
 
714
  `f_int1` int(11) DEFAULT NULL,
 
715
  `f_int2` int(11) DEFAULT NULL,
 
716
  `f_char1` char(20) DEFAULT NULL,
 
717
  `f_char2` char(20) DEFAULT NULL,
 
718
  `f_charbig` varchar(1000) DEFAULT NULL
 
719
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY LIST (MOD(f_int1,2)) (PARTITION part1 VALUES IN (NULL) ENGINE = ndbcluster, PARTITION part3 VALUES IN (1) ENGINE = ndbcluster)
 
720
 
 
721
DROP TABLE t1;
 
722
#  3.5.3 Reveal that IN (...NULL) is not mapped to IN(0)
 
723
CREATE TABLE t1 (
 
724
f_int1 INTEGER,
 
725
f_int2 INTEGER,
 
726
f_char1 CHAR(20),
 
727
f_char2 CHAR(20),
 
728
f_charbig VARCHAR(1000)
 
729
)
 
730
PARTITION BY LIST(MOD(f_int1,2))
 
731
( PARTITION part1 VALUES IN (CAST(NULL AS SIGNED INTEGER)),
 
732
PARTITION part2 VALUES IN (0),
 
733
PARTITION part3 VALUES IN (1));
 
734
create_command
 
735
SHOW CREATE TABLE t1;
 
736
Table   Create Table
 
737
t1      CREATE TABLE `t1` (
 
738
  `f_int1` int(11) DEFAULT NULL,
 
739
  `f_int2` int(11) DEFAULT NULL,
 
740
  `f_char1` char(20) DEFAULT NULL,
 
741
  `f_char2` char(20) DEFAULT NULL,
 
742
  `f_charbig` varchar(1000) DEFAULT NULL
 
743
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY LIST (MOD(f_int1,2)) (PARTITION part1 VALUES IN (NULL) ENGINE = ndbcluster, PARTITION part2 VALUES IN (0) ENGINE = ndbcluster, PARTITION part3 VALUES IN (1) ENGINE = ndbcluster)
 
744
 
 
745
DROP TABLE t1;
 
746
 
 
747
#========================================================================
 
748
#  4. Check assigning the number of partitions and subpartitions
 
749
#     with and without named partitions/subpartitions
 
750
#========================================================================
 
751
DROP TABLE IF EXISTS t1;
 
752
#------------------------------------------------------------------------
 
753
# 4.1 (positive) without partition/subpartition number assignment
 
754
#------------------------------------------------------------------------
 
755
# 4.1.1 no partition number, no named partitions
 
756
CREATE TABLE t1 (
 
757
f_int1 INTEGER,
 
758
f_int2 INTEGER,
 
759
f_char1 CHAR(20),
 
760
f_char2 CHAR(20),
 
761
f_charbig VARCHAR(1000)
 
762
)
 
763
PARTITION BY HASH(f_int1);
 
764
create_command
 
765
SHOW CREATE TABLE t1;
 
766
Table   Create Table
 
767
t1      CREATE TABLE `t1` (
 
768
  `f_int1` int(11) DEFAULT NULL,
 
769
  `f_int2` int(11) DEFAULT NULL,
 
770
  `f_char1` char(20) DEFAULT NULL,
 
771
  `f_char2` char(20) DEFAULT NULL,
 
772
  `f_charbig` varchar(1000) DEFAULT NULL
 
773
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH (f_int1) 
 
774
 
 
775
DROP TABLE t1;
 
776
# 4.1.2 no partition number, named partitions
 
777
CREATE TABLE t1 (
 
778
f_int1 INTEGER,
 
779
f_int2 INTEGER,
 
780
f_char1 CHAR(20),
 
781
f_char2 CHAR(20),
 
782
f_charbig VARCHAR(1000)
 
783
)
 
784
PARTITION BY HASH(f_int1) (PARTITION part1, PARTITION part2);
 
785
create_command
 
786
SHOW CREATE TABLE t1;
 
787
Table   Create Table
 
788
t1      CREATE TABLE `t1` (
 
789
  `f_int1` int(11) DEFAULT NULL,
 
790
  `f_int2` int(11) DEFAULT NULL,
 
791
  `f_char1` char(20) DEFAULT NULL,
 
792
  `f_char2` char(20) DEFAULT NULL,
 
793
  `f_charbig` varchar(1000) DEFAULT NULL
 
794
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH (f_int1) (PARTITION part1  ENGINE = ndbcluster, PARTITION part2  ENGINE = ndbcluster)
 
795
 
 
796
DROP TABLE t1;
 
797
# 4.1.3 variations on no partition/subpartition number, named partitions,
 
798
#       different subpartitions are/are not named
 
799
CREATE TABLE t1 (  f_int1 INTEGER,
 
800
f_int2 INTEGER,
 
801
f_char1 CHAR(20),
 
802
f_char2 CHAR(20),
 
803
f_charbig VARCHAR(1000) )
 
804
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1) (PARTITION part1 VALUES LESS THAN (10), PARTITION part2 VALUES LESS THAN (20), PARTITION part3 VALUES LESS THAN (2147483646)) ;
 
805
DROP TABLE t1;
 
806
CREATE TABLE t1 (  f_int1 INTEGER,
 
807
f_int2 INTEGER,
 
808
f_char1 CHAR(20),
 
809
f_char2 CHAR(20),
 
810
f_charbig VARCHAR(1000) )
 
811
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1) (PARTITION part1 VALUES LESS THAN (10), PARTITION part2 VALUES LESS THAN (20), PARTITION part3 VALUES LESS THAN (2147483646)
 
812
(SUBPARTITION subpart31 , SUBPARTITION subpart32 )) ;
 
813
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near '))' at line 7
 
814
CREATE TABLE t1 (  f_int1 INTEGER,
 
815
f_int2 INTEGER,
 
816
f_char1 CHAR(20),
 
817
f_char2 CHAR(20),
 
818
f_charbig VARCHAR(1000) )
 
819
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1) (PARTITION part1 VALUES LESS THAN (10), PARTITION part2 VALUES LESS THAN (20)
 
820
(SUBPARTITION subpart21 , SUBPARTITION subpart22 ), PARTITION part3 VALUES LESS THAN (2147483646)) ;
 
821
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near '), PARTITION part3 VALUES LESS THAN (2147483646))' at line 7
 
822
CREATE TABLE t1 (  f_int1 INTEGER,
 
823
f_int2 INTEGER,
 
824
f_char1 CHAR(20),
 
825
f_char2 CHAR(20),
 
826
f_charbig VARCHAR(1000) )
 
827
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1) (PARTITION part1 VALUES LESS THAN (10), PARTITION part2 VALUES LESS THAN (20)
 
828
(SUBPARTITION subpart21 , SUBPARTITION subpart22 ), PARTITION part3 VALUES LESS THAN (2147483646)
 
829
(SUBPARTITION subpart31 , SUBPARTITION subpart32 )) ;
 
830
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near '), PARTITION part3 VALUES LESS THAN (2147483646)
 
831
(SUBPARTITION subpart31 , SUBPA' at line 7
 
832
CREATE TABLE t1 (  f_int1 INTEGER,
 
833
f_int2 INTEGER,
 
834
f_char1 CHAR(20),
 
835
f_char2 CHAR(20),
 
836
f_charbig VARCHAR(1000) )
 
837
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1) (PARTITION part1 VALUES LESS THAN (10)
 
838
(SUBPARTITION subpart11 , SUBPARTITION subpart12 ), PARTITION part2 VALUES LESS THAN (20), PARTITION part3 VALUES LESS THAN (2147483646)) ;
 
839
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near ' PARTITION part3 VALUES LESS THAN (2147483646))' at line 7
 
840
CREATE TABLE t1 (  f_int1 INTEGER,
 
841
f_int2 INTEGER,
 
842
f_char1 CHAR(20),
 
843
f_char2 CHAR(20),
 
844
f_charbig VARCHAR(1000) )
 
845
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1) (PARTITION part1 VALUES LESS THAN (10)
 
846
(SUBPARTITION subpart11 , SUBPARTITION subpart12 ), PARTITION part2 VALUES LESS THAN (20), PARTITION part3 VALUES LESS THAN (2147483646)
 
847
(SUBPARTITION subpart31 , SUBPARTITION subpart32 )) ;
 
848
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near ' PARTITION part3 VALUES LESS THAN (2147483646)
 
849
(SUBPARTITION subpart31 , SUBPART' at line 7
 
850
CREATE TABLE t1 (  f_int1 INTEGER,
 
851
f_int2 INTEGER,
 
852
f_char1 CHAR(20),
 
853
f_char2 CHAR(20),
 
854
f_charbig VARCHAR(1000) )
 
855
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1) (PARTITION part1 VALUES LESS THAN (10)
 
856
(SUBPARTITION subpart11 , SUBPARTITION subpart12 ), PARTITION part2 VALUES LESS THAN (20)
 
857
(SUBPARTITION subpart21 , SUBPARTITION subpart22 ), PARTITION part3 VALUES LESS THAN (2147483646)) ;
 
858
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near ')' at line 8
 
859
CREATE TABLE t1 (  f_int1 INTEGER,
 
860
f_int2 INTEGER,
 
861
f_char1 CHAR(20),
 
862
f_char2 CHAR(20),
 
863
f_charbig VARCHAR(1000) )
 
864
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1) (PARTITION part1 VALUES LESS THAN (10)
 
865
(SUBPARTITION subpart11 , SUBPARTITION subpart12 ), PARTITION part2 VALUES LESS THAN (20)
 
866
(SUBPARTITION subpart21 , SUBPARTITION subpart22 ), PARTITION part3 VALUES LESS THAN (2147483646)
 
867
(SUBPARTITION subpart31 , SUBPARTITION subpart32 )) ;
 
868
create_command
 
869
SHOW CREATE TABLE t1;
 
870
Table   Create Table
 
871
t1      CREATE TABLE `t1` (
 
872
  `f_int1` int(11) DEFAULT NULL,
 
873
  `f_int2` int(11) DEFAULT NULL,
 
874
  `f_char1` char(20) DEFAULT NULL,
 
875
  `f_char2` char(20) DEFAULT NULL,
 
876
  `f_charbig` varchar(1000) DEFAULT NULL
 
877
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int1) (PARTITION part1 VALUES LESS THAN (10)  (SUBPARTITION subpart11 ENGINE = ndbcluster, SUBPARTITION subpart12 ENGINE = ndbcluster), PARTITION part2 VALUES LESS THAN (20)  (SUBPARTITION subpart21 ENGINE = ndbcluster, SUBPARTITION subpart22 ENGINE = ndbcluster), PARTITION part3 VALUES LESS THAN (2147483646)  (SUBPARTITION subpart31 ENGINE = ndbcluster, SUBPARTITION subpart32 ENGINE = ndbcluster))
 
878
 
 
879
DROP TABLE t1;
 
880
#------------------------------------------------------------------------
 
881
# 4.2 partition/subpartition numbers good and bad values and notations
 
882
#------------------------------------------------------------------------
 
883
DROP TABLE IF EXISTS t1;
 
884
# 4.2.1 partition/subpartition numbers INTEGER notation
 
885
CREATE TABLE t1 (
 
886
f_int1 INTEGER,
 
887
f_int2 INTEGER,
 
888
f_char1 CHAR(20),
 
889
f_char2 CHAR(20),
 
890
f_charbig VARCHAR(1000)
 
891
)
 
892
PARTITION BY HASH(f_int1) PARTITIONS 2;
 
893
create_command
 
894
SHOW CREATE TABLE t1;
 
895
Table   Create Table
 
896
t1      CREATE TABLE `t1` (
 
897
  `f_int1` int(11) DEFAULT NULL,
 
898
  `f_int2` int(11) DEFAULT NULL,
 
899
  `f_char1` char(20) DEFAULT NULL,
 
900
  `f_char2` char(20) DEFAULT NULL,
 
901
  `f_charbig` varchar(1000) DEFAULT NULL
 
902
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH (f_int1) PARTITIONS 2 
 
903
 
 
904
DROP TABLE t1;
 
905
CREATE TABLE t1 (
 
906
f_int1 INTEGER,
 
907
f_int2 INTEGER,
 
908
f_char1 CHAR(20),
 
909
f_char2 CHAR(20),
 
910
f_charbig VARCHAR(1000)
 
911
)
 
912
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1)
 
913
SUBPARTITIONS 2
 
914
(PARTITION part1 VALUES LESS THAN (10),
 
915
PARTITION part2 VALUES LESS THAN (2147483646));
 
916
create_command
 
917
SHOW CREATE TABLE t1;
 
918
Table   Create Table
 
919
t1      CREATE TABLE `t1` (
 
920
  `f_int1` int(11) DEFAULT NULL,
 
921
  `f_int2` int(11) DEFAULT NULL,
 
922
  `f_char1` char(20) DEFAULT NULL,
 
923
  `f_char2` char(20) DEFAULT NULL,
 
924
  `f_charbig` varchar(1000) DEFAULT NULL
 
925
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION part1 VALUES LESS THAN (10) , PARTITION part2 VALUES LESS THAN (2147483646) )
 
926
 
 
927
DROP TABLE t1;
 
928
CREATE TABLE t1 (
 
929
f_int1 INTEGER,
 
930
f_int2 INTEGER,
 
931
f_char1 CHAR(20),
 
932
f_char2 CHAR(20),
 
933
f_charbig VARCHAR(1000)
 
934
)
 
935
PARTITION BY HASH(f_int1) PARTITIONS 1;
 
936
create_command
 
937
SHOW CREATE TABLE t1;
 
938
Table   Create Table
 
939
t1      CREATE TABLE `t1` (
 
940
  `f_int1` int(11) DEFAULT NULL,
 
941
  `f_int2` int(11) DEFAULT NULL,
 
942
  `f_char1` char(20) DEFAULT NULL,
 
943
  `f_char2` char(20) DEFAULT NULL,
 
944
  `f_charbig` varchar(1000) DEFAULT NULL
 
945
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH (f_int1) PARTITIONS 1 
 
946
 
 
947
DROP TABLE t1;
 
948
CREATE TABLE t1 (
 
949
f_int1 INTEGER,
 
950
f_int2 INTEGER,
 
951
f_char1 CHAR(20),
 
952
f_char2 CHAR(20),
 
953
f_charbig VARCHAR(1000)
 
954
)
 
955
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1)
 
956
SUBPARTITIONS 1
 
957
(PARTITION part1 VALUES LESS THAN (10),
 
958
PARTITION part2 VALUES LESS THAN (2147483646));
 
959
create_command
 
960
SHOW CREATE TABLE t1;
 
961
Table   Create Table
 
962
t1      CREATE TABLE `t1` (
 
963
  `f_int1` int(11) DEFAULT NULL,
 
964
  `f_int2` int(11) DEFAULT NULL,
 
965
  `f_char1` char(20) DEFAULT NULL,
 
966
  `f_char2` char(20) DEFAULT NULL,
 
967
  `f_charbig` varchar(1000) DEFAULT NULL
 
968
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 1 (PARTITION part1 VALUES LESS THAN (10) , PARTITION part2 VALUES LESS THAN (2147483646) )
 
969
 
 
970
DROP TABLE t1;
 
971
CREATE TABLE t1 (
 
972
f_int1 INTEGER,
 
973
f_int2 INTEGER,
 
974
f_char1 CHAR(20),
 
975
f_char2 CHAR(20),
 
976
f_charbig VARCHAR(1000)
 
977
)
 
978
PARTITION BY HASH(f_int1) PARTITIONS 0;
 
979
ERROR HY000: Number of partitions = 0 is not an allowed value
 
980
CREATE TABLE t1 (
 
981
f_int1 INTEGER,
 
982
f_int2 INTEGER,
 
983
f_char1 CHAR(20),
 
984
f_char2 CHAR(20),
 
985
f_charbig VARCHAR(1000)
 
986
)
 
987
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1)
 
988
SUBPARTITIONS 0
 
989
(PARTITION part1 VALUES LESS THAN (10),
 
990
PARTITION part2 VALUES LESS THAN (2147483646));
 
991
ERROR HY000: Number of subpartitions = 0 is not an allowed value
 
992
CREATE TABLE t1 (
 
993
f_int1 INTEGER,
 
994
f_int2 INTEGER,
 
995
f_char1 CHAR(20),
 
996
f_char2 CHAR(20),
 
997
f_charbig VARCHAR(1000)
 
998
)
 
999
PARTITION BY HASH(f_int1) PARTITIONS -1;
 
1000
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-1' at line 8
 
1001
CREATE TABLE t1 (
 
1002
f_int1 INTEGER,
 
1003
f_int2 INTEGER,
 
1004
f_char1 CHAR(20),
 
1005
f_char2 CHAR(20),
 
1006
f_charbig VARCHAR(1000)
 
1007
)
 
1008
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1)
 
1009
SUBPARTITIONS -1
 
1010
(PARTITION part1 VALUES LESS THAN (10),
 
1011
PARTITION part2 VALUES LESS THAN (2147483646));
 
1012
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-1
 
1013
(PARTITION part1 VALUES LESS THAN (10),
 
1014
PARTITION part2 VALUES LESS THAN (214' at line 9
 
1015
CREATE TABLE t1 (
 
1016
f_int1 INTEGER,
 
1017
f_int2 INTEGER,
 
1018
f_char1 CHAR(20),
 
1019
f_char2 CHAR(20),
 
1020
f_charbig VARCHAR(1000)
 
1021
)
 
1022
PARTITION BY HASH(f_int1) PARTITIONS 1000000;
 
1023
ERROR HY000: Too many partitions (including subpartitions) were defined
 
1024
CREATE TABLE t1 (
 
1025
f_int1 INTEGER,
 
1026
f_int2 INTEGER,
 
1027
f_char1 CHAR(20),
 
1028
f_char2 CHAR(20),
 
1029
f_charbig VARCHAR(1000)
 
1030
)
 
1031
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1)
 
1032
SUBPARTITIONS 1000000
 
1033
(PARTITION part1 VALUES LESS THAN (10),
 
1034
PARTITION part2 VALUES LESS THAN (2147483646));
 
1035
ERROR HY000: Too many partitions (including subpartitions) were defined
 
1036
# 4.2.2 partition/subpartition numbers DECIMAL notation
 
1037
CREATE TABLE t1 (
 
1038
f_int1 INTEGER,
 
1039
f_int2 INTEGER,
 
1040
f_char1 CHAR(20),
 
1041
f_char2 CHAR(20),
 
1042
f_charbig VARCHAR(1000)
 
1043
)
 
1044
PARTITION BY HASH(f_int1) PARTITIONS 2.0;
 
1045
create_command
 
1046
SHOW CREATE TABLE t1;
 
1047
Table   Create Table
 
1048
t1      CREATE TABLE `t1` (
 
1049
  `f_int1` int(11) DEFAULT NULL,
 
1050
  `f_int2` int(11) DEFAULT NULL,
 
1051
  `f_char1` char(20) DEFAULT NULL,
 
1052
  `f_char2` char(20) DEFAULT NULL,
 
1053
  `f_charbig` varchar(1000) DEFAULT NULL
 
1054
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH (f_int1) PARTITIONS 2 
 
1055
 
 
1056
DROP TABLE t1;
 
1057
CREATE TABLE t1 (
 
1058
f_int1 INTEGER,
 
1059
f_int2 INTEGER,
 
1060
f_char1 CHAR(20),
 
1061
f_char2 CHAR(20),
 
1062
f_charbig VARCHAR(1000)
 
1063
)
 
1064
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1)
 
1065
SUBPARTITIONS 2.0
 
1066
(PARTITION part1 VALUES LESS THAN (10),
 
1067
PARTITION part2 VALUES LESS THAN (2147483646));
 
1068
create_command
 
1069
SHOW CREATE TABLE t1;
 
1070
Table   Create Table
 
1071
t1      CREATE TABLE `t1` (
 
1072
  `f_int1` int(11) DEFAULT NULL,
 
1073
  `f_int2` int(11) DEFAULT NULL,
 
1074
  `f_char1` char(20) DEFAULT NULL,
 
1075
  `f_char2` char(20) DEFAULT NULL,
 
1076
  `f_charbig` varchar(1000) DEFAULT NULL
 
1077
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION part1 VALUES LESS THAN (10) , PARTITION part2 VALUES LESS THAN (2147483646) )
 
1078
 
 
1079
DROP TABLE t1;
 
1080
CREATE TABLE t1 (
 
1081
f_int1 INTEGER,
 
1082
f_int2 INTEGER,
 
1083
f_char1 CHAR(20),
 
1084
f_char2 CHAR(20),
 
1085
f_charbig VARCHAR(1000)
 
1086
)
 
1087
PARTITION BY HASH(f_int1) PARTITIONS -2.0;
 
1088
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-2.0' at line 8
 
1089
CREATE TABLE t1 (
 
1090
f_int1 INTEGER,
 
1091
f_int2 INTEGER,
 
1092
f_char1 CHAR(20),
 
1093
f_char2 CHAR(20),
 
1094
f_charbig VARCHAR(1000)
 
1095
)
 
1096
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1)
 
1097
SUBPARTITIONS -2.0
 
1098
(PARTITION part1 VALUES LESS THAN (10),
 
1099
PARTITION part2 VALUES LESS THAN (2147483646));
 
1100
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-2.0
 
1101
(PARTITION part1 VALUES LESS THAN (10),
 
1102
PARTITION part2 VALUES LESS THAN (2' at line 9
 
1103
CREATE TABLE t1 (
 
1104
f_int1 INTEGER,
 
1105
f_int2 INTEGER,
 
1106
f_char1 CHAR(20),
 
1107
f_char2 CHAR(20),
 
1108
f_charbig VARCHAR(1000)
 
1109
)
 
1110
PARTITION BY HASH(f_int1) PARTITIONS 0.0;
 
1111
ERROR HY000: Number of partitions = 0 is not an allowed value
 
1112
CREATE TABLE t1 (
 
1113
f_int1 INTEGER,
 
1114
f_int2 INTEGER,
 
1115
f_char1 CHAR(20),
 
1116
f_char2 CHAR(20),
 
1117
f_charbig VARCHAR(1000)
 
1118
)
 
1119
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1)
 
1120
SUBPARTITIONS 0.0
 
1121
(PARTITION part1 VALUES LESS THAN (10),
 
1122
PARTITION part2 VALUES LESS THAN (2147483646));
 
1123
ERROR HY000: Number of subpartitions = 0 is not an allowed value
 
1124
CREATE TABLE t1 (
 
1125
f_int1 INTEGER,
 
1126
f_int2 INTEGER,
 
1127
f_char1 CHAR(20),
 
1128
f_char2 CHAR(20),
 
1129
f_charbig VARCHAR(1000)
 
1130
)
 
1131
PARTITION BY HASH(f_int1) PARTITIONS 999999999999999999999999999999.999999999999999999999999999999;
 
1132
ERROR HY000: Too many partitions (including subpartitions) were defined
 
1133
CREATE TABLE t1 (
 
1134
f_int1 INTEGER,
 
1135
f_int2 INTEGER,
 
1136
f_char1 CHAR(20),
 
1137
f_char2 CHAR(20),
 
1138
f_charbig VARCHAR(1000)
 
1139
)
 
1140
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1)
 
1141
SUBPARTITIONS 999999999999999999999999999999.999999999999999999999999999999
 
1142
(PARTITION part1 VALUES LESS THAN (10),
 
1143
PARTITION part2 VALUES LESS THAN (2147483646));
 
1144
ERROR HY000: Too many partitions (including subpartitions) were defined
 
1145
CREATE TABLE t1 (
 
1146
f_int1 INTEGER,
 
1147
f_int2 INTEGER,
 
1148
f_char1 CHAR(20),
 
1149
f_char2 CHAR(20),
 
1150
f_charbig VARCHAR(1000)
 
1151
)
 
1152
PARTITION BY HASH(f_int1) PARTITIONS 0.000000000000000000000000000001;
 
1153
ERROR HY000: Number of partitions = 0 is not an allowed value
 
1154
CREATE TABLE t1 (
 
1155
f_int1 INTEGER,
 
1156
f_int2 INTEGER,
 
1157
f_char1 CHAR(20),
 
1158
f_char2 CHAR(20),
 
1159
f_charbig VARCHAR(1000)
 
1160
)
 
1161
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1)
 
1162
SUBPARTITIONS 0.000000000000000000000000000001
 
1163
(PARTITION part1 VALUES LESS THAN (10),
 
1164
PARTITION part2 VALUES LESS THAN (2147483646));
 
1165
ERROR HY000: Number of subpartitions = 0 is not an allowed value
 
1166
# 4.2.3 partition/subpartition numbers FLOAT notation
 
1167
CREATE TABLE t1 (
 
1168
f_int1 INTEGER,
 
1169
f_int2 INTEGER,
 
1170
f_char1 CHAR(20),
 
1171
f_char2 CHAR(20),
 
1172
f_charbig VARCHAR(1000)
 
1173
)
 
1174
PARTITION BY HASH(f_int1) PARTITIONS 2.0E+0;
 
1175
create_command
 
1176
SHOW CREATE TABLE t1;
 
1177
Table   Create Table
 
1178
t1      CREATE TABLE `t1` (
 
1179
  `f_int1` int(11) DEFAULT NULL,
 
1180
  `f_int2` int(11) DEFAULT NULL,
 
1181
  `f_char1` char(20) DEFAULT NULL,
 
1182
  `f_char2` char(20) DEFAULT NULL,
 
1183
  `f_charbig` varchar(1000) DEFAULT NULL
 
1184
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH (f_int1) PARTITIONS 2 
 
1185
 
 
1186
DROP TABLE t1;
 
1187
CREATE TABLE t1 (
 
1188
f_int1 INTEGER,
 
1189
f_int2 INTEGER,
 
1190
f_char1 CHAR(20),
 
1191
f_char2 CHAR(20),
 
1192
f_charbig VARCHAR(1000)
 
1193
)
 
1194
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1)
 
1195
SUBPARTITIONS 2.0E+0
 
1196
(PARTITION part1 VALUES LESS THAN (10),
 
1197
PARTITION part2 VALUES LESS THAN (2147483646));
 
1198
create_command
 
1199
SHOW CREATE TABLE t1;
 
1200
Table   Create Table
 
1201
t1      CREATE TABLE `t1` (
 
1202
  `f_int1` int(11) DEFAULT NULL,
 
1203
  `f_int2` int(11) DEFAULT NULL,
 
1204
  `f_char1` char(20) DEFAULT NULL,
 
1205
  `f_char2` char(20) DEFAULT NULL,
 
1206
  `f_charbig` varchar(1000) DEFAULT NULL
 
1207
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION part1 VALUES LESS THAN (10) , PARTITION part2 VALUES LESS THAN (2147483646) )
 
1208
 
 
1209
DROP TABLE t1;
 
1210
CREATE TABLE t1 (
 
1211
f_int1 INTEGER,
 
1212
f_int2 INTEGER,
 
1213
f_char1 CHAR(20),
 
1214
f_char2 CHAR(20),
 
1215
f_charbig VARCHAR(1000)
 
1216
)
 
1217
PARTITION BY HASH(f_int1) PARTITIONS -2.0E+0;
 
1218
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-2.0E+0' at line 8
 
1219
CREATE TABLE t1 (
 
1220
f_int1 INTEGER,
 
1221
f_int2 INTEGER,
 
1222
f_char1 CHAR(20),
 
1223
f_char2 CHAR(20),
 
1224
f_charbig VARCHAR(1000)
 
1225
)
 
1226
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1)
 
1227
SUBPARTITIONS -2.0E+0
 
1228
(PARTITION part1 VALUES LESS THAN (10),
 
1229
PARTITION part2 VALUES LESS THAN (2147483646));
 
1230
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-2.0E+0
 
1231
(PARTITION part1 VALUES LESS THAN (10),
 
1232
PARTITION part2 VALUES LESS THAN' at line 9
 
1233
CREATE TABLE t1 (
 
1234
f_int1 INTEGER,
 
1235
f_int2 INTEGER,
 
1236
f_char1 CHAR(20),
 
1237
f_char2 CHAR(20),
 
1238
f_charbig VARCHAR(1000)
 
1239
)
 
1240
PARTITION BY HASH(f_int1) PARTITIONS 0.0E+300;
 
1241
ERROR HY000: Number of partitions = 0 is not an allowed value
 
1242
CREATE TABLE t1 (
 
1243
f_int1 INTEGER,
 
1244
f_int2 INTEGER,
 
1245
f_char1 CHAR(20),
 
1246
f_char2 CHAR(20),
 
1247
f_charbig VARCHAR(1000)
 
1248
)
 
1249
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1)
 
1250
SUBPARTITIONS 0.0E+300
 
1251
(PARTITION part1 VALUES LESS THAN (10),
 
1252
PARTITION part2 VALUES LESS THAN (2147483646));
 
1253
ERROR HY000: Number of subpartitions = 0 is not an allowed value
 
1254
# 4.2.4 partition/subpartition numbers STRING notation
 
1255
CREATE TABLE t1 (
 
1256
f_int1 INTEGER,
 
1257
f_int2 INTEGER,
 
1258
f_char1 CHAR(20),
 
1259
f_char2 CHAR(20),
 
1260
f_charbig VARCHAR(1000)
 
1261
)
 
1262
PARTITION BY HASH(f_int1) PARTITIONS '2';
 
1263
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''2'' at line 8
 
1264
CREATE TABLE t1 (
 
1265
f_int1 INTEGER,
 
1266
f_int2 INTEGER,
 
1267
f_char1 CHAR(20),
 
1268
f_char2 CHAR(20),
 
1269
f_charbig VARCHAR(1000)
 
1270
)
 
1271
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1)
 
1272
SUBPARTITIONS '2'
 
1273
(PARTITION part1 VALUES LESS THAN (10),
 
1274
PARTITION part2 VALUES LESS THAN (2147483646));
 
1275
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''2'
 
1276
(PARTITION part1 VALUES LESS THAN (10),
 
1277
PARTITION part2 VALUES LESS THAN (21' at line 9
 
1278
CREATE TABLE t1 (
 
1279
f_int1 INTEGER,
 
1280
f_int2 INTEGER,
 
1281
f_char1 CHAR(20),
 
1282
f_char2 CHAR(20),
 
1283
f_charbig VARCHAR(1000)
 
1284
)
 
1285
PARTITION BY HASH(f_int1) PARTITIONS '2.0';
 
1286
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''2.0'' at line 8
 
1287
CREATE TABLE t1 (
 
1288
f_int1 INTEGER,
 
1289
f_int2 INTEGER,
 
1290
f_char1 CHAR(20),
 
1291
f_char2 CHAR(20),
 
1292
f_charbig VARCHAR(1000)
 
1293
)
 
1294
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1)
 
1295
SUBPARTITIONS '2.0'
 
1296
(PARTITION part1 VALUES LESS THAN (10),
 
1297
PARTITION part2 VALUES LESS THAN (2147483646));
 
1298
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''2.0'
 
1299
(PARTITION part1 VALUES LESS THAN (10),
 
1300
PARTITION part2 VALUES LESS THAN (' at line 9
 
1301
CREATE TABLE t1 (
 
1302
f_int1 INTEGER,
 
1303
f_int2 INTEGER,
 
1304
f_char1 CHAR(20),
 
1305
f_char2 CHAR(20),
 
1306
f_charbig VARCHAR(1000)
 
1307
)
 
1308
PARTITION BY HASH(f_int1) PARTITIONS '0.2E+1';
 
1309
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''0.2E+1'' at line 8
 
1310
CREATE TABLE t1 (
 
1311
f_int1 INTEGER,
 
1312
f_int2 INTEGER,
 
1313
f_char1 CHAR(20),
 
1314
f_char2 CHAR(20),
 
1315
f_charbig VARCHAR(1000)
 
1316
)
 
1317
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1)
 
1318
SUBPARTITIONS '0.2E+1'
 
1319
(PARTITION part1 VALUES LESS THAN (10),
 
1320
PARTITION part2 VALUES LESS THAN (2147483646));
 
1321
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''0.2E+1'
 
1322
(PARTITION part1 VALUES LESS THAN (10),
 
1323
PARTITION part2 VALUES LESS THA' at line 9
 
1324
CREATE TABLE t1 (
 
1325
f_int1 INTEGER,
 
1326
f_int2 INTEGER,
 
1327
f_char1 CHAR(20),
 
1328
f_char2 CHAR(20),
 
1329
f_charbig VARCHAR(1000)
 
1330
)
 
1331
PARTITION BY HASH(f_int1) PARTITIONS '2A';
 
1332
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''2A'' at line 8
 
1333
CREATE TABLE t1 (
 
1334
f_int1 INTEGER,
 
1335
f_int2 INTEGER,
 
1336
f_char1 CHAR(20),
 
1337
f_char2 CHAR(20),
 
1338
f_charbig VARCHAR(1000)
 
1339
)
 
1340
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1)
 
1341
SUBPARTITIONS '2A'
 
1342
(PARTITION part1 VALUES LESS THAN (10),
 
1343
PARTITION part2 VALUES LESS THAN (2147483646));
 
1344
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''2A'
 
1345
(PARTITION part1 VALUES LESS THAN (10),
 
1346
PARTITION part2 VALUES LESS THAN (2' at line 9
 
1347
CREATE TABLE t1 (
 
1348
f_int1 INTEGER,
 
1349
f_int2 INTEGER,
 
1350
f_char1 CHAR(20),
 
1351
f_char2 CHAR(20),
 
1352
f_charbig VARCHAR(1000)
 
1353
)
 
1354
PARTITION BY HASH(f_int1) PARTITIONS 'A2';
 
1355
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''A2'' at line 8
 
1356
CREATE TABLE t1 (
 
1357
f_int1 INTEGER,
 
1358
f_int2 INTEGER,
 
1359
f_char1 CHAR(20),
 
1360
f_char2 CHAR(20),
 
1361
f_charbig VARCHAR(1000)
 
1362
)
 
1363
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1)
 
1364
SUBPARTITIONS 'A2'
 
1365
(PARTITION part1 VALUES LESS THAN (10),
 
1366
PARTITION part2 VALUES LESS THAN (2147483646));
 
1367
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''A2'
 
1368
(PARTITION part1 VALUES LESS THAN (10),
 
1369
PARTITION part2 VALUES LESS THAN (2' at line 9
 
1370
CREATE TABLE t1 (
 
1371
f_int1 INTEGER,
 
1372
f_int2 INTEGER,
 
1373
f_char1 CHAR(20),
 
1374
f_char2 CHAR(20),
 
1375
f_charbig VARCHAR(1000)
 
1376
)
 
1377
PARTITION BY HASH(f_int1) PARTITIONS '';
 
1378
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '''' at line 8
 
1379
CREATE TABLE t1 (
 
1380
f_int1 INTEGER,
 
1381
f_int2 INTEGER,
 
1382
f_char1 CHAR(20),
 
1383
f_char2 CHAR(20),
 
1384
f_charbig VARCHAR(1000)
 
1385
)
 
1386
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1)
 
1387
SUBPARTITIONS ''
 
1388
(PARTITION part1 VALUES LESS THAN (10),
 
1389
PARTITION part2 VALUES LESS THAN (2147483646));
 
1390
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '''
 
1391
(PARTITION part1 VALUES LESS THAN (10),
 
1392
PARTITION part2 VALUES LESS THAN (214' at line 9
 
1393
CREATE TABLE t1 (
 
1394
f_int1 INTEGER,
 
1395
f_int2 INTEGER,
 
1396
f_char1 CHAR(20),
 
1397
f_char2 CHAR(20),
 
1398
f_charbig VARCHAR(1000)
 
1399
)
 
1400
PARTITION BY HASH(f_int1) PARTITIONS 'GARBAGE';
 
1401
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''GARBAGE'' at line 8
 
1402
CREATE TABLE t1 (
 
1403
f_int1 INTEGER,
 
1404
f_int2 INTEGER,
 
1405
f_char1 CHAR(20),
 
1406
f_char2 CHAR(20),
 
1407
f_charbig VARCHAR(1000)
 
1408
)
 
1409
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1)
 
1410
SUBPARTITIONS 'GARBAGE'
 
1411
(PARTITION part1 VALUES LESS THAN (10),
 
1412
PARTITION part2 VALUES LESS THAN (2147483646));
 
1413
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''GARBAGE'
 
1414
(PARTITION part1 VALUES LESS THAN (10),
 
1415
PARTITION part2 VALUES LESS TH' at line 9
 
1416
# 4.2.5 partition/subpartition numbers other notations
 
1417
CREATE TABLE t1 (
 
1418
f_int1 INTEGER,
 
1419
f_int2 INTEGER,
 
1420
f_char1 CHAR(20),
 
1421
f_char2 CHAR(20),
 
1422
f_charbig VARCHAR(1000)
 
1423
)
 
1424
PARTITION BY HASH(f_int1) PARTITIONS 2A;
 
1425
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '2A' at line 8
 
1426
CREATE TABLE t1 (
 
1427
f_int1 INTEGER,
 
1428
f_int2 INTEGER,
 
1429
f_char1 CHAR(20),
 
1430
f_char2 CHAR(20),
 
1431
f_charbig VARCHAR(1000)
 
1432
)
 
1433
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1)
 
1434
SUBPARTITIONS 2A
 
1435
(PARTITION part1 VALUES LESS THAN (10),
 
1436
PARTITION part2 VALUES LESS THAN (2147483646));
 
1437
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '2A
 
1438
(PARTITION part1 VALUES LESS THAN (10),
 
1439
PARTITION part2 VALUES LESS THAN (214' at line 9
 
1440
CREATE TABLE t1 (
 
1441
f_int1 INTEGER,
 
1442
f_int2 INTEGER,
 
1443
f_char1 CHAR(20),
 
1444
f_char2 CHAR(20),
 
1445
f_charbig VARCHAR(1000)
 
1446
)
 
1447
PARTITION BY HASH(f_int1) PARTITIONS A2;
 
1448
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'A2' at line 8
 
1449
CREATE TABLE t1 (
 
1450
f_int1 INTEGER,
 
1451
f_int2 INTEGER,
 
1452
f_char1 CHAR(20),
 
1453
f_char2 CHAR(20),
 
1454
f_charbig VARCHAR(1000)
 
1455
)
 
1456
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1)
 
1457
SUBPARTITIONS A2
 
1458
(PARTITION part1 VALUES LESS THAN (10),
 
1459
PARTITION part2 VALUES LESS THAN (2147483646));
 
1460
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'A2
 
1461
(PARTITION part1 VALUES LESS THAN (10),
 
1462
PARTITION part2 VALUES LESS THAN (214' at line 9
 
1463
CREATE TABLE t1 (
 
1464
f_int1 INTEGER,
 
1465
f_int2 INTEGER,
 
1466
f_char1 CHAR(20),
 
1467
f_char2 CHAR(20),
 
1468
f_charbig VARCHAR(1000)
 
1469
)
 
1470
PARTITION BY HASH(f_int1) PARTITIONS GARBAGE;
 
1471
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'GARBAGE' at line 8
 
1472
CREATE TABLE t1 (
 
1473
f_int1 INTEGER,
 
1474
f_int2 INTEGER,
 
1475
f_char1 CHAR(20),
 
1476
f_char2 CHAR(20),
 
1477
f_charbig VARCHAR(1000)
 
1478
)
 
1479
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1)
 
1480
SUBPARTITIONS GARBAGE
 
1481
(PARTITION part1 VALUES LESS THAN (10),
 
1482
PARTITION part2 VALUES LESS THAN (2147483646));
 
1483
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'GARBAGE
 
1484
(PARTITION part1 VALUES LESS THAN (10),
 
1485
PARTITION part2 VALUES LESS THAN' at line 9
 
1486
CREATE TABLE t1 (
 
1487
f_int1 INTEGER,
 
1488
f_int2 INTEGER,
 
1489
f_char1 CHAR(20),
 
1490
f_char2 CHAR(20),
 
1491
f_charbig VARCHAR(1000)
 
1492
)
 
1493
PARTITION BY HASH(f_int1) PARTITIONS "2";
 
1494
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"2"' at line 8
 
1495
CREATE TABLE t1 (
 
1496
f_int1 INTEGER,
 
1497
f_int2 INTEGER,
 
1498
f_char1 CHAR(20),
 
1499
f_char2 CHAR(20),
 
1500
f_charbig VARCHAR(1000)
 
1501
)
 
1502
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1)
 
1503
SUBPARTITIONS "2"
 
1504
(PARTITION part1 VALUES LESS THAN (10),
 
1505
PARTITION part2 VALUES LESS THAN (2147483646));
 
1506
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"2"
 
1507
(PARTITION part1 VALUES LESS THAN (10),
 
1508
PARTITION part2 VALUES LESS THAN (21' at line 9
 
1509
CREATE TABLE t1 (
 
1510
f_int1 INTEGER,
 
1511
f_int2 INTEGER,
 
1512
f_char1 CHAR(20),
 
1513
f_char2 CHAR(20),
 
1514
f_charbig VARCHAR(1000)
 
1515
)
 
1516
PARTITION BY HASH(f_int1) PARTITIONS "2A";
 
1517
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"2A"' at line 8
 
1518
CREATE TABLE t1 (
 
1519
f_int1 INTEGER,
 
1520
f_int2 INTEGER,
 
1521
f_char1 CHAR(20),
 
1522
f_char2 CHAR(20),
 
1523
f_charbig VARCHAR(1000)
 
1524
)
 
1525
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1)
 
1526
SUBPARTITIONS "2A"
 
1527
(PARTITION part1 VALUES LESS THAN (10),
 
1528
PARTITION part2 VALUES LESS THAN (2147483646));
 
1529
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"2A"
 
1530
(PARTITION part1 VALUES LESS THAN (10),
 
1531
PARTITION part2 VALUES LESS THAN (2' at line 9
 
1532
CREATE TABLE t1 (
 
1533
f_int1 INTEGER,
 
1534
f_int2 INTEGER,
 
1535
f_char1 CHAR(20),
 
1536
f_char2 CHAR(20),
 
1537
f_charbig VARCHAR(1000)
 
1538
)
 
1539
PARTITION BY HASH(f_int1) PARTITIONS "A2";
 
1540
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"A2"' at line 8
 
1541
CREATE TABLE t1 (
 
1542
f_int1 INTEGER,
 
1543
f_int2 INTEGER,
 
1544
f_char1 CHAR(20),
 
1545
f_char2 CHAR(20),
 
1546
f_charbig VARCHAR(1000)
 
1547
)
 
1548
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1)
 
1549
SUBPARTITIONS "A2"
 
1550
(PARTITION part1 VALUES LESS THAN (10),
 
1551
PARTITION part2 VALUES LESS THAN (2147483646));
 
1552
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"A2"
 
1553
(PARTITION part1 VALUES LESS THAN (10),
 
1554
PARTITION part2 VALUES LESS THAN (2' at line 9
 
1555
CREATE TABLE t1 (
 
1556
f_int1 INTEGER,
 
1557
f_int2 INTEGER,
 
1558
f_char1 CHAR(20),
 
1559
f_char2 CHAR(20),
 
1560
f_charbig VARCHAR(1000)
 
1561
)
 
1562
PARTITION BY HASH(f_int1) PARTITIONS "GARBAGE";
 
1563
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"GARBAGE"' at line 8
 
1564
CREATE TABLE t1 (
 
1565
f_int1 INTEGER,
 
1566
f_int2 INTEGER,
 
1567
f_char1 CHAR(20),
 
1568
f_char2 CHAR(20),
 
1569
f_charbig VARCHAR(1000)
 
1570
)
 
1571
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1)
 
1572
SUBPARTITIONS "GARBAGE"
 
1573
(PARTITION part1 VALUES LESS THAN (10),
 
1574
PARTITION part2 VALUES LESS THAN (2147483646));
 
1575
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"GARBAGE"
 
1576
(PARTITION part1 VALUES LESS THAN (10),
 
1577
PARTITION part2 VALUES LESS TH' at line 9
 
1578
# 4.2.6 (negative) partition/subpartition numbers per @variables
 
1579
SET @aux = 5;
 
1580
CREATE TABLE t1 (
 
1581
f_int1 INTEGER,
 
1582
f_int2 INTEGER,
 
1583
f_char1 CHAR(20),
 
1584
f_char2 CHAR(20),
 
1585
f_charbig VARCHAR(1000)
 
1586
)
 
1587
PARTITION BY HASH(f_int1) PARTITIONS @aux;
 
1588
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@aux' at line 8
 
1589
CREATE TABLE t1 (
 
1590
f_int1 INTEGER,
 
1591
f_int2 INTEGER,
 
1592
f_char1 CHAR(20),
 
1593
f_char2 CHAR(20),
 
1594
f_charbig VARCHAR(1000)
 
1595
)
 
1596
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1)
 
1597
SUBPARTITIONS @aux = 5
 
1598
(PARTITION part1 VALUES LESS THAN (10),
 
1599
PARTITION part2 VALUES LESS THAN (2147483646));
 
1600
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@aux = 5
 
1601
(PARTITION part1 VALUES LESS THAN (10),
 
1602
PARTITION part2 VALUES LESS THA' at line 9
 
1603
#------------------------------------------------------------------------
 
1604
# 4.3 Mixups of assigned partition/subpartition numbers and names
 
1605
#------------------------------------------------------------------------
 
1606
# 4.3.1 (positive) number of partition/subpartition
 
1607
#                         = number of named partition/subpartition
 
1608
CREATE TABLE t1 (
 
1609
f_int1 INTEGER,
 
1610
f_int2 INTEGER,
 
1611
f_char1 CHAR(20),
 
1612
f_char2 CHAR(20),
 
1613
f_charbig VARCHAR(1000)
 
1614
)
 
1615
PARTITION BY HASH(f_int1) PARTITIONS 2 ( PARTITION part1, PARTITION part2 ) ;
 
1616
create_command
 
1617
SHOW CREATE TABLE t1;
 
1618
Table   Create Table
 
1619
t1      CREATE TABLE `t1` (
 
1620
  `f_int1` int(11) DEFAULT NULL,
 
1621
  `f_int2` int(11) DEFAULT NULL,
 
1622
  `f_char1` char(20) DEFAULT NULL,
 
1623
  `f_char2` char(20) DEFAULT NULL,
 
1624
  `f_charbig` varchar(1000) DEFAULT NULL
 
1625
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH (f_int1) (PARTITION part1  ENGINE = ndbcluster, PARTITION part2  ENGINE = ndbcluster)
 
1626
 
 
1627
DROP TABLE t1;
 
1628
CREATE TABLE t1 (
 
1629
f_int1 INTEGER,
 
1630
f_int2 INTEGER,
 
1631
f_char1 CHAR(20),
 
1632
f_char2 CHAR(20),
 
1633
f_charbig VARCHAR(1000)
 
1634
)
 
1635
PARTITION BY RANGE(f_int1) PARTITIONS 2
 
1636
SUBPARTITION BY HASH(f_int1) SUBPARTITIONS 2
 
1637
( PARTITION part1 VALUES LESS THAN (1000)
 
1638
(SUBPARTITION subpart11, SUBPARTITION subpart12),
 
1639
PARTITION part2 VALUES LESS THAN (2147483646)
 
1640
(SUBPARTITION subpart21, SUBPARTITION subpart22)
 
1641
);
 
1642
create_command
 
1643
SHOW CREATE TABLE t1;
 
1644
Table   Create Table
 
1645
t1      CREATE TABLE `t1` (
 
1646
  `f_int1` int(11) DEFAULT NULL,
 
1647
  `f_int2` int(11) DEFAULT NULL,
 
1648
  `f_char1` char(20) DEFAULT NULL,
 
1649
  `f_char2` char(20) DEFAULT NULL,
 
1650
  `f_charbig` varchar(1000) DEFAULT NULL
 
1651
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int1) (PARTITION part1 VALUES LESS THAN (1000)  (SUBPARTITION subpart11 ENGINE = ndbcluster, SUBPARTITION subpart12 ENGINE = ndbcluster), PARTITION part2 VALUES LESS THAN (2147483646)  (SUBPARTITION subpart21 ENGINE = ndbcluster, SUBPARTITION subpart22 ENGINE = ndbcluster))
 
1652
 
 
1653
DROP TABLE t1;
 
1654
# 4.3.2 (positive) number of partition/subpartition ,
 
1655
#                  0 (= no) named partition/subpartition
 
1656
#                  already checked above
 
1657
# 4.3.3 (negative) number of partitions/subpartitions
 
1658
#                         > number of named partitions/subpartitions
 
1659
CREATE TABLE t1 (
 
1660
f_int1 INTEGER,
 
1661
f_int2 INTEGER,
 
1662
f_char1 CHAR(20),
 
1663
f_char2 CHAR(20),
 
1664
f_charbig VARCHAR(1000)
 
1665
)
 
1666
PARTITION BY HASH(f_int1) PARTITIONS 2 ( PARTITION part1 ) ;
 
1667
ERROR 42000: Wrong number of partitions defined, mismatch with previous setting near ')' at line 8
 
1668
CREATE TABLE t1 (
 
1669
f_int1 INTEGER,
 
1670
f_int2 INTEGER,
 
1671
f_char1 CHAR(20),
 
1672
f_char2 CHAR(20),
 
1673
f_charbig VARCHAR(1000)
 
1674
)
 
1675
PARTITION BY RANGE(f_int1)
 
1676
SUBPARTITION BY HASH(f_int1) SUBPARTITIONS 2
 
1677
( PARTITION part1 VALUES LESS THAN (1000)
 
1678
(SUBPARTITION subpart11 ),
 
1679
PARTITION part2 VALUES LESS THAN (2147483646)
 
1680
(SUBPARTITION subpart21, SUBPARTITION subpart22)
 
1681
);
 
1682
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near '),
 
1683
PARTITION part2 VALUES LESS THAN (2147483646)
 
1684
(SUBPARTITION subpart21, SUBPAR' at line 11
 
1685
CREATE TABLE t1 (
 
1686
f_int1 INTEGER,
 
1687
f_int2 INTEGER,
 
1688
f_char1 CHAR(20),
 
1689
f_char2 CHAR(20),
 
1690
f_charbig VARCHAR(1000)
 
1691
)
 
1692
PARTITION BY RANGE(f_int1)
 
1693
SUBPARTITION BY HASH(f_int1) SUBPARTITIONS 2
 
1694
( PARTITION part1 VALUES LESS THAN (1000)
 
1695
(SUBPARTITION subpart11, SUBPARTITION subpart12),
 
1696
PARTITION part2 VALUES LESS THAN (2000)
 
1697
(SUBPARTITION subpart21 ),
 
1698
PARTITION part3 VALUES LESS THAN (2147483646)
 
1699
(SUBPARTITION subpart31, SUBPARTITION subpart32)
 
1700
);
 
1701
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near '),
 
1702
PARTITION part3 VALUES LESS THAN (2147483646)
 
1703
(SUBPARTITION subpart31, SUBPAR' at line 13
 
1704
CREATE TABLE t1 (
 
1705
f_int1 INTEGER,
 
1706
f_int2 INTEGER,
 
1707
f_char1 CHAR(20),
 
1708
f_char2 CHAR(20),
 
1709
f_charbig VARCHAR(1000)
 
1710
)
 
1711
PARTITION BY RANGE(f_int1) PARTITIONS 2
 
1712
SUBPARTITION BY HASH(f_int1) SUBPARTITIONS 2
 
1713
( PARTITION part1 VALUES LESS THAN (1000)
 
1714
(SUBPARTITION subpart11, SUBPARTITION subpart12),
 
1715
PARTITION part2 VALUES LESS THAN (2147483646)
 
1716
(SUBPARTITION subpart21                        )
 
1717
);
 
1718
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near ')
 
1719
)' at line 13
 
1720
# 4.3.4 (negative) number of partitions < number of named partitions
 
1721
CREATE TABLE t1 (
 
1722
f_int1 INTEGER,
 
1723
f_int2 INTEGER,
 
1724
f_char1 CHAR(20),
 
1725
f_char2 CHAR(20),
 
1726
f_charbig VARCHAR(1000)
 
1727
)
 
1728
PARTITION BY HASH(f_int1) PARTITIONS 1 ( PARTITION part1, PARTITION part2 ) ;
 
1729
ERROR 42000: Wrong number of partitions defined, mismatch with previous setting near ')' at line 8
 
1730
CREATE TABLE t1 (
 
1731
f_int1 INTEGER,
 
1732
f_int2 INTEGER,
 
1733
f_char1 CHAR(20),
 
1734
f_char2 CHAR(20),
 
1735
f_charbig VARCHAR(1000)
 
1736
)
 
1737
PARTITION BY RANGE(f_int1)
 
1738
SUBPARTITION BY HASH(f_int1) SUBPARTITIONS 1
 
1739
( PARTITION part1 VALUES LESS THAN (1000)
 
1740
(SUBPARTITION subpart11, SUBPARTITION subpart12),
 
1741
PARTITION part2 VALUES LESS THAN (2147483646)
 
1742
(SUBPARTITION subpart21, SUBPARTITION subpart22)
 
1743
);
 
1744
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near '),
 
1745
PARTITION part2 VALUES LESS THAN (2147483646)
 
1746
(SUBPARTITION subpart21, SUBPAR' at line 11
 
1747
CREATE TABLE t1 (
 
1748
f_int1 INTEGER,
 
1749
f_int2 INTEGER,
 
1750
f_char1 CHAR(20),
 
1751
f_char2 CHAR(20),
 
1752
f_charbig VARCHAR(1000)
 
1753
)
 
1754
PARTITION BY RANGE(f_int1)
 
1755
SUBPARTITION BY HASH(f_int1) SUBPARTITIONS 1
 
1756
( PARTITION part1 VALUES LESS THAN (1000)
 
1757
(SUBPARTITION subpart11, SUBPARTITION subpart12),
 
1758
PARTITION part2 VALUES LESS THAN (2000)
 
1759
(SUBPARTITION subpart21                        ),
 
1760
PARTITION part3 VALUES LESS THAN (2147483646)
 
1761
(SUBPARTITION subpart31, SUBPARTITION subpart32)
 
1762
);
 
1763
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near '),
 
1764
PARTITION part2 VALUES LESS THAN (2000)
 
1765
(SUBPARTITION subpart21              ' at line 11
 
1766
CREATE TABLE t1 (
 
1767
f_int1 INTEGER,
 
1768
f_int2 INTEGER,
 
1769
f_char1 CHAR(20),
 
1770
f_char2 CHAR(20),
 
1771
f_charbig VARCHAR(1000)
 
1772
)
 
1773
PARTITION BY RANGE(f_int1)
 
1774
SUBPARTITION BY HASH(f_int1) SUBPARTITIONS 1
 
1775
( PARTITION part1 VALUES LESS THAN (1000)
 
1776
(SUBPARTITION subpart11, SUBPARTITION subpart12),
 
1777
PARTITION part2 VALUES LESS THAN (2147483646)
 
1778
(SUBPARTITION subpart21, SUBPARTITION subpart22)
 
1779
);
 
1780
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near '),
 
1781
PARTITION part2 VALUES LESS THAN (2147483646)
 
1782
(SUBPARTITION subpart21, SUBPAR' at line 11
 
1783
 
 
1784
#========================================================================
 
1785
#  5. Checks of logical partition/subpartition name
 
1786
#     file name clashes during CREATE TABLE
 
1787
#========================================================================
 
1788
DROP TABLE IF EXISTS t1;
 
1789
#------------------------------------------------------------------------
 
1790
#  5.1 (negative) A partition/subpartition name used more than once
 
1791
#------------------------------------------------------------------------
 
1792
#  5.1.1 duplicate partition name
 
1793
CREATE TABLE t1 (
 
1794
f_int1 INTEGER,
 
1795
f_int2 INTEGER,
 
1796
f_char1 CHAR(20),
 
1797
f_char2 CHAR(20),
 
1798
f_charbig VARCHAR(1000)
 
1799
)
 
1800
PARTITION BY HASH(f_int1) (PARTITION part1, PARTITION part1);
 
1801
ERROR HY000: Duplicate partition name part1
 
1802
#  5.1.2 duplicate subpartition name
 
1803
CREATE TABLE t1 (
 
1804
f_int1 INTEGER,
 
1805
f_int2 INTEGER,
 
1806
f_char1 CHAR(20),
 
1807
f_char2 CHAR(20),
 
1808
f_charbig VARCHAR(1000)
 
1809
)
 
1810
PARTITION BY RANGE(f_int1)
 
1811
SUBPARTITION BY HASH(f_int1)
 
1812
( PARTITION part1 VALUES LESS THAN (1000)
 
1813
(SUBPARTITION subpart11, SUBPARTITION subpart11)
 
1814
);
 
1815
ERROR HY000: Duplicate partition name subpart11
 
1816
DROP VIEW  IF EXISTS v1;
 
1817
DROP TABLE IF EXISTS t1;
 
1818
DROP TABLE IF EXISTS t0_aux;
 
1819
DROP TABLE IF EXISTS t0_definition;
 
1820
DROP TABLE IF EXISTS t0_template;