2
SET @@session.storage_engine = 'ndbcluster';
4
#------------------------------------------------------------------------
5
# There are several testcases disabled because of the open bugs
8
# The expected results suffer from the following bugs
9
# harmless #17455, #19305
10
# which cannot be suppressed because of technical reasons.
11
#------------------------------------------------------------------------
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 (
27
f_charbig VARCHAR(1000) ,
30
# Logging of <max_row> INSERTs into t0_template suppressed
31
DROP TABLE IF EXISTS t0_definition;
32
CREATE TABLE t0_definition (
34
create_command VARBINARY(5000),
35
file_list VARBINARY(5000),
38
DROP TABLE IF EXISTS t0_aux;
39
CREATE TABLE t0_aux ( f_int1 INTEGER,
43
f_charbig VARCHAR(1000) )
46
SET @@session.sql_mode= '';
47
# End of basic preparations needed for all tests
48
#-----------------------------------------------
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
#------------------------------------------------------------------------
64
f_charbig VARCHAR(1000),
67
PARTITION BY HASH(f_int1) PARTITIONS 2;
68
ERROR HY000: A PRIMARY KEY need to include all fields in the partition function
74
f_charbig VARCHAR(1000),
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
84
f_charbig VARCHAR(1000),
87
PARTITION BY KEY(f_int1) PARTITIONS 2;
88
ERROR HY000: A PRIMARY KEY need to include all fields in the partition function
94
f_charbig VARCHAR(1000),
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
104
f_charbig VARCHAR(1000),
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
115
f_charbig VARCHAR(1000),
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
126
f_charbig VARCHAR(1000),
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
137
f_charbig VARCHAR(1000),
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
#------------------------------------------------------------------------
156
f_charbig VARCHAR(1000),
157
UNIQUE INDEX (f_int2)
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;
168
f_charbig VARCHAR(1000),
169
PRIMARY KEY(f_int1,f_int2), UNIQUE INDEX (f_int2)
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;
180
f_charbig VARCHAR(1000),
181
UNIQUE INDEX (f_int2)
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;
192
f_charbig VARCHAR(1000),
193
PRIMARY KEY(f_int1,f_int2), UNIQUE INDEX (f_int2)
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;
204
f_charbig VARCHAR(1000),
205
UNIQUE INDEX (f_int2)
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;
216
f_charbig VARCHAR(1000),
217
PRIMARY KEY(f_int1,f_int2), UNIQUE INDEX (f_int2)
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;
228
f_charbig VARCHAR(1000),
229
UNIQUE INDEX (f_int2)
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;
240
f_charbig VARCHAR(1000),
241
PRIMARY KEY(f_int1,f_int2), UNIQUE INDEX (f_int2)
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;
252
f_charbig VARCHAR(1000),
253
UNIQUE INDEX (f_int2)
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;
268
f_charbig VARCHAR(1000),
269
PRIMARY KEY(f_int1,f_int2), UNIQUE INDEX (f_int2)
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;
284
f_charbig VARCHAR(1000),
285
UNIQUE INDEX (f_int2)
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;
300
f_charbig VARCHAR(1000),
301
PRIMARY KEY(f_int1,f_int2), UNIQUE INDEX (f_int2)
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;
316
f_charbig VARCHAR(1000),
317
UNIQUE INDEX (f_int2)
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;
330
f_charbig VARCHAR(1000),
331
PRIMARY KEY(f_int1,f_int2), UNIQUE INDEX (f_int2)
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;
344
f_charbig VARCHAR(1000),
345
UNIQUE INDEX (f_int2)
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;
358
f_charbig VARCHAR(1000),
359
PRIMARY KEY(f_int1,f_int2), UNIQUE INDEX (f_int2)
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;
367
#------------------------------------------------------------------------
368
# 1.3 column of subpartitioning function not included in PRIMARY KEY
369
# PARTITION BY RANGE/LIST -- SUBPARTITION BY HASH/KEY
370
#------------------------------------------------------------------------
376
f_charbig VARCHAR(1000),
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
388
f_charbig VARCHAR(1000),
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
400
f_charbig VARCHAR(1000),
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
412
f_charbig VARCHAR(1000),
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
#------------------------------------------------------------------------
430
f_charbig VARCHAR(1000),
431
UNIQUE INDEX (f_int2)
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;
445
f_charbig VARCHAR(1000),
446
PRIMARY KEY(f_int1,f_int2), UNIQUE INDEX (f_int2)
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;
460
f_charbig VARCHAR(1000),
461
UNIQUE INDEX (f_int2)
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;
475
f_charbig VARCHAR(1000),
476
PRIMARY KEY(f_int1,f_int2), UNIQUE INDEX (f_int2)
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;
490
f_charbig VARCHAR(1000),
491
UNIQUE INDEX (f_int2)
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;
507
f_charbig VARCHAR(1000),
508
PRIMARY KEY(f_int1,f_int2), UNIQUE INDEX (f_int2)
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;
524
f_charbig VARCHAR(1000),
525
UNIQUE INDEX (f_int2)
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;
541
f_charbig VARCHAR(1000),
542
PRIMARY KEY(f_int1,f_int2), UNIQUE INDEX (f_int2)
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;
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;
566
f_charbig VARCHAR(1000)
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
575
#------------------------------------------------------------------------
581
f_charbig VARCHAR(1000),
584
PARTITION BY RANGE(f_int1) SUBPARTITION BY KEY(f_int1)
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
592
#========================================================================
594
#========================================================================
595
#------------------------------------------------------------------------
596
# 3.1 The constants in VALUES IN clauses must differ
597
#------------------------------------------------------------------------
603
f_charbig VARCHAR(1000)
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
#------------------------------------------------------------------------
633
f_charbig VARCHAR(1000)
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
#------------------------------------------------------------------------
648
f_charbig VARCHAR(1000)
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
665
f_charbig VARCHAR(1000)
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
678
f_charbig VARCHAR(1000)
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)
692
f_charbig VARCHAR(1000)
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));
699
# 3.5.2.2 VALUE IN (CAST(NULL AS SIGNED INTEGER))
705
f_charbig VARCHAR(1000)
707
PARTITION BY LIST(MOD(f_int1,2))
708
( PARTITION part1 VALUES IN (CAST(NULL AS SIGNED INTEGER)),
709
PARTITION part3 VALUES IN (1));
711
SHOW CREATE TABLE t1;
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)
722
# 3.5.3 Reveal that IN (...NULL) is not mapped to IN(0)
728
f_charbig VARCHAR(1000)
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));
735
SHOW CREATE TABLE t1;
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)
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
761
f_charbig VARCHAR(1000)
763
PARTITION BY HASH(f_int1);
765
SHOW CREATE TABLE t1;
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)
776
# 4.1.2 no partition number, named partitions
782
f_charbig VARCHAR(1000)
784
PARTITION BY HASH(f_int1) (PARTITION part1, PARTITION part2);
786
SHOW CREATE TABLE t1;
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)
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,
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)) ;
806
CREATE TABLE t1 ( f_int1 INTEGER,
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,
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,
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,
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,
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,
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,
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 )) ;
869
SHOW CREATE TABLE t1;
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))
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
890
f_charbig VARCHAR(1000)
892
PARTITION BY HASH(f_int1) PARTITIONS 2;
894
SHOW CREATE TABLE t1;
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
910
f_charbig VARCHAR(1000)
912
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1)
914
(PARTITION part1 VALUES LESS THAN (10),
915
PARTITION part2 VALUES LESS THAN (2147483646));
917
SHOW CREATE TABLE t1;
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) )
933
f_charbig VARCHAR(1000)
935
PARTITION BY HASH(f_int1) PARTITIONS 1;
937
SHOW CREATE TABLE t1;
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
953
f_charbig VARCHAR(1000)
955
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1)
957
(PARTITION part1 VALUES LESS THAN (10),
958
PARTITION part2 VALUES LESS THAN (2147483646));
960
SHOW CREATE TABLE t1;
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) )
976
f_charbig VARCHAR(1000)
978
PARTITION BY HASH(f_int1) PARTITIONS 0;
979
ERROR HY000: Number of partitions = 0 is not an allowed value
985
f_charbig VARCHAR(1000)
987
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1)
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
997
f_charbig VARCHAR(1000)
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
1006
f_charbig VARCHAR(1000)
1008
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1)
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
1020
f_charbig VARCHAR(1000)
1022
PARTITION BY HASH(f_int1) PARTITIONS 1000000;
1023
ERROR HY000: Too many partitions (including subpartitions) were defined
1029
f_charbig VARCHAR(1000)
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
1042
f_charbig VARCHAR(1000)
1044
PARTITION BY HASH(f_int1) PARTITIONS 2.0;
1046
SHOW CREATE TABLE t1;
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
1062
f_charbig VARCHAR(1000)
1064
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1)
1066
(PARTITION part1 VALUES LESS THAN (10),
1067
PARTITION part2 VALUES LESS THAN (2147483646));
1069
SHOW CREATE TABLE t1;
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) )
1085
f_charbig VARCHAR(1000)
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
1094
f_charbig VARCHAR(1000)
1096
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1)
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
1108
f_charbig VARCHAR(1000)
1110
PARTITION BY HASH(f_int1) PARTITIONS 0.0;
1111
ERROR HY000: Number of partitions = 0 is not an allowed value
1117
f_charbig VARCHAR(1000)
1119
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1)
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
1129
f_charbig VARCHAR(1000)
1131
PARTITION BY HASH(f_int1) PARTITIONS 999999999999999999999999999999.999999999999999999999999999999;
1132
ERROR HY000: Too many partitions (including subpartitions) were defined
1138
f_charbig VARCHAR(1000)
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
1150
f_charbig VARCHAR(1000)
1152
PARTITION BY HASH(f_int1) PARTITIONS 0.000000000000000000000000000001;
1153
ERROR HY000: Number of partitions = 0 is not an allowed value
1159
f_charbig VARCHAR(1000)
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
1172
f_charbig VARCHAR(1000)
1174
PARTITION BY HASH(f_int1) PARTITIONS 2.0E+0;
1176
SHOW CREATE TABLE t1;
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
1192
f_charbig VARCHAR(1000)
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));
1199
SHOW CREATE TABLE t1;
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) )
1215
f_charbig VARCHAR(1000)
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
1224
f_charbig VARCHAR(1000)
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
1238
f_charbig VARCHAR(1000)
1240
PARTITION BY HASH(f_int1) PARTITIONS 0.0E+300;
1241
ERROR HY000: Number of partitions = 0 is not an allowed value
1247
f_charbig VARCHAR(1000)
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
1260
f_charbig VARCHAR(1000)
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
1269
f_charbig VARCHAR(1000)
1271
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1)
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
1283
f_charbig VARCHAR(1000)
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
1292
f_charbig VARCHAR(1000)
1294
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1)
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
1306
f_charbig VARCHAR(1000)
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
1315
f_charbig VARCHAR(1000)
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
1329
f_charbig VARCHAR(1000)
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
1338
f_charbig VARCHAR(1000)
1340
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1)
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
1352
f_charbig VARCHAR(1000)
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
1361
f_charbig VARCHAR(1000)
1363
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1)
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
1375
f_charbig VARCHAR(1000)
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
1384
f_charbig VARCHAR(1000)
1386
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1)
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
1398
f_charbig VARCHAR(1000)
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
1407
f_charbig VARCHAR(1000)
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
1422
f_charbig VARCHAR(1000)
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
1431
f_charbig VARCHAR(1000)
1433
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1)
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
1445
f_charbig VARCHAR(1000)
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
1454
f_charbig VARCHAR(1000)
1456
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1)
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
1468
f_charbig VARCHAR(1000)
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
1477
f_charbig VARCHAR(1000)
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
1491
f_charbig VARCHAR(1000)
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
1500
f_charbig VARCHAR(1000)
1502
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1)
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
1514
f_charbig VARCHAR(1000)
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
1523
f_charbig VARCHAR(1000)
1525
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1)
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
1537
f_charbig VARCHAR(1000)
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
1546
f_charbig VARCHAR(1000)
1548
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1)
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
1560
f_charbig VARCHAR(1000)
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
1569
f_charbig VARCHAR(1000)
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
1585
f_charbig VARCHAR(1000)
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
1594
f_charbig VARCHAR(1000)
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
1613
f_charbig VARCHAR(1000)
1615
PARTITION BY HASH(f_int1) PARTITIONS 2 ( PARTITION part1, PARTITION part2 ) ;
1617
SHOW CREATE TABLE t1;
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)
1633
f_charbig VARCHAR(1000)
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)
1643
SHOW CREATE TABLE t1;
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))
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
1664
f_charbig VARCHAR(1000)
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
1673
f_charbig VARCHAR(1000)
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)
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
1690
f_charbig VARCHAR(1000)
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)
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
1709
f_charbig VARCHAR(1000)
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 )
1718
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near ')
1720
# 4.3.4 (negative) number of partitions < number of named partitions
1726
f_charbig VARCHAR(1000)
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
1735
f_charbig VARCHAR(1000)
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)
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
1752
f_charbig VARCHAR(1000)
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)
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
1771
f_charbig VARCHAR(1000)
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)
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
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
1798
f_charbig VARCHAR(1000)
1800
PARTITION BY HASH(f_int1) (PARTITION part1, PARTITION part1);
1801
ERROR HY000: Duplicate partition name part1
1802
# 5.1.2 duplicate subpartition name
1808
f_charbig VARCHAR(1000)
1810
PARTITION BY RANGE(f_int1)
1811
SUBPARTITION BY HASH(f_int1)
1812
( PARTITION part1 VALUES LESS THAN (1000)
1813
(SUBPARTITION subpart11, SUBPARTITION subpart11)
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;