~mdcallag/+junk/5.1-map

« back to all changes in this revision

Viewing changes to mysql-test/suite/partitions/r/partition_supported_sql_func_ndb.result

  • Committer: msvensson at pilot
  • Date: 2007-04-24 09:11:45 UTC
  • mfrom: (2469.1.106)
  • Revision ID: sp1r-msvensson@pilot.blaudden-20070424091145-10463
Merge pilot.blaudden:/home/msvensson/mysql/my51-m-mysql_upgrade
into  pilot.blaudden:/home/msvensson/mysql/mysql-5.1-maint

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
-------------------------------------------------------------------------
 
2
---  abs(col1)  in partition with coltype  int
 
3
-------------------------------------------------------------------------
 
4
drop table if exists t1 ;
 
5
drop table if exists t2 ;
 
6
drop table if exists t3 ;
 
7
drop table if exists t4 ;
 
8
drop table if exists t5 ;
 
9
drop table if exists t6 ;
 
10
-------------------------------------------------------------------------
 
11
---  Create tables with abs(col1)
 
12
-------------------------------------------------------------------------
 
13
create table t1 (col1 int) engine='NDB' 
 
14
partition by range(abs(col1)) 
 
15
(partition p0 values less than (15),
 
16
partition p1 values less than maxvalue);
 
17
create table t2 (col1 int) engine='NDB' 
 
18
partition by list(abs(col1)) 
 
19
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
20
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
21
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
22
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
23
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
24
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
25
);
 
26
create table t3 (col1 int) engine='NDB' 
 
27
partition by hash(abs(col1));
 
28
create table t4 (colint int, col1 int) engine='NDB' 
 
29
partition by range(colint) 
 
30
subpartition by hash(abs(col1)) subpartitions 2 
 
31
(partition p0 values less than (15),
 
32
partition p1 values less than maxvalue);
 
33
create table t5 (colint int, col1 int) engine='NDB' 
 
34
partition by list(colint)
 
35
subpartition by hash(abs(col1)) subpartitions 2 
 
36
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
37
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
38
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
39
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
40
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
41
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
42
);
 
43
create table t6 (colint int, col1 int) engine='NDB' 
 
44
partition by range(colint) 
 
45
(partition p0 values less than (abs(15)),
 
46
partition p1 values less than maxvalue);
 
47
-------------------------------------------------------------------------
 
48
---  Access tables with abs(col1) 
 
49
-------------------------------------------------------------------------
 
50
insert into t1 values (5 );
 
51
insert into t1 values (13 );
 
52
insert into t2 values (5 );
 
53
insert into t2 values (13 );
 
54
insert into t2 values (17 );
 
55
insert into t3 values (5 );
 
56
insert into t3 values (13 );
 
57
insert into t3 values (17 );
 
58
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_int.in' into table t4;
 
59
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_int.in' into table t5;
 
60
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_int.in' into table t6;
 
61
select abs(col1) from t1 order by col1;
 
62
abs(col1)
 
63
5
 
64
13
 
65
select * from t1 order by col1;
 
66
col1
 
67
5
 
68
13
 
69
select * from t2 order by col1;
 
70
col1
 
71
5
 
72
13
 
73
17
 
74
select * from t3 order by col1;
 
75
col1
 
76
5
 
77
13
 
78
17
 
79
select * from t4 order by colint;
 
80
colint  col1
 
81
1       5
 
82
2       13
 
83
3       15
 
84
4       17
 
85
5       23
 
86
6       34
 
87
7       56
 
88
8       56
 
89
9       45
 
90
10      34
 
91
11      78
 
92
12      89
 
93
13      67
 
94
14      46
 
95
15      34
 
96
16      324
 
97
17      345
 
98
18      34
 
99
19      78
 
100
20      567
 
101
21      4
 
102
22      435
 
103
23      34
 
104
24      45
 
105
25      4565
 
106
26      4
 
107
27      3
 
108
28      2
 
109
29      3
 
110
30      5
 
111
31      6
 
112
32      8
 
113
33      9
 
114
34      745
 
115
35      34
 
116
36      34
 
117
37      324
 
118
38      67
 
119
39      78
 
120
40      89
 
121
41      90
 
122
42      78967
 
123
50      56
 
124
51      34
 
125
55      123
 
126
select * from t5 order by colint;
 
127
colint  col1
 
128
1       5
 
129
2       13
 
130
3       15
 
131
4       17
 
132
5       23
 
133
6       34
 
134
7       56
 
135
8       56
 
136
9       45
 
137
10      34
 
138
11      78
 
139
12      89
 
140
13      67
 
141
14      46
 
142
15      34
 
143
16      324
 
144
17      345
 
145
18      34
 
146
19      78
 
147
20      567
 
148
21      4
 
149
22      435
 
150
23      34
 
151
24      45
 
152
25      4565
 
153
26      4
 
154
27      3
 
155
28      2
 
156
29      3
 
157
30      5
 
158
31      6
 
159
32      8
 
160
33      9
 
161
34      745
 
162
35      34
 
163
36      34
 
164
37      324
 
165
38      67
 
166
39      78
 
167
40      89
 
168
41      90
 
169
42      78967
 
170
50      56
 
171
51      34
 
172
55      123
 
173
select * from t6 order by colint;
 
174
colint  col1
 
175
1       5
 
176
2       13
 
177
3       15
 
178
4       17
 
179
5       23
 
180
6       34
 
181
7       56
 
182
8       56
 
183
9       45
 
184
10      34
 
185
11      78
 
186
12      89
 
187
13      67
 
188
14      46
 
189
15      34
 
190
16      324
 
191
17      345
 
192
18      34
 
193
19      78
 
194
20      567
 
195
21      4
 
196
22      435
 
197
23      34
 
198
24      45
 
199
25      4565
 
200
26      4
 
201
27      3
 
202
28      2
 
203
29      3
 
204
30      5
 
205
31      6
 
206
32      8
 
207
33      9
 
208
34      745
 
209
35      34
 
210
36      34
 
211
37      324
 
212
38      67
 
213
39      78
 
214
40      89
 
215
41      90
 
216
42      78967
 
217
50      56
 
218
51      34
 
219
55      123
 
220
update t1 set col1=15  where col1=5 ;
 
221
update t2 set col1=15  where col1=5 ;
 
222
update t3 set col1=15  where col1=5 ;
 
223
update t4 set col1=15  where col1=5 ;
 
224
update t5 set col1=15  where col1=5 ;
 
225
update t6 set col1=15  where col1=5 ;
 
226
select * from t1 order by col1;
 
227
col1
 
228
13
 
229
15
 
230
select * from t2 order by col1;
 
231
col1
 
232
13
 
233
15
 
234
17
 
235
select * from t3 order by col1;
 
236
col1
 
237
13
 
238
15
 
239
17
 
240
select * from t4 order by colint;
 
241
colint  col1
 
242
1       15
 
243
2       13
 
244
3       15
 
245
4       17
 
246
5       23
 
247
6       34
 
248
7       56
 
249
8       56
 
250
9       45
 
251
10      34
 
252
11      78
 
253
12      89
 
254
13      67
 
255
14      46
 
256
15      34
 
257
16      324
 
258
17      345
 
259
18      34
 
260
19      78
 
261
20      567
 
262
21      4
 
263
22      435
 
264
23      34
 
265
24      45
 
266
25      4565
 
267
26      4
 
268
27      3
 
269
28      2
 
270
29      3
 
271
30      15
 
272
31      6
 
273
32      8
 
274
33      9
 
275
34      745
 
276
35      34
 
277
36      34
 
278
37      324
 
279
38      67
 
280
39      78
 
281
40      89
 
282
41      90
 
283
42      78967
 
284
50      56
 
285
51      34
 
286
55      123
 
287
select * from t5 order by colint;
 
288
colint  col1
 
289
1       15
 
290
2       13
 
291
3       15
 
292
4       17
 
293
5       23
 
294
6       34
 
295
7       56
 
296
8       56
 
297
9       45
 
298
10      34
 
299
11      78
 
300
12      89
 
301
13      67
 
302
14      46
 
303
15      34
 
304
16      324
 
305
17      345
 
306
18      34
 
307
19      78
 
308
20      567
 
309
21      4
 
310
22      435
 
311
23      34
 
312
24      45
 
313
25      4565
 
314
26      4
 
315
27      3
 
316
28      2
 
317
29      3
 
318
30      15
 
319
31      6
 
320
32      8
 
321
33      9
 
322
34      745
 
323
35      34
 
324
36      34
 
325
37      324
 
326
38      67
 
327
39      78
 
328
40      89
 
329
41      90
 
330
42      78967
 
331
50      56
 
332
51      34
 
333
55      123
 
334
select * from t6 order by colint;
 
335
colint  col1
 
336
1       15
 
337
2       13
 
338
3       15
 
339
4       17
 
340
5       23
 
341
6       34
 
342
7       56
 
343
8       56
 
344
9       45
 
345
10      34
 
346
11      78
 
347
12      89
 
348
13      67
 
349
14      46
 
350
15      34
 
351
16      324
 
352
17      345
 
353
18      34
 
354
19      78
 
355
20      567
 
356
21      4
 
357
22      435
 
358
23      34
 
359
24      45
 
360
25      4565
 
361
26      4
 
362
27      3
 
363
28      2
 
364
29      3
 
365
30      15
 
366
31      6
 
367
32      8
 
368
33      9
 
369
34      745
 
370
35      34
 
371
36      34
 
372
37      324
 
373
38      67
 
374
39      78
 
375
40      89
 
376
41      90
 
377
42      78967
 
378
50      56
 
379
51      34
 
380
55      123
 
381
-------------------------------------------------------------------------
 
382
---  Alter tables with abs(col1)
 
383
-------------------------------------------------------------------------
 
384
drop table if exists t11 ;
 
385
drop table if exists t22 ;
 
386
drop table if exists t33 ;
 
387
drop table if exists t44 ;
 
388
drop table if exists t55 ;
 
389
drop table if exists t66 ;
 
390
create table t11 engine='NDB' as select * from t1;
 
391
create table t22 engine='NDB' as select * from t2;
 
392
create table t33 engine='NDB' as select * from t3;
 
393
create table t44 engine='NDB' as select * from t4;
 
394
create table t55 engine='NDB' as select * from t5;
 
395
create table t66 engine='NDB' as select * from t6;
 
396
alter table t11
 
397
partition by range(abs(col1)) 
 
398
(partition p0 values less than (15),
 
399
partition p1 values less than maxvalue);
 
400
alter table t22
 
401
partition by list(abs(col1)) 
 
402
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
403
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
404
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
405
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
406
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
407
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
408
);
 
409
alter table t33
 
410
partition by hash(abs(col1));
 
411
alter table t44
 
412
partition by range(colint) 
 
413
subpartition by hash(abs(col1)) subpartitions 2 
 
414
(partition p0 values less than (15),
 
415
partition p1 values less than maxvalue);
 
416
alter table t55
 
417
partition by list(colint)
 
418
subpartition by hash(abs(col1)) subpartitions 2 
 
419
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
420
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
421
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
422
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
423
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
424
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
425
);
 
426
alter table t66
 
427
partition by range(colint) 
 
428
(partition p0 values less than (abs(15)),
 
429
partition p1 values less than maxvalue);
 
430
select * from t11 order by col1;
 
431
col1
 
432
13
 
433
15
 
434
select * from t22 order by col1;
 
435
col1
 
436
13
 
437
15
 
438
17
 
439
select * from t33 order by col1;
 
440
col1
 
441
13
 
442
15
 
443
17
 
444
select * from t44 order by colint;
 
445
colint  col1
 
446
1       15
 
447
2       13
 
448
3       15
 
449
4       17
 
450
5       23
 
451
6       34
 
452
7       56
 
453
8       56
 
454
9       45
 
455
10      34
 
456
11      78
 
457
12      89
 
458
13      67
 
459
14      46
 
460
15      34
 
461
16      324
 
462
17      345
 
463
18      34
 
464
19      78
 
465
20      567
 
466
21      4
 
467
22      435
 
468
23      34
 
469
24      45
 
470
25      4565
 
471
26      4
 
472
27      3
 
473
28      2
 
474
29      3
 
475
30      15
 
476
31      6
 
477
32      8
 
478
33      9
 
479
34      745
 
480
35      34
 
481
36      34
 
482
37      324
 
483
38      67
 
484
39      78
 
485
40      89
 
486
41      90
 
487
42      78967
 
488
50      56
 
489
51      34
 
490
55      123
 
491
select * from t55 order by colint;
 
492
colint  col1
 
493
1       15
 
494
2       13
 
495
3       15
 
496
4       17
 
497
5       23
 
498
6       34
 
499
7       56
 
500
8       56
 
501
9       45
 
502
10      34
 
503
11      78
 
504
12      89
 
505
13      67
 
506
14      46
 
507
15      34
 
508
16      324
 
509
17      345
 
510
18      34
 
511
19      78
 
512
20      567
 
513
21      4
 
514
22      435
 
515
23      34
 
516
24      45
 
517
25      4565
 
518
26      4
 
519
27      3
 
520
28      2
 
521
29      3
 
522
30      15
 
523
31      6
 
524
32      8
 
525
33      9
 
526
34      745
 
527
35      34
 
528
36      34
 
529
37      324
 
530
38      67
 
531
39      78
 
532
40      89
 
533
41      90
 
534
42      78967
 
535
50      56
 
536
51      34
 
537
55      123
 
538
select * from t66 order by colint;
 
539
colint  col1
 
540
1       15
 
541
2       13
 
542
3       15
 
543
4       17
 
544
5       23
 
545
6       34
 
546
7       56
 
547
8       56
 
548
9       45
 
549
10      34
 
550
11      78
 
551
12      89
 
552
13      67
 
553
14      46
 
554
15      34
 
555
16      324
 
556
17      345
 
557
18      34
 
558
19      78
 
559
20      567
 
560
21      4
 
561
22      435
 
562
23      34
 
563
24      45
 
564
25      4565
 
565
26      4
 
566
27      3
 
567
28      2
 
568
29      3
 
569
30      15
 
570
31      6
 
571
32      8
 
572
33      9
 
573
34      745
 
574
35      34
 
575
36      34
 
576
37      324
 
577
38      67
 
578
39      78
 
579
40      89
 
580
41      90
 
581
42      78967
 
582
50      56
 
583
51      34
 
584
55      123
 
585
---------------------------
 
586
---- some alter table begin
 
587
---------------------------
 
588
alter table t11
 
589
reorganize partition p0,p1 into
 
590
(partition s1 values less than maxvalue);
 
591
select * from t11 order by col1;
 
592
col1
 
593
13
 
594
15
 
595
alter table t11
 
596
reorganize partition s1 into
 
597
(partition p0 values less than (15),
 
598
partition p1 values less than maxvalue);
 
599
select * from t11 order by col1;
 
600
col1
 
601
13
 
602
15
 
603
alter table t55
 
604
partition by list(colint)
 
605
subpartition by hash(abs(col1)) subpartitions 5 
 
606
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
607
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
608
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
609
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
610
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
611
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
612
);
 
613
show create table t55;
 
614
Table   Create Table
 
615
t55     CREATE TABLE `t55` (
 
616
  `colint` int(11) DEFAULT NULL,
 
617
  `col1` int(11) DEFAULT NULL
 
618
) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (abs(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
 
619
select * from t55 order by colint;
 
620
colint  col1
 
621
1       15
 
622
2       13
 
623
3       15
 
624
4       17
 
625
5       23
 
626
6       34
 
627
7       56
 
628
8       56
 
629
9       45
 
630
10      34
 
631
11      78
 
632
12      89
 
633
13      67
 
634
14      46
 
635
15      34
 
636
16      324
 
637
17      345
 
638
18      34
 
639
19      78
 
640
20      567
 
641
21      4
 
642
22      435
 
643
23      34
 
644
24      45
 
645
25      4565
 
646
26      4
 
647
27      3
 
648
28      2
 
649
29      3
 
650
30      15
 
651
31      6
 
652
32      8
 
653
33      9
 
654
34      745
 
655
35      34
 
656
36      34
 
657
37      324
 
658
38      67
 
659
39      78
 
660
40      89
 
661
41      90
 
662
42      78967
 
663
50      56
 
664
51      34
 
665
55      123
 
666
alter table t66
 
667
reorganize partition p0,p1 into
 
668
(partition s1 values less than maxvalue);
 
669
select * from t66 order by colint;
 
670
colint  col1
 
671
1       15
 
672
2       13
 
673
3       15
 
674
4       17
 
675
5       23
 
676
6       34
 
677
7       56
 
678
8       56
 
679
9       45
 
680
10      34
 
681
11      78
 
682
12      89
 
683
13      67
 
684
14      46
 
685
15      34
 
686
16      324
 
687
17      345
 
688
18      34
 
689
19      78
 
690
20      567
 
691
21      4
 
692
22      435
 
693
23      34
 
694
24      45
 
695
25      4565
 
696
26      4
 
697
27      3
 
698
28      2
 
699
29      3
 
700
30      15
 
701
31      6
 
702
32      8
 
703
33      9
 
704
34      745
 
705
35      34
 
706
36      34
 
707
37      324
 
708
38      67
 
709
39      78
 
710
40      89
 
711
41      90
 
712
42      78967
 
713
50      56
 
714
51      34
 
715
55      123
 
716
alter table t66
 
717
reorganize partition s1 into
 
718
(partition p0 values less than (abs(15)),
 
719
partition p1 values less than maxvalue);
 
720
select * from t66 order by colint;
 
721
colint  col1
 
722
1       15
 
723
2       13
 
724
3       15
 
725
4       17
 
726
5       23
 
727
6       34
 
728
7       56
 
729
8       56
 
730
9       45
 
731
10      34
 
732
11      78
 
733
12      89
 
734
13      67
 
735
14      46
 
736
15      34
 
737
16      324
 
738
17      345
 
739
18      34
 
740
19      78
 
741
20      567
 
742
21      4
 
743
22      435
 
744
23      34
 
745
24      45
 
746
25      4565
 
747
26      4
 
748
27      3
 
749
28      2
 
750
29      3
 
751
30      15
 
752
31      6
 
753
32      8
 
754
33      9
 
755
34      745
 
756
35      34
 
757
36      34
 
758
37      324
 
759
38      67
 
760
39      78
 
761
40      89
 
762
41      90
 
763
42      78967
 
764
50      56
 
765
51      34
 
766
55      123
 
767
alter table t66
 
768
reorganize partition p0,p1 into
 
769
(partition s1 values less than maxvalue);
 
770
select * from t66 order by colint;
 
771
colint  col1
 
772
1       15
 
773
2       13
 
774
3       15
 
775
4       17
 
776
5       23
 
777
6       34
 
778
7       56
 
779
8       56
 
780
9       45
 
781
10      34
 
782
11      78
 
783
12      89
 
784
13      67
 
785
14      46
 
786
15      34
 
787
16      324
 
788
17      345
 
789
18      34
 
790
19      78
 
791
20      567
 
792
21      4
 
793
22      435
 
794
23      34
 
795
24      45
 
796
25      4565
 
797
26      4
 
798
27      3
 
799
28      2
 
800
29      3
 
801
30      15
 
802
31      6
 
803
32      8
 
804
33      9
 
805
34      745
 
806
35      34
 
807
36      34
 
808
37      324
 
809
38      67
 
810
39      78
 
811
40      89
 
812
41      90
 
813
42      78967
 
814
50      56
 
815
51      34
 
816
55      123
 
817
alter table t66
 
818
reorganize partition s1 into
 
819
(partition p0 values less than (abs(15)),
 
820
partition p1 values less than maxvalue);
 
821
select * from t66 order by colint;
 
822
colint  col1
 
823
1       15
 
824
2       13
 
825
3       15
 
826
4       17
 
827
5       23
 
828
6       34
 
829
7       56
 
830
8       56
 
831
9       45
 
832
10      34
 
833
11      78
 
834
12      89
 
835
13      67
 
836
14      46
 
837
15      34
 
838
16      324
 
839
17      345
 
840
18      34
 
841
19      78
 
842
20      567
 
843
21      4
 
844
22      435
 
845
23      34
 
846
24      45
 
847
25      4565
 
848
26      4
 
849
27      3
 
850
28      2
 
851
29      3
 
852
30      15
 
853
31      6
 
854
32      8
 
855
33      9
 
856
34      745
 
857
35      34
 
858
36      34
 
859
37      324
 
860
38      67
 
861
39      78
 
862
40      89
 
863
41      90
 
864
42      78967
 
865
50      56
 
866
51      34
 
867
55      123
 
868
-------------------------------------------------------------------------
 
869
---  Delete rows and partitions of tables with abs(col1)
 
870
-------------------------------------------------------------------------
 
871
delete from t1 where col1=13 ;
 
872
delete from t2 where col1=13 ;
 
873
delete from t3 where col1=13 ;
 
874
delete from t4 where col1=13 ;
 
875
delete from t5 where col1=13 ;
 
876
delete from t6 where col1=13 ;
 
877
select * from t1 order by col1;
 
878
col1
 
879
15
 
880
select * from t2 order by col1;
 
881
col1
 
882
15
 
883
17
 
884
select * from t3 order by col1;
 
885
col1
 
886
15
 
887
17
 
888
select * from t4 order by colint;
 
889
colint  col1
 
890
1       15
 
891
3       15
 
892
4       17
 
893
5       23
 
894
6       34
 
895
7       56
 
896
8       56
 
897
9       45
 
898
10      34
 
899
11      78
 
900
12      89
 
901
13      67
 
902
14      46
 
903
15      34
 
904
16      324
 
905
17      345
 
906
18      34
 
907
19      78
 
908
20      567
 
909
21      4
 
910
22      435
 
911
23      34
 
912
24      45
 
913
25      4565
 
914
26      4
 
915
27      3
 
916
28      2
 
917
29      3
 
918
30      15
 
919
31      6
 
920
32      8
 
921
33      9
 
922
34      745
 
923
35      34
 
924
36      34
 
925
37      324
 
926
38      67
 
927
39      78
 
928
40      89
 
929
41      90
 
930
42      78967
 
931
50      56
 
932
51      34
 
933
55      123
 
934
select * from t5 order by colint;
 
935
colint  col1
 
936
1       15
 
937
3       15
 
938
4       17
 
939
5       23
 
940
6       34
 
941
7       56
 
942
8       56
 
943
9       45
 
944
10      34
 
945
11      78
 
946
12      89
 
947
13      67
 
948
14      46
 
949
15      34
 
950
16      324
 
951
17      345
 
952
18      34
 
953
19      78
 
954
20      567
 
955
21      4
 
956
22      435
 
957
23      34
 
958
24      45
 
959
25      4565
 
960
26      4
 
961
27      3
 
962
28      2
 
963
29      3
 
964
30      15
 
965
31      6
 
966
32      8
 
967
33      9
 
968
34      745
 
969
35      34
 
970
36      34
 
971
37      324
 
972
38      67
 
973
39      78
 
974
40      89
 
975
41      90
 
976
42      78967
 
977
50      56
 
978
51      34
 
979
55      123
 
980
insert into t1 values (13 );
 
981
insert into t2 values (13 );
 
982
insert into t3 values (13 );
 
983
insert into t4 values (60,13 );
 
984
insert into t5 values (60,13 );
 
985
insert into t6 values (60,13 );
 
986
select * from t1 order by col1;
 
987
col1
 
988
13
 
989
15
 
990
select * from t2 order by col1;
 
991
col1
 
992
13
 
993
15
 
994
17
 
995
select * from t3 order by col1;
 
996
col1
 
997
13
 
998
15
 
999
17
 
1000
select * from t4 order by colint;
 
1001
colint  col1
 
1002
1       15
 
1003
3       15
 
1004
4       17
 
1005
5       23
 
1006
6       34
 
1007
7       56
 
1008
8       56
 
1009
9       45
 
1010
10      34
 
1011
11      78
 
1012
12      89
 
1013
13      67
 
1014
14      46
 
1015
15      34
 
1016
16      324
 
1017
17      345
 
1018
18      34
 
1019
19      78
 
1020
20      567
 
1021
21      4
 
1022
22      435
 
1023
23      34
 
1024
24      45
 
1025
25      4565
 
1026
26      4
 
1027
27      3
 
1028
28      2
 
1029
29      3
 
1030
30      15
 
1031
31      6
 
1032
32      8
 
1033
33      9
 
1034
34      745
 
1035
35      34
 
1036
36      34
 
1037
37      324
 
1038
38      67
 
1039
39      78
 
1040
40      89
 
1041
41      90
 
1042
42      78967
 
1043
50      56
 
1044
51      34
 
1045
55      123
 
1046
60      13
 
1047
select * from t5 order by colint;
 
1048
colint  col1
 
1049
1       15
 
1050
3       15
 
1051
4       17
 
1052
5       23
 
1053
6       34
 
1054
7       56
 
1055
8       56
 
1056
9       45
 
1057
10      34
 
1058
11      78
 
1059
12      89
 
1060
13      67
 
1061
14      46
 
1062
15      34
 
1063
16      324
 
1064
17      345
 
1065
18      34
 
1066
19      78
 
1067
20      567
 
1068
21      4
 
1069
22      435
 
1070
23      34
 
1071
24      45
 
1072
25      4565
 
1073
26      4
 
1074
27      3
 
1075
28      2
 
1076
29      3
 
1077
30      15
 
1078
31      6
 
1079
32      8
 
1080
33      9
 
1081
34      745
 
1082
35      34
 
1083
36      34
 
1084
37      324
 
1085
38      67
 
1086
39      78
 
1087
40      89
 
1088
41      90
 
1089
42      78967
 
1090
50      56
 
1091
51      34
 
1092
55      123
 
1093
60      13
 
1094
select * from t6 order by colint;
 
1095
colint  col1
 
1096
1       15
 
1097
3       15
 
1098
4       17
 
1099
5       23
 
1100
6       34
 
1101
7       56
 
1102
8       56
 
1103
9       45
 
1104
10      34
 
1105
11      78
 
1106
12      89
 
1107
13      67
 
1108
14      46
 
1109
15      34
 
1110
16      324
 
1111
17      345
 
1112
18      34
 
1113
19      78
 
1114
20      567
 
1115
21      4
 
1116
22      435
 
1117
23      34
 
1118
24      45
 
1119
25      4565
 
1120
26      4
 
1121
27      3
 
1122
28      2
 
1123
29      3
 
1124
30      15
 
1125
31      6
 
1126
32      8
 
1127
33      9
 
1128
34      745
 
1129
35      34
 
1130
36      34
 
1131
37      324
 
1132
38      67
 
1133
39      78
 
1134
40      89
 
1135
41      90
 
1136
42      78967
 
1137
50      56
 
1138
51      34
 
1139
55      123
 
1140
60      13
 
1141
alter table t1 drop partition p0;
 
1142
alter table t2 drop partition p0;
 
1143
alter table t4 drop partition p0;
 
1144
alter table t5 drop partition p0;
 
1145
alter table t6 drop partition p0;
 
1146
select * from t1 order by col1;
 
1147
col1
 
1148
15
 
1149
select * from t2 order by col1;
 
1150
col1
 
1151
13
 
1152
15
 
1153
17
 
1154
select * from t3 order by col1;
 
1155
col1
 
1156
13
 
1157
15
 
1158
17
 
1159
select * from t4 order by colint;
 
1160
colint  col1
 
1161
15      34
 
1162
16      324
 
1163
17      345
 
1164
18      34
 
1165
19      78
 
1166
20      567
 
1167
21      4
 
1168
22      435
 
1169
23      34
 
1170
24      45
 
1171
25      4565
 
1172
26      4
 
1173
27      3
 
1174
28      2
 
1175
29      3
 
1176
30      15
 
1177
31      6
 
1178
32      8
 
1179
33      9
 
1180
34      745
 
1181
35      34
 
1182
36      34
 
1183
37      324
 
1184
38      67
 
1185
39      78
 
1186
40      89
 
1187
41      90
 
1188
42      78967
 
1189
50      56
 
1190
51      34
 
1191
55      123
 
1192
60      13
 
1193
select * from t5 order by colint;
 
1194
colint  col1
 
1195
11      78
 
1196
12      89
 
1197
13      67
 
1198
14      46
 
1199
15      34
 
1200
16      324
 
1201
17      345
 
1202
18      34
 
1203
19      78
 
1204
20      567
 
1205
21      4
 
1206
22      435
 
1207
23      34
 
1208
24      45
 
1209
25      4565
 
1210
26      4
 
1211
27      3
 
1212
28      2
 
1213
29      3
 
1214
30      15
 
1215
31      6
 
1216
32      8
 
1217
33      9
 
1218
34      745
 
1219
35      34
 
1220
36      34
 
1221
37      324
 
1222
38      67
 
1223
39      78
 
1224
40      89
 
1225
41      90
 
1226
42      78967
 
1227
50      56
 
1228
51      34
 
1229
55      123
 
1230
60      13
 
1231
select * from t6 order by colint;
 
1232
colint  col1
 
1233
15      34
 
1234
16      324
 
1235
17      345
 
1236
18      34
 
1237
19      78
 
1238
20      567
 
1239
21      4
 
1240
22      435
 
1241
23      34
 
1242
24      45
 
1243
25      4565
 
1244
26      4
 
1245
27      3
 
1246
28      2
 
1247
29      3
 
1248
30      15
 
1249
31      6
 
1250
32      8
 
1251
33      9
 
1252
34      745
 
1253
35      34
 
1254
36      34
 
1255
37      324
 
1256
38      67
 
1257
39      78
 
1258
40      89
 
1259
41      90
 
1260
42      78967
 
1261
50      56
 
1262
51      34
 
1263
55      123
 
1264
60      13
 
1265
-------------------------------------------------------------------------
 
1266
---  Delete rows and partitions of tables with abs(col1)
 
1267
-------------------------------------------------------------------------
 
1268
delete from t11 where col1=13 ;
 
1269
delete from t22 where col1=13 ;
 
1270
delete from t33 where col1=13 ;
 
1271
delete from t44 where col1=13 ;
 
1272
delete from t55 where col1=13 ;
 
1273
delete from t66 where col1=13 ;
 
1274
select * from t11 order by col1;
 
1275
col1
 
1276
15
 
1277
select * from t22 order by col1;
 
1278
col1
 
1279
15
 
1280
17
 
1281
select * from t33 order by col1;
 
1282
col1
 
1283
15
 
1284
17
 
1285
select * from t44 order by colint;
 
1286
colint  col1
 
1287
1       15
 
1288
3       15
 
1289
4       17
 
1290
5       23
 
1291
6       34
 
1292
7       56
 
1293
8       56
 
1294
9       45
 
1295
10      34
 
1296
11      78
 
1297
12      89
 
1298
13      67
 
1299
14      46
 
1300
15      34
 
1301
16      324
 
1302
17      345
 
1303
18      34
 
1304
19      78
 
1305
20      567
 
1306
21      4
 
1307
22      435
 
1308
23      34
 
1309
24      45
 
1310
25      4565
 
1311
26      4
 
1312
27      3
 
1313
28      2
 
1314
29      3
 
1315
30      15
 
1316
31      6
 
1317
32      8
 
1318
33      9
 
1319
34      745
 
1320
35      34
 
1321
36      34
 
1322
37      324
 
1323
38      67
 
1324
39      78
 
1325
40      89
 
1326
41      90
 
1327
42      78967
 
1328
50      56
 
1329
51      34
 
1330
55      123
 
1331
select * from t55 order by colint;
 
1332
colint  col1
 
1333
1       15
 
1334
3       15
 
1335
4       17
 
1336
5       23
 
1337
6       34
 
1338
7       56
 
1339
8       56
 
1340
9       45
 
1341
10      34
 
1342
11      78
 
1343
12      89
 
1344
13      67
 
1345
14      46
 
1346
15      34
 
1347
16      324
 
1348
17      345
 
1349
18      34
 
1350
19      78
 
1351
20      567
 
1352
21      4
 
1353
22      435
 
1354
23      34
 
1355
24      45
 
1356
25      4565
 
1357
26      4
 
1358
27      3
 
1359
28      2
 
1360
29      3
 
1361
30      15
 
1362
31      6
 
1363
32      8
 
1364
33      9
 
1365
34      745
 
1366
35      34
 
1367
36      34
 
1368
37      324
 
1369
38      67
 
1370
39      78
 
1371
40      89
 
1372
41      90
 
1373
42      78967
 
1374
50      56
 
1375
51      34
 
1376
55      123
 
1377
insert into t11 values (13 );
 
1378
insert into t22 values (13 );
 
1379
insert into t33 values (13 );
 
1380
insert into t44 values (60,13 );
 
1381
insert into t55 values (60,13 );
 
1382
insert into t66 values (60,13 );
 
1383
select * from t11 order by col1;
 
1384
col1
 
1385
13
 
1386
15
 
1387
select * from t22 order by col1;
 
1388
col1
 
1389
13
 
1390
15
 
1391
17
 
1392
select * from t33 order by col1;
 
1393
col1
 
1394
13
 
1395
15
 
1396
17
 
1397
select * from t44 order by colint;
 
1398
colint  col1
 
1399
1       15
 
1400
3       15
 
1401
4       17
 
1402
5       23
 
1403
6       34
 
1404
7       56
 
1405
8       56
 
1406
9       45
 
1407
10      34
 
1408
11      78
 
1409
12      89
 
1410
13      67
 
1411
14      46
 
1412
15      34
 
1413
16      324
 
1414
17      345
 
1415
18      34
 
1416
19      78
 
1417
20      567
 
1418
21      4
 
1419
22      435
 
1420
23      34
 
1421
24      45
 
1422
25      4565
 
1423
26      4
 
1424
27      3
 
1425
28      2
 
1426
29      3
 
1427
30      15
 
1428
31      6
 
1429
32      8
 
1430
33      9
 
1431
34      745
 
1432
35      34
 
1433
36      34
 
1434
37      324
 
1435
38      67
 
1436
39      78
 
1437
40      89
 
1438
41      90
 
1439
42      78967
 
1440
50      56
 
1441
51      34
 
1442
55      123
 
1443
60      13
 
1444
select * from t55 order by colint;
 
1445
colint  col1
 
1446
1       15
 
1447
3       15
 
1448
4       17
 
1449
5       23
 
1450
6       34
 
1451
7       56
 
1452
8       56
 
1453
9       45
 
1454
10      34
 
1455
11      78
 
1456
12      89
 
1457
13      67
 
1458
14      46
 
1459
15      34
 
1460
16      324
 
1461
17      345
 
1462
18      34
 
1463
19      78
 
1464
20      567
 
1465
21      4
 
1466
22      435
 
1467
23      34
 
1468
24      45
 
1469
25      4565
 
1470
26      4
 
1471
27      3
 
1472
28      2
 
1473
29      3
 
1474
30      15
 
1475
31      6
 
1476
32      8
 
1477
33      9
 
1478
34      745
 
1479
35      34
 
1480
36      34
 
1481
37      324
 
1482
38      67
 
1483
39      78
 
1484
40      89
 
1485
41      90
 
1486
42      78967
 
1487
50      56
 
1488
51      34
 
1489
55      123
 
1490
60      13
 
1491
select * from t66 order by colint;
 
1492
colint  col1
 
1493
1       15
 
1494
3       15
 
1495
4       17
 
1496
5       23
 
1497
6       34
 
1498
7       56
 
1499
8       56
 
1500
9       45
 
1501
10      34
 
1502
11      78
 
1503
12      89
 
1504
13      67
 
1505
14      46
 
1506
15      34
 
1507
16      324
 
1508
17      345
 
1509
18      34
 
1510
19      78
 
1511
20      567
 
1512
21      4
 
1513
22      435
 
1514
23      34
 
1515
24      45
 
1516
25      4565
 
1517
26      4
 
1518
27      3
 
1519
28      2
 
1520
29      3
 
1521
30      15
 
1522
31      6
 
1523
32      8
 
1524
33      9
 
1525
34      745
 
1526
35      34
 
1527
36      34
 
1528
37      324
 
1529
38      67
 
1530
39      78
 
1531
40      89
 
1532
41      90
 
1533
42      78967
 
1534
50      56
 
1535
51      34
 
1536
55      123
 
1537
60      13
 
1538
alter table t11 drop partition p0;
 
1539
alter table t22 drop partition p0;
 
1540
alter table t44 drop partition p0;
 
1541
alter table t55 drop partition p0;
 
1542
alter table t66 drop partition p0;
 
1543
select * from t11 order by col1;
 
1544
col1
 
1545
15
 
1546
select * from t22 order by col1;
 
1547
col1
 
1548
13
 
1549
15
 
1550
17
 
1551
select * from t33 order by col1;
 
1552
col1
 
1553
13
 
1554
15
 
1555
17
 
1556
select * from t44 order by colint;
 
1557
colint  col1
 
1558
15      34
 
1559
16      324
 
1560
17      345
 
1561
18      34
 
1562
19      78
 
1563
20      567
 
1564
21      4
 
1565
22      435
 
1566
23      34
 
1567
24      45
 
1568
25      4565
 
1569
26      4
 
1570
27      3
 
1571
28      2
 
1572
29      3
 
1573
30      15
 
1574
31      6
 
1575
32      8
 
1576
33      9
 
1577
34      745
 
1578
35      34
 
1579
36      34
 
1580
37      324
 
1581
38      67
 
1582
39      78
 
1583
40      89
 
1584
41      90
 
1585
42      78967
 
1586
50      56
 
1587
51      34
 
1588
55      123
 
1589
60      13
 
1590
select * from t55 order by colint;
 
1591
colint  col1
 
1592
11      78
 
1593
12      89
 
1594
13      67
 
1595
14      46
 
1596
15      34
 
1597
16      324
 
1598
17      345
 
1599
18      34
 
1600
19      78
 
1601
20      567
 
1602
21      4
 
1603
22      435
 
1604
23      34
 
1605
24      45
 
1606
25      4565
 
1607
26      4
 
1608
27      3
 
1609
28      2
 
1610
29      3
 
1611
30      15
 
1612
31      6
 
1613
32      8
 
1614
33      9
 
1615
34      745
 
1616
35      34
 
1617
36      34
 
1618
37      324
 
1619
38      67
 
1620
39      78
 
1621
40      89
 
1622
41      90
 
1623
42      78967
 
1624
50      56
 
1625
51      34
 
1626
55      123
 
1627
60      13
 
1628
select * from t66 order by colint;
 
1629
colint  col1
 
1630
15      34
 
1631
16      324
 
1632
17      345
 
1633
18      34
 
1634
19      78
 
1635
20      567
 
1636
21      4
 
1637
22      435
 
1638
23      34
 
1639
24      45
 
1640
25      4565
 
1641
26      4
 
1642
27      3
 
1643
28      2
 
1644
29      3
 
1645
30      15
 
1646
31      6
 
1647
32      8
 
1648
33      9
 
1649
34      745
 
1650
35      34
 
1651
36      34
 
1652
37      324
 
1653
38      67
 
1654
39      78
 
1655
40      89
 
1656
41      90
 
1657
42      78967
 
1658
50      56
 
1659
51      34
 
1660
55      123
 
1661
60      13
 
1662
-------------------------
 
1663
---- some alter table end
 
1664
-------------------------
 
1665
drop table if exists t1 ;
 
1666
drop table if exists t2 ;
 
1667
drop table if exists t3 ;
 
1668
drop table if exists t4 ;
 
1669
drop table if exists t5 ;
 
1670
drop table if exists t6 ;
 
1671
drop table if exists t11 ;
 
1672
drop table if exists t22 ;
 
1673
drop table if exists t33 ;
 
1674
drop table if exists t44 ;
 
1675
drop table if exists t55 ;
 
1676
drop table if exists t66 ;
 
1677
-------------------------------------------------------------------------
 
1678
---  ascii(col1)  in partition with coltype  char(1)
 
1679
-------------------------------------------------------------------------
 
1680
drop table if exists t1 ;
 
1681
drop table if exists t2 ;
 
1682
drop table if exists t3 ;
 
1683
drop table if exists t4 ;
 
1684
drop table if exists t5 ;
 
1685
drop table if exists t6 ;
 
1686
-------------------------------------------------------------------------
 
1687
---  Create tables with ascii(col1)
 
1688
-------------------------------------------------------------------------
 
1689
create table t1 (col1 char(1)) engine='NDB' 
 
1690
partition by range(ascii(col1)) 
 
1691
(partition p0 values less than (15),
 
1692
partition p1 values less than maxvalue);
 
1693
create table t2 (col1 char(1)) engine='NDB' 
 
1694
partition by list(ascii(col1)) 
 
1695
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
1696
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
1697
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
1698
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
1699
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
1700
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
1701
);
 
1702
create table t3 (col1 char(1)) engine='NDB' 
 
1703
partition by hash(ascii(col1));
 
1704
create table t4 (colint int, col1 char(1)) engine='NDB' 
 
1705
partition by range(colint) 
 
1706
subpartition by hash(ascii(col1)) subpartitions 2 
 
1707
(partition p0 values less than (15),
 
1708
partition p1 values less than maxvalue);
 
1709
create table t5 (colint int, col1 char(1)) engine='NDB' 
 
1710
partition by list(colint)
 
1711
subpartition by hash(ascii(col1)) subpartitions 2 
 
1712
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
1713
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
1714
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
1715
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
1716
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
1717
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
1718
);
 
1719
create table t6 (colint int, col1 char(1)) engine='NDB' 
 
1720
partition by range(colint) 
 
1721
(partition p0 values less than (ascii('5')),
 
1722
partition p1 values less than maxvalue);
 
1723
-------------------------------------------------------------------------
 
1724
---  Access tables with ascii(col1) 
 
1725
-------------------------------------------------------------------------
 
1726
insert into t1 values ('1');
 
1727
insert into t1 values ('9');
 
1728
insert into t2 values ('1');
 
1729
insert into t2 values ('9');
 
1730
insert into t2 values ('3');
 
1731
insert into t3 values ('1');
 
1732
insert into t3 values ('9');
 
1733
insert into t3 values ('3');
 
1734
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in' into table t4;
 
1735
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in' into table t5;
 
1736
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in' into table t6;
 
1737
select ascii(col1) from t1 order by col1;
 
1738
ascii(col1)
 
1739
49
 
1740
57
 
1741
select * from t1 order by col1;
 
1742
col1
 
1743
1
 
1744
9
 
1745
select * from t2 order by col1;
 
1746
col1
 
1747
1
 
1748
3
 
1749
9
 
1750
select * from t3 order by col1;
 
1751
col1
 
1752
1
 
1753
3
 
1754
9
 
1755
select * from t4 order by colint;
 
1756
colint  col1
 
1757
1       1
 
1758
2       9
 
1759
3       3
 
1760
4       8
 
1761
select * from t5 order by colint;
 
1762
colint  col1
 
1763
1       1
 
1764
2       9
 
1765
3       3
 
1766
4       8
 
1767
select * from t6 order by colint;
 
1768
colint  col1
 
1769
1       1
 
1770
2       9
 
1771
3       3
 
1772
4       8
 
1773
update t1 set col1='8' where col1='1';
 
1774
update t2 set col1='8' where col1='1';
 
1775
update t3 set col1='8' where col1='1';
 
1776
update t4 set col1='8' where col1='1';
 
1777
update t5 set col1='8' where col1='1';
 
1778
update t6 set col1='8' where col1='1';
 
1779
select * from t1 order by col1;
 
1780
col1
 
1781
8
 
1782
9
 
1783
select * from t2 order by col1;
 
1784
col1
 
1785
3
 
1786
8
 
1787
9
 
1788
select * from t3 order by col1;
 
1789
col1
 
1790
3
 
1791
8
 
1792
9
 
1793
select * from t4 order by colint;
 
1794
colint  col1
 
1795
1       8
 
1796
2       9
 
1797
3       3
 
1798
4       8
 
1799
select * from t5 order by colint;
 
1800
colint  col1
 
1801
1       8
 
1802
2       9
 
1803
3       3
 
1804
4       8
 
1805
select * from t6 order by colint;
 
1806
colint  col1
 
1807
1       8
 
1808
2       9
 
1809
3       3
 
1810
4       8
 
1811
-------------------------------------------------------------------------
 
1812
---  Alter tables with ascii(col1)
 
1813
-------------------------------------------------------------------------
 
1814
drop table if exists t11 ;
 
1815
drop table if exists t22 ;
 
1816
drop table if exists t33 ;
 
1817
drop table if exists t44 ;
 
1818
drop table if exists t55 ;
 
1819
drop table if exists t66 ;
 
1820
create table t11 engine='NDB' as select * from t1;
 
1821
create table t22 engine='NDB' as select * from t2;
 
1822
create table t33 engine='NDB' as select * from t3;
 
1823
create table t44 engine='NDB' as select * from t4;
 
1824
create table t55 engine='NDB' as select * from t5;
 
1825
create table t66 engine='NDB' as select * from t6;
 
1826
alter table t11
 
1827
partition by range(ascii(col1)) 
 
1828
(partition p0 values less than (15),
 
1829
partition p1 values less than maxvalue);
 
1830
alter table t22
 
1831
partition by list(ascii(col1)) 
 
1832
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
1833
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
1834
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
1835
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
1836
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
1837
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
1838
);
 
1839
alter table t33
 
1840
partition by hash(ascii(col1));
 
1841
alter table t44
 
1842
partition by range(colint) 
 
1843
subpartition by hash(ascii(col1)) subpartitions 2 
 
1844
(partition p0 values less than (15),
 
1845
partition p1 values less than maxvalue);
 
1846
alter table t55
 
1847
partition by list(colint)
 
1848
subpartition by hash(ascii(col1)) subpartitions 2 
 
1849
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
1850
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
1851
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
1852
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
1853
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
1854
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
1855
);
 
1856
alter table t66
 
1857
partition by range(colint) 
 
1858
(partition p0 values less than (ascii('5')),
 
1859
partition p1 values less than maxvalue);
 
1860
select * from t11 order by col1;
 
1861
col1
 
1862
8
 
1863
9
 
1864
select * from t22 order by col1;
 
1865
col1
 
1866
3
 
1867
8
 
1868
9
 
1869
select * from t33 order by col1;
 
1870
col1
 
1871
3
 
1872
8
 
1873
9
 
1874
select * from t44 order by colint;
 
1875
colint  col1
 
1876
1       8
 
1877
2       9
 
1878
3       3
 
1879
4       8
 
1880
select * from t55 order by colint;
 
1881
colint  col1
 
1882
1       8
 
1883
2       9
 
1884
3       3
 
1885
4       8
 
1886
select * from t66 order by colint;
 
1887
colint  col1
 
1888
1       8
 
1889
2       9
 
1890
3       3
 
1891
4       8
 
1892
---------------------------
 
1893
---- some alter table begin
 
1894
---------------------------
 
1895
alter table t11
 
1896
reorganize partition p0,p1 into
 
1897
(partition s1 values less than maxvalue);
 
1898
select * from t11 order by col1;
 
1899
col1
 
1900
8
 
1901
9
 
1902
alter table t11
 
1903
reorganize partition s1 into
 
1904
(partition p0 values less than (15),
 
1905
partition p1 values less than maxvalue);
 
1906
select * from t11 order by col1;
 
1907
col1
 
1908
8
 
1909
9
 
1910
alter table t55
 
1911
partition by list(colint)
 
1912
subpartition by hash(ascii(col1)) subpartitions 5 
 
1913
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
1914
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
1915
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
1916
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
1917
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
1918
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
1919
);
 
1920
show create table t55;
 
1921
Table   Create Table
 
1922
t55     CREATE TABLE `t55` (
 
1923
  `colint` int(11) DEFAULT NULL,
 
1924
  `col1` char(1) DEFAULT NULL
 
1925
) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (ascii(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
 
1926
select * from t55 order by colint;
 
1927
colint  col1
 
1928
1       8
 
1929
2       9
 
1930
3       3
 
1931
4       8
 
1932
alter table t66
 
1933
reorganize partition p0,p1 into
 
1934
(partition s1 values less than maxvalue);
 
1935
select * from t66 order by colint;
 
1936
colint  col1
 
1937
1       8
 
1938
2       9
 
1939
3       3
 
1940
4       8
 
1941
alter table t66
 
1942
reorganize partition s1 into
 
1943
(partition p0 values less than (ascii('5')),
 
1944
partition p1 values less than maxvalue);
 
1945
select * from t66 order by colint;
 
1946
colint  col1
 
1947
1       8
 
1948
2       9
 
1949
3       3
 
1950
4       8
 
1951
alter table t66
 
1952
reorganize partition p0,p1 into
 
1953
(partition s1 values less than maxvalue);
 
1954
select * from t66 order by colint;
 
1955
colint  col1
 
1956
1       8
 
1957
2       9
 
1958
3       3
 
1959
4       8
 
1960
alter table t66
 
1961
reorganize partition s1 into
 
1962
(partition p0 values less than (ascii('5')),
 
1963
partition p1 values less than maxvalue);
 
1964
select * from t66 order by colint;
 
1965
colint  col1
 
1966
1       8
 
1967
2       9
 
1968
3       3
 
1969
4       8
 
1970
-------------------------------------------------------------------------
 
1971
---  Delete rows and partitions of tables with ascii(col1)
 
1972
-------------------------------------------------------------------------
 
1973
delete from t1 where col1='9';
 
1974
delete from t2 where col1='9';
 
1975
delete from t3 where col1='9';
 
1976
delete from t4 where col1='9';
 
1977
delete from t5 where col1='9';
 
1978
delete from t6 where col1='9';
 
1979
select * from t1 order by col1;
 
1980
col1
 
1981
8
 
1982
select * from t2 order by col1;
 
1983
col1
 
1984
3
 
1985
8
 
1986
select * from t3 order by col1;
 
1987
col1
 
1988
3
 
1989
8
 
1990
select * from t4 order by colint;
 
1991
colint  col1
 
1992
1       8
 
1993
3       3
 
1994
4       8
 
1995
select * from t5 order by colint;
 
1996
colint  col1
 
1997
1       8
 
1998
3       3
 
1999
4       8
 
2000
insert into t1 values ('9');
 
2001
insert into t2 values ('9');
 
2002
insert into t3 values ('9');
 
2003
insert into t4 values (60,'9');
 
2004
insert into t5 values (60,'9');
 
2005
insert into t6 values (60,'9');
 
2006
select * from t1 order by col1;
 
2007
col1
 
2008
8
 
2009
9
 
2010
select * from t2 order by col1;
 
2011
col1
 
2012
3
 
2013
8
 
2014
9
 
2015
select * from t3 order by col1;
 
2016
col1
 
2017
3
 
2018
8
 
2019
9
 
2020
select * from t4 order by colint;
 
2021
colint  col1
 
2022
1       8
 
2023
3       3
 
2024
4       8
 
2025
60      9
 
2026
select * from t5 order by colint;
 
2027
colint  col1
 
2028
1       8
 
2029
3       3
 
2030
4       8
 
2031
60      9
 
2032
select * from t6 order by colint;
 
2033
colint  col1
 
2034
1       8
 
2035
3       3
 
2036
4       8
 
2037
60      9
 
2038
alter table t1 drop partition p0;
 
2039
alter table t2 drop partition p0;
 
2040
alter table t4 drop partition p0;
 
2041
alter table t5 drop partition p0;
 
2042
alter table t6 drop partition p0;
 
2043
select * from t1 order by col1;
 
2044
col1
 
2045
8
 
2046
9
 
2047
select * from t2 order by col1;
 
2048
col1
 
2049
3
 
2050
8
 
2051
9
 
2052
select * from t3 order by col1;
 
2053
col1
 
2054
3
 
2055
8
 
2056
9
 
2057
select * from t4 order by colint;
 
2058
colint  col1
 
2059
60      9
 
2060
select * from t5 order by colint;
 
2061
colint  col1
 
2062
60      9
 
2063
select * from t6 order by colint;
 
2064
colint  col1
 
2065
60      9
 
2066
-------------------------------------------------------------------------
 
2067
---  Delete rows and partitions of tables with ascii(col1)
 
2068
-------------------------------------------------------------------------
 
2069
delete from t11 where col1='9';
 
2070
delete from t22 where col1='9';
 
2071
delete from t33 where col1='9';
 
2072
delete from t44 where col1='9';
 
2073
delete from t55 where col1='9';
 
2074
delete from t66 where col1='9';
 
2075
select * from t11 order by col1;
 
2076
col1
 
2077
8
 
2078
select * from t22 order by col1;
 
2079
col1
 
2080
3
 
2081
8
 
2082
select * from t33 order by col1;
 
2083
col1
 
2084
3
 
2085
8
 
2086
select * from t44 order by colint;
 
2087
colint  col1
 
2088
1       8
 
2089
3       3
 
2090
4       8
 
2091
select * from t55 order by colint;
 
2092
colint  col1
 
2093
1       8
 
2094
3       3
 
2095
4       8
 
2096
insert into t11 values ('9');
 
2097
insert into t22 values ('9');
 
2098
insert into t33 values ('9');
 
2099
insert into t44 values (60,'9');
 
2100
insert into t55 values (60,'9');
 
2101
insert into t66 values (60,'9');
 
2102
select * from t11 order by col1;
 
2103
col1
 
2104
8
 
2105
9
 
2106
select * from t22 order by col1;
 
2107
col1
 
2108
3
 
2109
8
 
2110
9
 
2111
select * from t33 order by col1;
 
2112
col1
 
2113
3
 
2114
8
 
2115
9
 
2116
select * from t44 order by colint;
 
2117
colint  col1
 
2118
1       8
 
2119
3       3
 
2120
4       8
 
2121
60      9
 
2122
select * from t55 order by colint;
 
2123
colint  col1
 
2124
1       8
 
2125
3       3
 
2126
4       8
 
2127
60      9
 
2128
select * from t66 order by colint;
 
2129
colint  col1
 
2130
1       8
 
2131
3       3
 
2132
4       8
 
2133
60      9
 
2134
alter table t11 drop partition p0;
 
2135
alter table t22 drop partition p0;
 
2136
alter table t44 drop partition p0;
 
2137
alter table t55 drop partition p0;
 
2138
alter table t66 drop partition p0;
 
2139
select * from t11 order by col1;
 
2140
col1
 
2141
8
 
2142
9
 
2143
select * from t22 order by col1;
 
2144
col1
 
2145
3
 
2146
8
 
2147
9
 
2148
select * from t33 order by col1;
 
2149
col1
 
2150
3
 
2151
8
 
2152
9
 
2153
select * from t44 order by colint;
 
2154
colint  col1
 
2155
60      9
 
2156
select * from t55 order by colint;
 
2157
colint  col1
 
2158
60      9
 
2159
select * from t66 order by colint;
 
2160
colint  col1
 
2161
60      9
 
2162
-------------------------
 
2163
---- some alter table end
 
2164
-------------------------
 
2165
drop table if exists t1 ;
 
2166
drop table if exists t2 ;
 
2167
drop table if exists t3 ;
 
2168
drop table if exists t4 ;
 
2169
drop table if exists t5 ;
 
2170
drop table if exists t6 ;
 
2171
drop table if exists t11 ;
 
2172
drop table if exists t22 ;
 
2173
drop table if exists t33 ;
 
2174
drop table if exists t44 ;
 
2175
drop table if exists t55 ;
 
2176
drop table if exists t66 ;
 
2177
-------------------------------------------------------------------------
 
2178
---  cast(ceiling(col1) as signed integer)  in partition with coltype  float(7,4)
 
2179
-------------------------------------------------------------------------
 
2180
drop table if exists t1 ;
 
2181
drop table if exists t2 ;
 
2182
drop table if exists t3 ;
 
2183
drop table if exists t4 ;
 
2184
drop table if exists t5 ;
 
2185
drop table if exists t6 ;
 
2186
-------------------------------------------------------------------------
 
2187
---  Create tables with cast(ceiling(col1) as signed integer)
 
2188
-------------------------------------------------------------------------
 
2189
create table t1 (col1 float(7,4)) engine='NDB' 
 
2190
partition by range(cast(ceiling(col1) as signed integer)) 
 
2191
(partition p0 values less than (15),
 
2192
partition p1 values less than maxvalue);
 
2193
create table t2 (col1 float(7,4)) engine='NDB' 
 
2194
partition by list(cast(ceiling(col1) as signed integer)) 
 
2195
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
2196
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
2197
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
2198
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
2199
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
2200
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
2201
);
 
2202
create table t3 (col1 float(7,4)) engine='NDB' 
 
2203
partition by hash(cast(ceiling(col1) as signed integer));
 
2204
create table t4 (colint int, col1 float(7,4)) engine='NDB' 
 
2205
partition by range(colint) 
 
2206
subpartition by hash(cast(ceiling(col1) as signed integer)) subpartitions 2 
 
2207
(partition p0 values less than (15),
 
2208
partition p1 values less than maxvalue);
 
2209
create table t5 (colint int, col1 float(7,4)) engine='NDB' 
 
2210
partition by list(colint)
 
2211
subpartition by hash(cast(ceiling(col1) as signed integer)) subpartitions 2 
 
2212
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
2213
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
2214
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
2215
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
2216
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
2217
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
2218
);
 
2219
create table t6 (colint int, col1 float(7,4)) engine='NDB' 
 
2220
partition by range(colint) 
 
2221
(partition p0 values less than (cast(ceiling(15) as signed integer)),
 
2222
partition p1 values less than maxvalue);
 
2223
-------------------------------------------------------------------------
 
2224
---  Access tables with cast(ceiling(col1) as signed integer) 
 
2225
-------------------------------------------------------------------------
 
2226
insert into t1 values (5.1230);
 
2227
insert into t1 values (13.345);
 
2228
insert into t2 values (5.1230);
 
2229
insert into t2 values (13.345);
 
2230
insert into t2 values (17.987);
 
2231
insert into t3 values (5.1230);
 
2232
insert into t3 values (13.345);
 
2233
insert into t3 values (17.987);
 
2234
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t4;
 
2235
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t5;
 
2236
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t6;
 
2237
select cast(ceiling(col1) as signed integer) from t1 order by col1;
 
2238
cast(ceiling(col1) as signed integer)
 
2239
6
 
2240
14
 
2241
select * from t1 order by col1;
 
2242
col1
 
2243
5.1230
 
2244
13.3450
 
2245
select * from t2 order by col1;
 
2246
col1
 
2247
5.1230
 
2248
13.3450
 
2249
17.9870
 
2250
select * from t3 order by col1;
 
2251
col1
 
2252
5.1230
 
2253
13.3450
 
2254
17.9870
 
2255
select * from t4 order by colint;
 
2256
colint  col1
 
2257
1       5.1230
 
2258
2       13.3450
 
2259
3       17.9870
 
2260
4       15.6540
 
2261
select * from t5 order by colint;
 
2262
colint  col1
 
2263
1       5.1230
 
2264
2       13.3450
 
2265
3       17.9870
 
2266
4       15.6540
 
2267
select * from t6 order by colint;
 
2268
colint  col1
 
2269
1       5.1230
 
2270
2       13.3450
 
2271
3       17.9870
 
2272
4       15.6540
 
2273
update t1 set col1=15.654  where col1=5.1230;
 
2274
update t2 set col1=15.654  where col1=5.1230;
 
2275
update t3 set col1=15.654  where col1=5.1230;
 
2276
update t4 set col1=15.654  where col1=5.1230;
 
2277
update t5 set col1=15.654  where col1=5.1230;
 
2278
update t6 set col1=15.654  where col1=5.1230;
 
2279
select * from t1 order by col1;
 
2280
col1
 
2281
13.3450
 
2282
15.6540
 
2283
select * from t2 order by col1;
 
2284
col1
 
2285
13.3450
 
2286
15.6540
 
2287
17.9870
 
2288
select * from t3 order by col1;
 
2289
col1
 
2290
13.3450
 
2291
15.6540
 
2292
17.9870
 
2293
select * from t4 order by colint;
 
2294
colint  col1
 
2295
1       15.6540
 
2296
2       13.3450
 
2297
3       17.9870
 
2298
4       15.6540
 
2299
select * from t5 order by colint;
 
2300
colint  col1
 
2301
1       15.6540
 
2302
2       13.3450
 
2303
3       17.9870
 
2304
4       15.6540
 
2305
select * from t6 order by colint;
 
2306
colint  col1
 
2307
1       15.6540
 
2308
2       13.3450
 
2309
3       17.9870
 
2310
4       15.6540
 
2311
-------------------------------------------------------------------------
 
2312
---  Alter tables with cast(ceiling(col1) as signed integer)
 
2313
-------------------------------------------------------------------------
 
2314
drop table if exists t11 ;
 
2315
drop table if exists t22 ;
 
2316
drop table if exists t33 ;
 
2317
drop table if exists t44 ;
 
2318
drop table if exists t55 ;
 
2319
drop table if exists t66 ;
 
2320
create table t11 engine='NDB' as select * from t1;
 
2321
create table t22 engine='NDB' as select * from t2;
 
2322
create table t33 engine='NDB' as select * from t3;
 
2323
create table t44 engine='NDB' as select * from t4;
 
2324
create table t55 engine='NDB' as select * from t5;
 
2325
create table t66 engine='NDB' as select * from t6;
 
2326
alter table t11
 
2327
partition by range(cast(ceiling(col1) as signed integer)) 
 
2328
(partition p0 values less than (15),
 
2329
partition p1 values less than maxvalue);
 
2330
alter table t22
 
2331
partition by list(cast(ceiling(col1) as signed integer)) 
 
2332
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
2333
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
2334
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
2335
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
2336
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
2337
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
2338
);
 
2339
alter table t33
 
2340
partition by hash(cast(ceiling(col1) as signed integer));
 
2341
alter table t44
 
2342
partition by range(colint) 
 
2343
subpartition by hash(cast(ceiling(col1) as signed integer)) subpartitions 2 
 
2344
(partition p0 values less than (15),
 
2345
partition p1 values less than maxvalue);
 
2346
alter table t55
 
2347
partition by list(colint)
 
2348
subpartition by hash(cast(ceiling(col1) as signed integer)) subpartitions 2 
 
2349
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
2350
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
2351
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
2352
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
2353
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
2354
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
2355
);
 
2356
alter table t66
 
2357
partition by range(colint) 
 
2358
(partition p0 values less than (cast(ceiling(15) as signed integer)),
 
2359
partition p1 values less than maxvalue);
 
2360
select * from t11 order by col1;
 
2361
col1
 
2362
13.3450
 
2363
15.6540
 
2364
select * from t22 order by col1;
 
2365
col1
 
2366
13.3450
 
2367
15.6540
 
2368
17.9870
 
2369
select * from t33 order by col1;
 
2370
col1
 
2371
13.3450
 
2372
15.6540
 
2373
17.9870
 
2374
select * from t44 order by colint;
 
2375
colint  col1
 
2376
1       15.6540
 
2377
2       13.3450
 
2378
3       17.9870
 
2379
4       15.6540
 
2380
select * from t55 order by colint;
 
2381
colint  col1
 
2382
1       15.6540
 
2383
2       13.3450
 
2384
3       17.9870
 
2385
4       15.6540
 
2386
select * from t66 order by colint;
 
2387
colint  col1
 
2388
1       15.6540
 
2389
2       13.3450
 
2390
3       17.9870
 
2391
4       15.6540
 
2392
---------------------------
 
2393
---- some alter table begin
 
2394
---------------------------
 
2395
alter table t11
 
2396
reorganize partition p0,p1 into
 
2397
(partition s1 values less than maxvalue);
 
2398
select * from t11 order by col1;
 
2399
col1
 
2400
13.3450
 
2401
15.6540
 
2402
alter table t11
 
2403
reorganize partition s1 into
 
2404
(partition p0 values less than (15),
 
2405
partition p1 values less than maxvalue);
 
2406
select * from t11 order by col1;
 
2407
col1
 
2408
13.3450
 
2409
15.6540
 
2410
alter table t55
 
2411
partition by list(colint)
 
2412
subpartition by hash(cast(ceiling(col1) as signed integer)) subpartitions 5 
 
2413
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
2414
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
2415
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
2416
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
2417
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
2418
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
2419
);
 
2420
show create table t55;
 
2421
Table   Create Table
 
2422
t55     CREATE TABLE `t55` (
 
2423
  `colint` int(11) DEFAULT NULL,
 
2424
  `col1` float(7,4) DEFAULT NULL
 
2425
) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (cast(ceiling(col1) as signed integer)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
 
2426
select * from t55 order by colint;
 
2427
colint  col1
 
2428
1       15.6540
 
2429
2       13.3450
 
2430
3       17.9870
 
2431
4       15.6540
 
2432
alter table t66
 
2433
reorganize partition p0,p1 into
 
2434
(partition s1 values less than maxvalue);
 
2435
select * from t66 order by colint;
 
2436
colint  col1
 
2437
1       15.6540
 
2438
2       13.3450
 
2439
3       17.9870
 
2440
4       15.6540
 
2441
alter table t66
 
2442
reorganize partition s1 into
 
2443
(partition p0 values less than (cast(ceiling(15) as signed integer)),
 
2444
partition p1 values less than maxvalue);
 
2445
select * from t66 order by colint;
 
2446
colint  col1
 
2447
1       15.6540
 
2448
2       13.3450
 
2449
3       17.9870
 
2450
4       15.6540
 
2451
alter table t66
 
2452
reorganize partition p0,p1 into
 
2453
(partition s1 values less than maxvalue);
 
2454
select * from t66 order by colint;
 
2455
colint  col1
 
2456
1       15.6540
 
2457
2       13.3450
 
2458
3       17.9870
 
2459
4       15.6540
 
2460
alter table t66
 
2461
reorganize partition s1 into
 
2462
(partition p0 values less than (cast(ceiling(15) as signed integer)),
 
2463
partition p1 values less than maxvalue);
 
2464
select * from t66 order by colint;
 
2465
colint  col1
 
2466
1       15.6540
 
2467
2       13.3450
 
2468
3       17.9870
 
2469
4       15.6540
 
2470
-------------------------------------------------------------------------
 
2471
---  Delete rows and partitions of tables with cast(ceiling(col1) as signed integer)
 
2472
-------------------------------------------------------------------------
 
2473
delete from t1 where col1=13.345;
 
2474
delete from t2 where col1=13.345;
 
2475
delete from t3 where col1=13.345;
 
2476
delete from t4 where col1=13.345;
 
2477
delete from t5 where col1=13.345;
 
2478
delete from t6 where col1=13.345;
 
2479
select * from t1 order by col1;
 
2480
col1
 
2481
15.6540
 
2482
select * from t2 order by col1;
 
2483
col1
 
2484
15.6540
 
2485
17.9870
 
2486
select * from t3 order by col1;
 
2487
col1
 
2488
15.6540
 
2489
17.9870
 
2490
select * from t4 order by colint;
 
2491
colint  col1
 
2492
1       15.6540
 
2493
3       17.9870
 
2494
4       15.6540
 
2495
select * from t5 order by colint;
 
2496
colint  col1
 
2497
1       15.6540
 
2498
3       17.9870
 
2499
4       15.6540
 
2500
insert into t1 values (13.345);
 
2501
insert into t2 values (13.345);
 
2502
insert into t3 values (13.345);
 
2503
insert into t4 values (60,13.345);
 
2504
insert into t5 values (60,13.345);
 
2505
insert into t6 values (60,13.345);
 
2506
select * from t1 order by col1;
 
2507
col1
 
2508
13.3450
 
2509
15.6540
 
2510
select * from t2 order by col1;
 
2511
col1
 
2512
13.3450
 
2513
15.6540
 
2514
17.9870
 
2515
select * from t3 order by col1;
 
2516
col1
 
2517
13.3450
 
2518
15.6540
 
2519
17.9870
 
2520
select * from t4 order by colint;
 
2521
colint  col1
 
2522
1       15.6540
 
2523
3       17.9870
 
2524
4       15.6540
 
2525
60      13.3450
 
2526
select * from t5 order by colint;
 
2527
colint  col1
 
2528
1       15.6540
 
2529
3       17.9870
 
2530
4       15.6540
 
2531
60      13.3450
 
2532
select * from t6 order by colint;
 
2533
colint  col1
 
2534
1       15.6540
 
2535
3       17.9870
 
2536
4       15.6540
 
2537
60      13.3450
 
2538
alter table t1 drop partition p0;
 
2539
alter table t2 drop partition p0;
 
2540
alter table t4 drop partition p0;
 
2541
alter table t5 drop partition p0;
 
2542
alter table t6 drop partition p0;
 
2543
select * from t1 order by col1;
 
2544
col1
 
2545
15.6540
 
2546
select * from t2 order by col1;
 
2547
col1
 
2548
13.3450
 
2549
15.6540
 
2550
17.9870
 
2551
select * from t3 order by col1;
 
2552
col1
 
2553
13.3450
 
2554
15.6540
 
2555
17.9870
 
2556
select * from t4 order by colint;
 
2557
colint  col1
 
2558
60      13.3450
 
2559
select * from t5 order by colint;
 
2560
colint  col1
 
2561
60      13.3450
 
2562
select * from t6 order by colint;
 
2563
colint  col1
 
2564
60      13.3450
 
2565
-------------------------------------------------------------------------
 
2566
---  Delete rows and partitions of tables with cast(ceiling(col1) as signed integer)
 
2567
-------------------------------------------------------------------------
 
2568
delete from t11 where col1=13.345;
 
2569
delete from t22 where col1=13.345;
 
2570
delete from t33 where col1=13.345;
 
2571
delete from t44 where col1=13.345;
 
2572
delete from t55 where col1=13.345;
 
2573
delete from t66 where col1=13.345;
 
2574
select * from t11 order by col1;
 
2575
col1
 
2576
15.6540
 
2577
select * from t22 order by col1;
 
2578
col1
 
2579
15.6540
 
2580
17.9870
 
2581
select * from t33 order by col1;
 
2582
col1
 
2583
15.6540
 
2584
17.9870
 
2585
select * from t44 order by colint;
 
2586
colint  col1
 
2587
1       15.6540
 
2588
3       17.9870
 
2589
4       15.6540
 
2590
select * from t55 order by colint;
 
2591
colint  col1
 
2592
1       15.6540
 
2593
3       17.9870
 
2594
4       15.6540
 
2595
insert into t11 values (13.345);
 
2596
insert into t22 values (13.345);
 
2597
insert into t33 values (13.345);
 
2598
insert into t44 values (60,13.345);
 
2599
insert into t55 values (60,13.345);
 
2600
insert into t66 values (60,13.345);
 
2601
select * from t11 order by col1;
 
2602
col1
 
2603
13.3450
 
2604
15.6540
 
2605
select * from t22 order by col1;
 
2606
col1
 
2607
13.3450
 
2608
15.6540
 
2609
17.9870
 
2610
select * from t33 order by col1;
 
2611
col1
 
2612
13.3450
 
2613
15.6540
 
2614
17.9870
 
2615
select * from t44 order by colint;
 
2616
colint  col1
 
2617
1       15.6540
 
2618
3       17.9870
 
2619
4       15.6540
 
2620
60      13.3450
 
2621
select * from t55 order by colint;
 
2622
colint  col1
 
2623
1       15.6540
 
2624
3       17.9870
 
2625
4       15.6540
 
2626
60      13.3450
 
2627
select * from t66 order by colint;
 
2628
colint  col1
 
2629
1       15.6540
 
2630
3       17.9870
 
2631
4       15.6540
 
2632
60      13.3450
 
2633
alter table t11 drop partition p0;
 
2634
alter table t22 drop partition p0;
 
2635
alter table t44 drop partition p0;
 
2636
alter table t55 drop partition p0;
 
2637
alter table t66 drop partition p0;
 
2638
select * from t11 order by col1;
 
2639
col1
 
2640
15.6540
 
2641
select * from t22 order by col1;
 
2642
col1
 
2643
13.3450
 
2644
15.6540
 
2645
17.9870
 
2646
select * from t33 order by col1;
 
2647
col1
 
2648
13.3450
 
2649
15.6540
 
2650
17.9870
 
2651
select * from t44 order by colint;
 
2652
colint  col1
 
2653
60      13.3450
 
2654
select * from t55 order by colint;
 
2655
colint  col1
 
2656
60      13.3450
 
2657
select * from t66 order by colint;
 
2658
colint  col1
 
2659
60      13.3450
 
2660
-------------------------
 
2661
---- some alter table end
 
2662
-------------------------
 
2663
drop table if exists t1 ;
 
2664
drop table if exists t2 ;
 
2665
drop table if exists t3 ;
 
2666
drop table if exists t4 ;
 
2667
drop table if exists t5 ;
 
2668
drop table if exists t6 ;
 
2669
drop table if exists t11 ;
 
2670
drop table if exists t22 ;
 
2671
drop table if exists t33 ;
 
2672
drop table if exists t44 ;
 
2673
drop table if exists t55 ;
 
2674
drop table if exists t66 ;
 
2675
-------------------------------------------------------------------------
 
2676
---  cast(floor(col1) as signed)  in partition with coltype  float(7,4)
 
2677
-------------------------------------------------------------------------
 
2678
drop table if exists t1 ;
 
2679
drop table if exists t2 ;
 
2680
drop table if exists t3 ;
 
2681
drop table if exists t4 ;
 
2682
drop table if exists t5 ;
 
2683
drop table if exists t6 ;
 
2684
-------------------------------------------------------------------------
 
2685
---  Create tables with cast(floor(col1) as signed)
 
2686
-------------------------------------------------------------------------
 
2687
create table t1 (col1 float(7,4)) engine='NDB' 
 
2688
partition by range(cast(floor(col1) as signed)) 
 
2689
(partition p0 values less than (15),
 
2690
partition p1 values less than maxvalue);
 
2691
create table t2 (col1 float(7,4)) engine='NDB' 
 
2692
partition by list(cast(floor(col1) as signed)) 
 
2693
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
2694
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
2695
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
2696
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
2697
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
2698
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
2699
);
 
2700
create table t3 (col1 float(7,4)) engine='NDB' 
 
2701
partition by hash(cast(floor(col1) as signed));
 
2702
create table t4 (colint int, col1 float(7,4)) engine='NDB' 
 
2703
partition by range(colint) 
 
2704
subpartition by hash(cast(floor(col1) as signed)) subpartitions 2 
 
2705
(partition p0 values less than (15),
 
2706
partition p1 values less than maxvalue);
 
2707
create table t5 (colint int, col1 float(7,4)) engine='NDB' 
 
2708
partition by list(colint)
 
2709
subpartition by hash(cast(floor(col1) as signed)) subpartitions 2 
 
2710
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
2711
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
2712
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
2713
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
2714
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
2715
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
2716
);
 
2717
create table t6 (colint int, col1 float(7,4)) engine='NDB' 
 
2718
partition by range(colint) 
 
2719
(partition p0 values less than (cast(floor(15.123) as signed)),
 
2720
partition p1 values less than maxvalue);
 
2721
-------------------------------------------------------------------------
 
2722
---  Access tables with cast(floor(col1) as signed) 
 
2723
-------------------------------------------------------------------------
 
2724
insert into t1 values (5.1230);
 
2725
insert into t1 values (13.345);
 
2726
insert into t2 values (5.1230);
 
2727
insert into t2 values (13.345);
 
2728
insert into t2 values (17.987);
 
2729
insert into t3 values (5.1230);
 
2730
insert into t3 values (13.345);
 
2731
insert into t3 values (17.987);
 
2732
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t4;
 
2733
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t5;
 
2734
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t6;
 
2735
select cast(floor(col1) as signed) from t1 order by col1;
 
2736
cast(floor(col1) as signed)
 
2737
5
 
2738
13
 
2739
select * from t1 order by col1;
 
2740
col1
 
2741
5.1230
 
2742
13.3450
 
2743
select * from t2 order by col1;
 
2744
col1
 
2745
5.1230
 
2746
13.3450
 
2747
17.9870
 
2748
select * from t3 order by col1;
 
2749
col1
 
2750
5.1230
 
2751
13.3450
 
2752
17.9870
 
2753
select * from t4 order by colint;
 
2754
colint  col1
 
2755
1       5.1230
 
2756
2       13.3450
 
2757
3       17.9870
 
2758
4       15.6540
 
2759
select * from t5 order by colint;
 
2760
colint  col1
 
2761
1       5.1230
 
2762
2       13.3450
 
2763
3       17.9870
 
2764
4       15.6540
 
2765
select * from t6 order by colint;
 
2766
colint  col1
 
2767
1       5.1230
 
2768
2       13.3450
 
2769
3       17.9870
 
2770
4       15.6540
 
2771
update t1 set col1=15.654  where col1=5.1230;
 
2772
update t2 set col1=15.654  where col1=5.1230;
 
2773
update t3 set col1=15.654  where col1=5.1230;
 
2774
update t4 set col1=15.654  where col1=5.1230;
 
2775
update t5 set col1=15.654  where col1=5.1230;
 
2776
update t6 set col1=15.654  where col1=5.1230;
 
2777
select * from t1 order by col1;
 
2778
col1
 
2779
13.3450
 
2780
15.6540
 
2781
select * from t2 order by col1;
 
2782
col1
 
2783
13.3450
 
2784
15.6540
 
2785
17.9870
 
2786
select * from t3 order by col1;
 
2787
col1
 
2788
13.3450
 
2789
15.6540
 
2790
17.9870
 
2791
select * from t4 order by colint;
 
2792
colint  col1
 
2793
1       15.6540
 
2794
2       13.3450
 
2795
3       17.9870
 
2796
4       15.6540
 
2797
select * from t5 order by colint;
 
2798
colint  col1
 
2799
1       15.6540
 
2800
2       13.3450
 
2801
3       17.9870
 
2802
4       15.6540
 
2803
select * from t6 order by colint;
 
2804
colint  col1
 
2805
1       15.6540
 
2806
2       13.3450
 
2807
3       17.9870
 
2808
4       15.6540
 
2809
-------------------------------------------------------------------------
 
2810
---  Alter tables with cast(floor(col1) as signed)
 
2811
-------------------------------------------------------------------------
 
2812
drop table if exists t11 ;
 
2813
drop table if exists t22 ;
 
2814
drop table if exists t33 ;
 
2815
drop table if exists t44 ;
 
2816
drop table if exists t55 ;
 
2817
drop table if exists t66 ;
 
2818
create table t11 engine='NDB' as select * from t1;
 
2819
create table t22 engine='NDB' as select * from t2;
 
2820
create table t33 engine='NDB' as select * from t3;
 
2821
create table t44 engine='NDB' as select * from t4;
 
2822
create table t55 engine='NDB' as select * from t5;
 
2823
create table t66 engine='NDB' as select * from t6;
 
2824
alter table t11
 
2825
partition by range(cast(floor(col1) as signed)) 
 
2826
(partition p0 values less than (15),
 
2827
partition p1 values less than maxvalue);
 
2828
alter table t22
 
2829
partition by list(cast(floor(col1) as signed)) 
 
2830
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
2831
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
2832
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
2833
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
2834
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
2835
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
2836
);
 
2837
alter table t33
 
2838
partition by hash(cast(floor(col1) as signed));
 
2839
alter table t44
 
2840
partition by range(colint) 
 
2841
subpartition by hash(cast(floor(col1) as signed)) subpartitions 2 
 
2842
(partition p0 values less than (15),
 
2843
partition p1 values less than maxvalue);
 
2844
alter table t55
 
2845
partition by list(colint)
 
2846
subpartition by hash(cast(floor(col1) as signed)) subpartitions 2 
 
2847
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
2848
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
2849
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
2850
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
2851
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
2852
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
2853
);
 
2854
alter table t66
 
2855
partition by range(colint) 
 
2856
(partition p0 values less than (cast(floor(15.123) as signed)),
 
2857
partition p1 values less than maxvalue);
 
2858
select * from t11 order by col1;
 
2859
col1
 
2860
13.3450
 
2861
15.6540
 
2862
select * from t22 order by col1;
 
2863
col1
 
2864
13.3450
 
2865
15.6540
 
2866
17.9870
 
2867
select * from t33 order by col1;
 
2868
col1
 
2869
13.3450
 
2870
15.6540
 
2871
17.9870
 
2872
select * from t44 order by colint;
 
2873
colint  col1
 
2874
1       15.6540
 
2875
2       13.3450
 
2876
3       17.9870
 
2877
4       15.6540
 
2878
select * from t55 order by colint;
 
2879
colint  col1
 
2880
1       15.6540
 
2881
2       13.3450
 
2882
3       17.9870
 
2883
4       15.6540
 
2884
select * from t66 order by colint;
 
2885
colint  col1
 
2886
1       15.6540
 
2887
2       13.3450
 
2888
3       17.9870
 
2889
4       15.6540
 
2890
---------------------------
 
2891
---- some alter table begin
 
2892
---------------------------
 
2893
alter table t11
 
2894
reorganize partition p0,p1 into
 
2895
(partition s1 values less than maxvalue);
 
2896
select * from t11 order by col1;
 
2897
col1
 
2898
13.3450
 
2899
15.6540
 
2900
alter table t11
 
2901
reorganize partition s1 into
 
2902
(partition p0 values less than (15),
 
2903
partition p1 values less than maxvalue);
 
2904
select * from t11 order by col1;
 
2905
col1
 
2906
13.3450
 
2907
15.6540
 
2908
alter table t55
 
2909
partition by list(colint)
 
2910
subpartition by hash(cast(floor(col1) as signed)) subpartitions 5 
 
2911
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
2912
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
2913
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
2914
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
2915
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
2916
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
2917
);
 
2918
show create table t55;
 
2919
Table   Create Table
 
2920
t55     CREATE TABLE `t55` (
 
2921
  `colint` int(11) DEFAULT NULL,
 
2922
  `col1` float(7,4) DEFAULT NULL
 
2923
) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (cast(floor(col1) as signed)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
 
2924
select * from t55 order by colint;
 
2925
colint  col1
 
2926
1       15.6540
 
2927
2       13.3450
 
2928
3       17.9870
 
2929
4       15.6540
 
2930
alter table t66
 
2931
reorganize partition p0,p1 into
 
2932
(partition s1 values less than maxvalue);
 
2933
select * from t66 order by colint;
 
2934
colint  col1
 
2935
1       15.6540
 
2936
2       13.3450
 
2937
3       17.9870
 
2938
4       15.6540
 
2939
alter table t66
 
2940
reorganize partition s1 into
 
2941
(partition p0 values less than (cast(floor(15.123) as signed)),
 
2942
partition p1 values less than maxvalue);
 
2943
select * from t66 order by colint;
 
2944
colint  col1
 
2945
1       15.6540
 
2946
2       13.3450
 
2947
3       17.9870
 
2948
4       15.6540
 
2949
alter table t66
 
2950
reorganize partition p0,p1 into
 
2951
(partition s1 values less than maxvalue);
 
2952
select * from t66 order by colint;
 
2953
colint  col1
 
2954
1       15.6540
 
2955
2       13.3450
 
2956
3       17.9870
 
2957
4       15.6540
 
2958
alter table t66
 
2959
reorganize partition s1 into
 
2960
(partition p0 values less than (cast(floor(15.123) as signed)),
 
2961
partition p1 values less than maxvalue);
 
2962
select * from t66 order by colint;
 
2963
colint  col1
 
2964
1       15.6540
 
2965
2       13.3450
 
2966
3       17.9870
 
2967
4       15.6540
 
2968
-------------------------------------------------------------------------
 
2969
---  Delete rows and partitions of tables with cast(floor(col1) as signed)
 
2970
-------------------------------------------------------------------------
 
2971
delete from t1 where col1=13.345;
 
2972
delete from t2 where col1=13.345;
 
2973
delete from t3 where col1=13.345;
 
2974
delete from t4 where col1=13.345;
 
2975
delete from t5 where col1=13.345;
 
2976
delete from t6 where col1=13.345;
 
2977
select * from t1 order by col1;
 
2978
col1
 
2979
15.6540
 
2980
select * from t2 order by col1;
 
2981
col1
 
2982
15.6540
 
2983
17.9870
 
2984
select * from t3 order by col1;
 
2985
col1
 
2986
15.6540
 
2987
17.9870
 
2988
select * from t4 order by colint;
 
2989
colint  col1
 
2990
1       15.6540
 
2991
3       17.9870
 
2992
4       15.6540
 
2993
select * from t5 order by colint;
 
2994
colint  col1
 
2995
1       15.6540
 
2996
3       17.9870
 
2997
4       15.6540
 
2998
insert into t1 values (13.345);
 
2999
insert into t2 values (13.345);
 
3000
insert into t3 values (13.345);
 
3001
insert into t4 values (60,13.345);
 
3002
insert into t5 values (60,13.345);
 
3003
insert into t6 values (60,13.345);
 
3004
select * from t1 order by col1;
 
3005
col1
 
3006
13.3450
 
3007
15.6540
 
3008
select * from t2 order by col1;
 
3009
col1
 
3010
13.3450
 
3011
15.6540
 
3012
17.9870
 
3013
select * from t3 order by col1;
 
3014
col1
 
3015
13.3450
 
3016
15.6540
 
3017
17.9870
 
3018
select * from t4 order by colint;
 
3019
colint  col1
 
3020
1       15.6540
 
3021
3       17.9870
 
3022
4       15.6540
 
3023
60      13.3450
 
3024
select * from t5 order by colint;
 
3025
colint  col1
 
3026
1       15.6540
 
3027
3       17.9870
 
3028
4       15.6540
 
3029
60      13.3450
 
3030
select * from t6 order by colint;
 
3031
colint  col1
 
3032
1       15.6540
 
3033
3       17.9870
 
3034
4       15.6540
 
3035
60      13.3450
 
3036
alter table t1 drop partition p0;
 
3037
alter table t2 drop partition p0;
 
3038
alter table t4 drop partition p0;
 
3039
alter table t5 drop partition p0;
 
3040
alter table t6 drop partition p0;
 
3041
select * from t1 order by col1;
 
3042
col1
 
3043
15.6540
 
3044
select * from t2 order by col1;
 
3045
col1
 
3046
13.3450
 
3047
15.6540
 
3048
17.9870
 
3049
select * from t3 order by col1;
 
3050
col1
 
3051
13.3450
 
3052
15.6540
 
3053
17.9870
 
3054
select * from t4 order by colint;
 
3055
colint  col1
 
3056
60      13.3450
 
3057
select * from t5 order by colint;
 
3058
colint  col1
 
3059
60      13.3450
 
3060
select * from t6 order by colint;
 
3061
colint  col1
 
3062
60      13.3450
 
3063
-------------------------------------------------------------------------
 
3064
---  Delete rows and partitions of tables with cast(floor(col1) as signed)
 
3065
-------------------------------------------------------------------------
 
3066
delete from t11 where col1=13.345;
 
3067
delete from t22 where col1=13.345;
 
3068
delete from t33 where col1=13.345;
 
3069
delete from t44 where col1=13.345;
 
3070
delete from t55 where col1=13.345;
 
3071
delete from t66 where col1=13.345;
 
3072
select * from t11 order by col1;
 
3073
col1
 
3074
15.6540
 
3075
select * from t22 order by col1;
 
3076
col1
 
3077
15.6540
 
3078
17.9870
 
3079
select * from t33 order by col1;
 
3080
col1
 
3081
15.6540
 
3082
17.9870
 
3083
select * from t44 order by colint;
 
3084
colint  col1
 
3085
1       15.6540
 
3086
3       17.9870
 
3087
4       15.6540
 
3088
select * from t55 order by colint;
 
3089
colint  col1
 
3090
1       15.6540
 
3091
3       17.9870
 
3092
4       15.6540
 
3093
insert into t11 values (13.345);
 
3094
insert into t22 values (13.345);
 
3095
insert into t33 values (13.345);
 
3096
insert into t44 values (60,13.345);
 
3097
insert into t55 values (60,13.345);
 
3098
insert into t66 values (60,13.345);
 
3099
select * from t11 order by col1;
 
3100
col1
 
3101
13.3450
 
3102
15.6540
 
3103
select * from t22 order by col1;
 
3104
col1
 
3105
13.3450
 
3106
15.6540
 
3107
17.9870
 
3108
select * from t33 order by col1;
 
3109
col1
 
3110
13.3450
 
3111
15.6540
 
3112
17.9870
 
3113
select * from t44 order by colint;
 
3114
colint  col1
 
3115
1       15.6540
 
3116
3       17.9870
 
3117
4       15.6540
 
3118
60      13.3450
 
3119
select * from t55 order by colint;
 
3120
colint  col1
 
3121
1       15.6540
 
3122
3       17.9870
 
3123
4       15.6540
 
3124
60      13.3450
 
3125
select * from t66 order by colint;
 
3126
colint  col1
 
3127
1       15.6540
 
3128
3       17.9870
 
3129
4       15.6540
 
3130
60      13.3450
 
3131
alter table t11 drop partition p0;
 
3132
alter table t22 drop partition p0;
 
3133
alter table t44 drop partition p0;
 
3134
alter table t55 drop partition p0;
 
3135
alter table t66 drop partition p0;
 
3136
select * from t11 order by col1;
 
3137
col1
 
3138
15.6540
 
3139
select * from t22 order by col1;
 
3140
col1
 
3141
13.3450
 
3142
15.6540
 
3143
17.9870
 
3144
select * from t33 order by col1;
 
3145
col1
 
3146
13.3450
 
3147
15.6540
 
3148
17.9870
 
3149
select * from t44 order by colint;
 
3150
colint  col1
 
3151
60      13.3450
 
3152
select * from t55 order by colint;
 
3153
colint  col1
 
3154
60      13.3450
 
3155
select * from t66 order by colint;
 
3156
colint  col1
 
3157
60      13.3450
 
3158
-------------------------
 
3159
---- some alter table end
 
3160
-------------------------
 
3161
drop table if exists t1 ;
 
3162
drop table if exists t2 ;
 
3163
drop table if exists t3 ;
 
3164
drop table if exists t4 ;
 
3165
drop table if exists t5 ;
 
3166
drop table if exists t6 ;
 
3167
drop table if exists t11 ;
 
3168
drop table if exists t22 ;
 
3169
drop table if exists t33 ;
 
3170
drop table if exists t44 ;
 
3171
drop table if exists t55 ;
 
3172
drop table if exists t66 ;
 
3173
-------------------------------------------------------------------------
 
3174
---  cast(mod(col1,10) as signed)  in partition with coltype  float(7,4)
 
3175
-------------------------------------------------------------------------
 
3176
drop table if exists t1 ;
 
3177
drop table if exists t2 ;
 
3178
drop table if exists t3 ;
 
3179
drop table if exists t4 ;
 
3180
drop table if exists t5 ;
 
3181
drop table if exists t6 ;
 
3182
-------------------------------------------------------------------------
 
3183
---  Create tables with cast(mod(col1,10) as signed)
 
3184
-------------------------------------------------------------------------
 
3185
create table t1 (col1 float(7,4)) engine='NDB' 
 
3186
partition by range(cast(mod(col1,10) as signed)) 
 
3187
(partition p0 values less than (15),
 
3188
partition p1 values less than maxvalue);
 
3189
create table t2 (col1 float(7,4)) engine='NDB' 
 
3190
partition by list(cast(mod(col1,10) as signed)) 
 
3191
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
3192
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
3193
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
3194
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
3195
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
3196
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
3197
);
 
3198
create table t3 (col1 float(7,4)) engine='NDB' 
 
3199
partition by hash(cast(mod(col1,10) as signed));
 
3200
create table t4 (colint int, col1 float(7,4)) engine='NDB' 
 
3201
partition by range(colint) 
 
3202
subpartition by hash(cast(mod(col1,10) as signed)) subpartitions 2 
 
3203
(partition p0 values less than (15),
 
3204
partition p1 values less than maxvalue);
 
3205
create table t5 (colint int, col1 float(7,4)) engine='NDB' 
 
3206
partition by list(colint)
 
3207
subpartition by hash(cast(mod(col1,10) as signed)) subpartitions 2 
 
3208
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
3209
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
3210
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
3211
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
3212
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
3213
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
3214
);
 
3215
create table t6 (colint int, col1 float(7,4)) engine='NDB' 
 
3216
partition by range(colint) 
 
3217
(partition p0 values less than (cast(mod(15,10) as signed)),
 
3218
partition p1 values less than maxvalue);
 
3219
-------------------------------------------------------------------------
 
3220
---  Access tables with cast(mod(col1,10) as signed) 
 
3221
-------------------------------------------------------------------------
 
3222
insert into t1 values (5.0000);
 
3223
insert into t1 values (19);
 
3224
insert into t2 values (5.0000);
 
3225
insert into t2 values (19);
 
3226
insert into t2 values (17);
 
3227
insert into t3 values (5.0000);
 
3228
insert into t3 values (19);
 
3229
insert into t3 values (17);
 
3230
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t4;
 
3231
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t5;
 
3232
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t6;
 
3233
select cast(mod(col1,10) as signed) from t1 order by col1;
 
3234
cast(mod(col1,10) as signed)
 
3235
5
 
3236
9
 
3237
select * from t1 order by col1;
 
3238
col1
 
3239
5.0000
 
3240
19.0000
 
3241
select * from t2 order by col1;
 
3242
col1
 
3243
5.0000
 
3244
17.0000
 
3245
19.0000
 
3246
select * from t3 order by col1;
 
3247
col1
 
3248
5.0000
 
3249
17.0000
 
3250
19.0000
 
3251
select * from t4 order by colint;
 
3252
colint  col1
 
3253
1       5.1230
 
3254
2       13.3450
 
3255
3       17.9870
 
3256
4       15.6540
 
3257
select * from t5 order by colint;
 
3258
colint  col1
 
3259
1       5.1230
 
3260
2       13.3450
 
3261
3       17.9870
 
3262
4       15.6540
 
3263
select * from t6 order by colint;
 
3264
colint  col1
 
3265
1       5.1230
 
3266
2       13.3450
 
3267
3       17.9870
 
3268
4       15.6540
 
3269
update t1 set col1=15  where col1=5.0000;
 
3270
update t2 set col1=15  where col1=5.0000;
 
3271
update t3 set col1=15  where col1=5.0000;
 
3272
update t4 set col1=15  where col1=5.0000;
 
3273
update t5 set col1=15  where col1=5.0000;
 
3274
update t6 set col1=15  where col1=5.0000;
 
3275
select * from t1 order by col1;
 
3276
col1
 
3277
15.0000
 
3278
19.0000
 
3279
select * from t2 order by col1;
 
3280
col1
 
3281
15.0000
 
3282
17.0000
 
3283
19.0000
 
3284
select * from t3 order by col1;
 
3285
col1
 
3286
15.0000
 
3287
17.0000
 
3288
19.0000
 
3289
select * from t4 order by colint;
 
3290
colint  col1
 
3291
1       5.1230
 
3292
2       13.3450
 
3293
3       17.9870
 
3294
4       15.6540
 
3295
select * from t5 order by colint;
 
3296
colint  col1
 
3297
1       5.1230
 
3298
2       13.3450
 
3299
3       17.9870
 
3300
4       15.6540
 
3301
select * from t6 order by colint;
 
3302
colint  col1
 
3303
1       5.1230
 
3304
2       13.3450
 
3305
3       17.9870
 
3306
4       15.6540
 
3307
-------------------------------------------------------------------------
 
3308
---  Alter tables with cast(mod(col1,10) as signed)
 
3309
-------------------------------------------------------------------------
 
3310
drop table if exists t11 ;
 
3311
drop table if exists t22 ;
 
3312
drop table if exists t33 ;
 
3313
drop table if exists t44 ;
 
3314
drop table if exists t55 ;
 
3315
drop table if exists t66 ;
 
3316
create table t11 engine='NDB' as select * from t1;
 
3317
create table t22 engine='NDB' as select * from t2;
 
3318
create table t33 engine='NDB' as select * from t3;
 
3319
create table t44 engine='NDB' as select * from t4;
 
3320
create table t55 engine='NDB' as select * from t5;
 
3321
create table t66 engine='NDB' as select * from t6;
 
3322
alter table t11
 
3323
partition by range(cast(mod(col1,10) as signed)) 
 
3324
(partition p0 values less than (15),
 
3325
partition p1 values less than maxvalue);
 
3326
alter table t22
 
3327
partition by list(cast(mod(col1,10) as signed)) 
 
3328
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
3329
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
3330
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
3331
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
3332
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
3333
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
3334
);
 
3335
alter table t33
 
3336
partition by hash(cast(mod(col1,10) as signed));
 
3337
alter table t44
 
3338
partition by range(colint) 
 
3339
subpartition by hash(cast(mod(col1,10) as signed)) subpartitions 2 
 
3340
(partition p0 values less than (15),
 
3341
partition p1 values less than maxvalue);
 
3342
alter table t55
 
3343
partition by list(colint)
 
3344
subpartition by hash(cast(mod(col1,10) as signed)) subpartitions 2 
 
3345
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
3346
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
3347
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
3348
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
3349
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
3350
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
3351
);
 
3352
alter table t66
 
3353
partition by range(colint) 
 
3354
(partition p0 values less than (cast(mod(15,10) as signed)),
 
3355
partition p1 values less than maxvalue);
 
3356
select * from t11 order by col1;
 
3357
col1
 
3358
15.0000
 
3359
19.0000
 
3360
select * from t22 order by col1;
 
3361
col1
 
3362
15.0000
 
3363
17.0000
 
3364
19.0000
 
3365
select * from t33 order by col1;
 
3366
col1
 
3367
15.0000
 
3368
17.0000
 
3369
19.0000
 
3370
select * from t44 order by colint;
 
3371
colint  col1
 
3372
1       5.1230
 
3373
2       13.3450
 
3374
3       17.9870
 
3375
4       15.6540
 
3376
select * from t55 order by colint;
 
3377
colint  col1
 
3378
1       5.1230
 
3379
2       13.3450
 
3380
3       17.9870
 
3381
4       15.6540
 
3382
select * from t66 order by colint;
 
3383
colint  col1
 
3384
1       5.1230
 
3385
2       13.3450
 
3386
3       17.9870
 
3387
4       15.6540
 
3388
---------------------------
 
3389
---- some alter table begin
 
3390
---------------------------
 
3391
alter table t11
 
3392
reorganize partition p0,p1 into
 
3393
(partition s1 values less than maxvalue);
 
3394
select * from t11 order by col1;
 
3395
col1
 
3396
15.0000
 
3397
19.0000
 
3398
alter table t11
 
3399
reorganize partition s1 into
 
3400
(partition p0 values less than (15),
 
3401
partition p1 values less than maxvalue);
 
3402
select * from t11 order by col1;
 
3403
col1
 
3404
15.0000
 
3405
19.0000
 
3406
alter table t55
 
3407
partition by list(colint)
 
3408
subpartition by hash(cast(mod(col1,10) as signed)) subpartitions 5 
 
3409
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
3410
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
3411
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
3412
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
3413
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
3414
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
3415
);
 
3416
show create table t55;
 
3417
Table   Create Table
 
3418
t55     CREATE TABLE `t55` (
 
3419
  `colint` int(11) DEFAULT NULL,
 
3420
  `col1` float(7,4) DEFAULT NULL
 
3421
) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (cast(mod(col1,10) as signed)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
 
3422
select * from t55 order by colint;
 
3423
colint  col1
 
3424
1       5.1230
 
3425
2       13.3450
 
3426
3       17.9870
 
3427
4       15.6540
 
3428
alter table t66
 
3429
reorganize partition p0,p1 into
 
3430
(partition s1 values less than maxvalue);
 
3431
select * from t66 order by colint;
 
3432
colint  col1
 
3433
1       5.1230
 
3434
2       13.3450
 
3435
3       17.9870
 
3436
4       15.6540
 
3437
alter table t66
 
3438
reorganize partition s1 into
 
3439
(partition p0 values less than (cast(mod(15,10) as signed)),
 
3440
partition p1 values less than maxvalue);
 
3441
select * from t66 order by colint;
 
3442
colint  col1
 
3443
1       5.1230
 
3444
2       13.3450
 
3445
3       17.9870
 
3446
4       15.6540
 
3447
alter table t66
 
3448
reorganize partition p0,p1 into
 
3449
(partition s1 values less than maxvalue);
 
3450
select * from t66 order by colint;
 
3451
colint  col1
 
3452
1       5.1230
 
3453
2       13.3450
 
3454
3       17.9870
 
3455
4       15.6540
 
3456
alter table t66
 
3457
reorganize partition s1 into
 
3458
(partition p0 values less than (cast(mod(15,10) as signed)),
 
3459
partition p1 values less than maxvalue);
 
3460
select * from t66 order by colint;
 
3461
colint  col1
 
3462
1       5.1230
 
3463
2       13.3450
 
3464
3       17.9870
 
3465
4       15.6540
 
3466
-------------------------------------------------------------------------
 
3467
---  Delete rows and partitions of tables with cast(mod(col1,10) as signed)
 
3468
-------------------------------------------------------------------------
 
3469
delete from t1 where col1=19;
 
3470
delete from t2 where col1=19;
 
3471
delete from t3 where col1=19;
 
3472
delete from t4 where col1=19;
 
3473
delete from t5 where col1=19;
 
3474
delete from t6 where col1=19;
 
3475
select * from t1 order by col1;
 
3476
col1
 
3477
15.0000
 
3478
select * from t2 order by col1;
 
3479
col1
 
3480
15.0000
 
3481
17.0000
 
3482
select * from t3 order by col1;
 
3483
col1
 
3484
15.0000
 
3485
17.0000
 
3486
select * from t4 order by colint;
 
3487
colint  col1
 
3488
1       5.1230
 
3489
2       13.3450
 
3490
3       17.9870
 
3491
4       15.6540
 
3492
select * from t5 order by colint;
 
3493
colint  col1
 
3494
1       5.1230
 
3495
2       13.3450
 
3496
3       17.9870
 
3497
4       15.6540
 
3498
insert into t1 values (19);
 
3499
insert into t2 values (19);
 
3500
insert into t3 values (19);
 
3501
insert into t4 values (60,19);
 
3502
insert into t5 values (60,19);
 
3503
insert into t6 values (60,19);
 
3504
select * from t1 order by col1;
 
3505
col1
 
3506
15.0000
 
3507
19.0000
 
3508
select * from t2 order by col1;
 
3509
col1
 
3510
15.0000
 
3511
17.0000
 
3512
19.0000
 
3513
select * from t3 order by col1;
 
3514
col1
 
3515
15.0000
 
3516
17.0000
 
3517
19.0000
 
3518
select * from t4 order by colint;
 
3519
colint  col1
 
3520
1       5.1230
 
3521
2       13.3450
 
3522
3       17.9870
 
3523
4       15.6540
 
3524
60      19.0000
 
3525
select * from t5 order by colint;
 
3526
colint  col1
 
3527
1       5.1230
 
3528
2       13.3450
 
3529
3       17.9870
 
3530
4       15.6540
 
3531
60      19.0000
 
3532
select * from t6 order by colint;
 
3533
colint  col1
 
3534
1       5.1230
 
3535
2       13.3450
 
3536
3       17.9870
 
3537
4       15.6540
 
3538
60      19.0000
 
3539
alter table t1 drop partition p0;
 
3540
alter table t2 drop partition p0;
 
3541
alter table t4 drop partition p0;
 
3542
alter table t5 drop partition p0;
 
3543
alter table t6 drop partition p0;
 
3544
select * from t1 order by col1;
 
3545
col1
 
3546
select * from t2 order by col1;
 
3547
col1
 
3548
select * from t3 order by col1;
 
3549
col1
 
3550
15.0000
 
3551
17.0000
 
3552
19.0000
 
3553
select * from t4 order by colint;
 
3554
colint  col1
 
3555
60      19.0000
 
3556
select * from t5 order by colint;
 
3557
colint  col1
 
3558
60      19.0000
 
3559
select * from t6 order by colint;
 
3560
colint  col1
 
3561
60      19.0000
 
3562
-------------------------------------------------------------------------
 
3563
---  Delete rows and partitions of tables with cast(mod(col1,10) as signed)
 
3564
-------------------------------------------------------------------------
 
3565
delete from t11 where col1=19;
 
3566
delete from t22 where col1=19;
 
3567
delete from t33 where col1=19;
 
3568
delete from t44 where col1=19;
 
3569
delete from t55 where col1=19;
 
3570
delete from t66 where col1=19;
 
3571
select * from t11 order by col1;
 
3572
col1
 
3573
15.0000
 
3574
select * from t22 order by col1;
 
3575
col1
 
3576
15.0000
 
3577
17.0000
 
3578
select * from t33 order by col1;
 
3579
col1
 
3580
15.0000
 
3581
17.0000
 
3582
select * from t44 order by colint;
 
3583
colint  col1
 
3584
1       5.1230
 
3585
2       13.3450
 
3586
3       17.9870
 
3587
4       15.6540
 
3588
select * from t55 order by colint;
 
3589
colint  col1
 
3590
1       5.1230
 
3591
2       13.3450
 
3592
3       17.9870
 
3593
4       15.6540
 
3594
insert into t11 values (19);
 
3595
insert into t22 values (19);
 
3596
insert into t33 values (19);
 
3597
insert into t44 values (60,19);
 
3598
insert into t55 values (60,19);
 
3599
insert into t66 values (60,19);
 
3600
select * from t11 order by col1;
 
3601
col1
 
3602
15.0000
 
3603
19.0000
 
3604
select * from t22 order by col1;
 
3605
col1
 
3606
15.0000
 
3607
17.0000
 
3608
19.0000
 
3609
select * from t33 order by col1;
 
3610
col1
 
3611
15.0000
 
3612
17.0000
 
3613
19.0000
 
3614
select * from t44 order by colint;
 
3615
colint  col1
 
3616
1       5.1230
 
3617
2       13.3450
 
3618
3       17.9870
 
3619
4       15.6540
 
3620
60      19.0000
 
3621
select * from t55 order by colint;
 
3622
colint  col1
 
3623
1       5.1230
 
3624
2       13.3450
 
3625
3       17.9870
 
3626
4       15.6540
 
3627
60      19.0000
 
3628
select * from t66 order by colint;
 
3629
colint  col1
 
3630
1       5.1230
 
3631
2       13.3450
 
3632
3       17.9870
 
3633
4       15.6540
 
3634
60      19.0000
 
3635
alter table t11 drop partition p0;
 
3636
alter table t22 drop partition p0;
 
3637
alter table t44 drop partition p0;
 
3638
alter table t55 drop partition p0;
 
3639
alter table t66 drop partition p0;
 
3640
select * from t11 order by col1;
 
3641
col1
 
3642
select * from t22 order by col1;
 
3643
col1
 
3644
select * from t33 order by col1;
 
3645
col1
 
3646
15.0000
 
3647
17.0000
 
3648
19.0000
 
3649
select * from t44 order by colint;
 
3650
colint  col1
 
3651
60      19.0000
 
3652
select * from t55 order by colint;
 
3653
colint  col1
 
3654
60      19.0000
 
3655
select * from t66 order by colint;
 
3656
colint  col1
 
3657
60      19.0000
 
3658
-------------------------
 
3659
---- some alter table end
 
3660
-------------------------
 
3661
drop table if exists t1 ;
 
3662
drop table if exists t2 ;
 
3663
drop table if exists t3 ;
 
3664
drop table if exists t4 ;
 
3665
drop table if exists t5 ;
 
3666
drop table if exists t6 ;
 
3667
drop table if exists t11 ;
 
3668
drop table if exists t22 ;
 
3669
drop table if exists t33 ;
 
3670
drop table if exists t44 ;
 
3671
drop table if exists t55 ;
 
3672
drop table if exists t66 ;
 
3673
-------------------------------------------------------------------------
 
3674
---  ord(col1)  in partition with coltype  char(3)
 
3675
-------------------------------------------------------------------------
 
3676
drop table if exists t1 ;
 
3677
drop table if exists t2 ;
 
3678
drop table if exists t3 ;
 
3679
drop table if exists t4 ;
 
3680
drop table if exists t5 ;
 
3681
drop table if exists t6 ;
 
3682
-------------------------------------------------------------------------
 
3683
---  Create tables with ord(col1)
 
3684
-------------------------------------------------------------------------
 
3685
create table t1 (col1 char(3)) engine='NDB' 
 
3686
partition by range(ord(col1)) 
 
3687
(partition p0 values less than (15),
 
3688
partition p1 values less than maxvalue);
 
3689
create table t2 (col1 char(3)) engine='NDB' 
 
3690
partition by list(ord(col1)) 
 
3691
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
3692
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
3693
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
3694
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
3695
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
3696
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
3697
);
 
3698
create table t3 (col1 char(3)) engine='NDB' 
 
3699
partition by hash(ord(col1));
 
3700
create table t4 (colint int, col1 char(3)) engine='NDB' 
 
3701
partition by range(colint) 
 
3702
subpartition by hash(ord(col1)) subpartitions 2 
 
3703
(partition p0 values less than (15),
 
3704
partition p1 values less than maxvalue);
 
3705
create table t5 (colint int, col1 char(3)) engine='NDB' 
 
3706
partition by list(colint)
 
3707
subpartition by hash(ord(col1)) subpartitions 2 
 
3708
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
3709
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
3710
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
3711
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
3712
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
3713
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
3714
);
 
3715
create table t6 (colint int, col1 char(3)) engine='NDB' 
 
3716
partition by range(colint) 
 
3717
(partition p0 values less than (ord('a')),
 
3718
partition p1 values less than maxvalue);
 
3719
-------------------------------------------------------------------------
 
3720
---  Access tables with ord(col1) 
 
3721
-------------------------------------------------------------------------
 
3722
insert into t1 values ('1');
 
3723
insert into t1 values ('9');
 
3724
insert into t2 values ('1');
 
3725
insert into t2 values ('9');
 
3726
insert into t2 values ('3');
 
3727
insert into t3 values ('1');
 
3728
insert into t3 values ('9');
 
3729
insert into t3 values ('3');
 
3730
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in' into table t4;
 
3731
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in' into table t5;
 
3732
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in' into table t6;
 
3733
select ord(col1) from t1 order by col1;
 
3734
ord(col1)
 
3735
49
 
3736
57
 
3737
select * from t1 order by col1;
 
3738
col1
 
3739
1
 
3740
9
 
3741
select * from t2 order by col1;
 
3742
col1
 
3743
1
 
3744
3
 
3745
9
 
3746
select * from t3 order by col1;
 
3747
col1
 
3748
1
 
3749
3
 
3750
9
 
3751
select * from t4 order by colint;
 
3752
colint  col1
 
3753
1       1
 
3754
2       9
 
3755
3       3
 
3756
4       8
 
3757
select * from t5 order by colint;
 
3758
colint  col1
 
3759
1       1
 
3760
2       9
 
3761
3       3
 
3762
4       8
 
3763
select * from t6 order by colint;
 
3764
colint  col1
 
3765
1       1
 
3766
2       9
 
3767
3       3
 
3768
4       8
 
3769
update t1 set col1='8' where col1='1';
 
3770
update t2 set col1='8' where col1='1';
 
3771
update t3 set col1='8' where col1='1';
 
3772
update t4 set col1='8' where col1='1';
 
3773
update t5 set col1='8' where col1='1';
 
3774
update t6 set col1='8' where col1='1';
 
3775
select * from t1 order by col1;
 
3776
col1
 
3777
8
 
3778
9
 
3779
select * from t2 order by col1;
 
3780
col1
 
3781
3
 
3782
8
 
3783
9
 
3784
select * from t3 order by col1;
 
3785
col1
 
3786
3
 
3787
8
 
3788
9
 
3789
select * from t4 order by colint;
 
3790
colint  col1
 
3791
1       8
 
3792
2       9
 
3793
3       3
 
3794
4       8
 
3795
select * from t5 order by colint;
 
3796
colint  col1
 
3797
1       8
 
3798
2       9
 
3799
3       3
 
3800
4       8
 
3801
select * from t6 order by colint;
 
3802
colint  col1
 
3803
1       8
 
3804
2       9
 
3805
3       3
 
3806
4       8
 
3807
-------------------------------------------------------------------------
 
3808
---  Alter tables with ord(col1)
 
3809
-------------------------------------------------------------------------
 
3810
drop table if exists t11 ;
 
3811
drop table if exists t22 ;
 
3812
drop table if exists t33 ;
 
3813
drop table if exists t44 ;
 
3814
drop table if exists t55 ;
 
3815
drop table if exists t66 ;
 
3816
create table t11 engine='NDB' as select * from t1;
 
3817
create table t22 engine='NDB' as select * from t2;
 
3818
create table t33 engine='NDB' as select * from t3;
 
3819
create table t44 engine='NDB' as select * from t4;
 
3820
create table t55 engine='NDB' as select * from t5;
 
3821
create table t66 engine='NDB' as select * from t6;
 
3822
alter table t11
 
3823
partition by range(ord(col1)) 
 
3824
(partition p0 values less than (15),
 
3825
partition p1 values less than maxvalue);
 
3826
alter table t22
 
3827
partition by list(ord(col1)) 
 
3828
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
3829
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
3830
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
3831
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
3832
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
3833
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
3834
);
 
3835
alter table t33
 
3836
partition by hash(ord(col1));
 
3837
alter table t44
 
3838
partition by range(colint) 
 
3839
subpartition by hash(ord(col1)) subpartitions 2 
 
3840
(partition p0 values less than (15),
 
3841
partition p1 values less than maxvalue);
 
3842
alter table t55
 
3843
partition by list(colint)
 
3844
subpartition by hash(ord(col1)) subpartitions 2 
 
3845
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
3846
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
3847
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
3848
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
3849
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
3850
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
3851
);
 
3852
alter table t66
 
3853
partition by range(colint) 
 
3854
(partition p0 values less than (ord('a')),
 
3855
partition p1 values less than maxvalue);
 
3856
select * from t11 order by col1;
 
3857
col1
 
3858
8
 
3859
9
 
3860
select * from t22 order by col1;
 
3861
col1
 
3862
3
 
3863
8
 
3864
9
 
3865
select * from t33 order by col1;
 
3866
col1
 
3867
3
 
3868
8
 
3869
9
 
3870
select * from t44 order by colint;
 
3871
colint  col1
 
3872
1       8
 
3873
2       9
 
3874
3       3
 
3875
4       8
 
3876
select * from t55 order by colint;
 
3877
colint  col1
 
3878
1       8
 
3879
2       9
 
3880
3       3
 
3881
4       8
 
3882
select * from t66 order by colint;
 
3883
colint  col1
 
3884
1       8
 
3885
2       9
 
3886
3       3
 
3887
4       8
 
3888
---------------------------
 
3889
---- some alter table begin
 
3890
---------------------------
 
3891
alter table t11
 
3892
reorganize partition p0,p1 into
 
3893
(partition s1 values less than maxvalue);
 
3894
select * from t11 order by col1;
 
3895
col1
 
3896
8
 
3897
9
 
3898
alter table t11
 
3899
reorganize partition s1 into
 
3900
(partition p0 values less than (15),
 
3901
partition p1 values less than maxvalue);
 
3902
select * from t11 order by col1;
 
3903
col1
 
3904
8
 
3905
9
 
3906
alter table t55
 
3907
partition by list(colint)
 
3908
subpartition by hash(ord(col1)) subpartitions 5 
 
3909
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
3910
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
3911
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
3912
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
3913
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
3914
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
3915
);
 
3916
show create table t55;
 
3917
Table   Create Table
 
3918
t55     CREATE TABLE `t55` (
 
3919
  `colint` int(11) DEFAULT NULL,
 
3920
  `col1` char(3) DEFAULT NULL
 
3921
) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (ord(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
 
3922
select * from t55 order by colint;
 
3923
colint  col1
 
3924
1       8
 
3925
2       9
 
3926
3       3
 
3927
4       8
 
3928
alter table t66
 
3929
reorganize partition p0,p1 into
 
3930
(partition s1 values less than maxvalue);
 
3931
select * from t66 order by colint;
 
3932
colint  col1
 
3933
1       8
 
3934
2       9
 
3935
3       3
 
3936
4       8
 
3937
alter table t66
 
3938
reorganize partition s1 into
 
3939
(partition p0 values less than (ord('a')),
 
3940
partition p1 values less than maxvalue);
 
3941
select * from t66 order by colint;
 
3942
colint  col1
 
3943
1       8
 
3944
2       9
 
3945
3       3
 
3946
4       8
 
3947
alter table t66
 
3948
reorganize partition p0,p1 into
 
3949
(partition s1 values less than maxvalue);
 
3950
select * from t66 order by colint;
 
3951
colint  col1
 
3952
1       8
 
3953
2       9
 
3954
3       3
 
3955
4       8
 
3956
alter table t66
 
3957
reorganize partition s1 into
 
3958
(partition p0 values less than (ord('a')),
 
3959
partition p1 values less than maxvalue);
 
3960
select * from t66 order by colint;
 
3961
colint  col1
 
3962
1       8
 
3963
2       9
 
3964
3       3
 
3965
4       8
 
3966
-------------------------------------------------------------------------
 
3967
---  Delete rows and partitions of tables with ord(col1)
 
3968
-------------------------------------------------------------------------
 
3969
delete from t1 where col1='9';
 
3970
delete from t2 where col1='9';
 
3971
delete from t3 where col1='9';
 
3972
delete from t4 where col1='9';
 
3973
delete from t5 where col1='9';
 
3974
delete from t6 where col1='9';
 
3975
select * from t1 order by col1;
 
3976
col1
 
3977
8
 
3978
select * from t2 order by col1;
 
3979
col1
 
3980
3
 
3981
8
 
3982
select * from t3 order by col1;
 
3983
col1
 
3984
3
 
3985
8
 
3986
select * from t4 order by colint;
 
3987
colint  col1
 
3988
1       8
 
3989
3       3
 
3990
4       8
 
3991
select * from t5 order by colint;
 
3992
colint  col1
 
3993
1       8
 
3994
3       3
 
3995
4       8
 
3996
insert into t1 values ('9');
 
3997
insert into t2 values ('9');
 
3998
insert into t3 values ('9');
 
3999
insert into t4 values (60,'9');
 
4000
insert into t5 values (60,'9');
 
4001
insert into t6 values (60,'9');
 
4002
select * from t1 order by col1;
 
4003
col1
 
4004
8
 
4005
9
 
4006
select * from t2 order by col1;
 
4007
col1
 
4008
3
 
4009
8
 
4010
9
 
4011
select * from t3 order by col1;
 
4012
col1
 
4013
3
 
4014
8
 
4015
9
 
4016
select * from t4 order by colint;
 
4017
colint  col1
 
4018
1       8
 
4019
3       3
 
4020
4       8
 
4021
60      9
 
4022
select * from t5 order by colint;
 
4023
colint  col1
 
4024
1       8
 
4025
3       3
 
4026
4       8
 
4027
60      9
 
4028
select * from t6 order by colint;
 
4029
colint  col1
 
4030
1       8
 
4031
3       3
 
4032
4       8
 
4033
60      9
 
4034
alter table t1 drop partition p0;
 
4035
alter table t2 drop partition p0;
 
4036
alter table t4 drop partition p0;
 
4037
alter table t5 drop partition p0;
 
4038
alter table t6 drop partition p0;
 
4039
select * from t1 order by col1;
 
4040
col1
 
4041
8
 
4042
9
 
4043
select * from t2 order by col1;
 
4044
col1
 
4045
3
 
4046
8
 
4047
9
 
4048
select * from t3 order by col1;
 
4049
col1
 
4050
3
 
4051
8
 
4052
9
 
4053
select * from t4 order by colint;
 
4054
colint  col1
 
4055
60      9
 
4056
select * from t5 order by colint;
 
4057
colint  col1
 
4058
60      9
 
4059
select * from t6 order by colint;
 
4060
colint  col1
 
4061
-------------------------------------------------------------------------
 
4062
---  Delete rows and partitions of tables with ord(col1)
 
4063
-------------------------------------------------------------------------
 
4064
delete from t11 where col1='9';
 
4065
delete from t22 where col1='9';
 
4066
delete from t33 where col1='9';
 
4067
delete from t44 where col1='9';
 
4068
delete from t55 where col1='9';
 
4069
delete from t66 where col1='9';
 
4070
select * from t11 order by col1;
 
4071
col1
 
4072
8
 
4073
select * from t22 order by col1;
 
4074
col1
 
4075
3
 
4076
8
 
4077
select * from t33 order by col1;
 
4078
col1
 
4079
3
 
4080
8
 
4081
select * from t44 order by colint;
 
4082
colint  col1
 
4083
1       8
 
4084
3       3
 
4085
4       8
 
4086
select * from t55 order by colint;
 
4087
colint  col1
 
4088
1       8
 
4089
3       3
 
4090
4       8
 
4091
insert into t11 values ('9');
 
4092
insert into t22 values ('9');
 
4093
insert into t33 values ('9');
 
4094
insert into t44 values (60,'9');
 
4095
insert into t55 values (60,'9');
 
4096
insert into t66 values (60,'9');
 
4097
select * from t11 order by col1;
 
4098
col1
 
4099
8
 
4100
9
 
4101
select * from t22 order by col1;
 
4102
col1
 
4103
3
 
4104
8
 
4105
9
 
4106
select * from t33 order by col1;
 
4107
col1
 
4108
3
 
4109
8
 
4110
9
 
4111
select * from t44 order by colint;
 
4112
colint  col1
 
4113
1       8
 
4114
3       3
 
4115
4       8
 
4116
60      9
 
4117
select * from t55 order by colint;
 
4118
colint  col1
 
4119
1       8
 
4120
3       3
 
4121
4       8
 
4122
60      9
 
4123
select * from t66 order by colint;
 
4124
colint  col1
 
4125
1       8
 
4126
3       3
 
4127
4       8
 
4128
60      9
 
4129
alter table t11 drop partition p0;
 
4130
alter table t22 drop partition p0;
 
4131
alter table t44 drop partition p0;
 
4132
alter table t55 drop partition p0;
 
4133
alter table t66 drop partition p0;
 
4134
select * from t11 order by col1;
 
4135
col1
 
4136
8
 
4137
9
 
4138
select * from t22 order by col1;
 
4139
col1
 
4140
3
 
4141
8
 
4142
9
 
4143
select * from t33 order by col1;
 
4144
col1
 
4145
3
 
4146
8
 
4147
9
 
4148
select * from t44 order by colint;
 
4149
colint  col1
 
4150
60      9
 
4151
select * from t55 order by colint;
 
4152
colint  col1
 
4153
60      9
 
4154
select * from t66 order by colint;
 
4155
colint  col1
 
4156
-------------------------
 
4157
---- some alter table end
 
4158
-------------------------
 
4159
drop table if exists t1 ;
 
4160
drop table if exists t2 ;
 
4161
drop table if exists t3 ;
 
4162
drop table if exists t4 ;
 
4163
drop table if exists t5 ;
 
4164
drop table if exists t6 ;
 
4165
drop table if exists t11 ;
 
4166
drop table if exists t22 ;
 
4167
drop table if exists t33 ;
 
4168
drop table if exists t44 ;
 
4169
drop table if exists t55 ;
 
4170
drop table if exists t66 ;
 
4171
-------------------------------------------------------------------------
 
4172
---  day(col1)  in partition with coltype  date
 
4173
-------------------------------------------------------------------------
 
4174
drop table if exists t1 ;
 
4175
drop table if exists t2 ;
 
4176
drop table if exists t3 ;
 
4177
drop table if exists t4 ;
 
4178
drop table if exists t5 ;
 
4179
drop table if exists t6 ;
 
4180
-------------------------------------------------------------------------
 
4181
---  Create tables with day(col1)
 
4182
-------------------------------------------------------------------------
 
4183
create table t1 (col1 date) engine='NDB' 
 
4184
partition by range(day(col1)) 
 
4185
(partition p0 values less than (15),
 
4186
partition p1 values less than maxvalue);
 
4187
create table t2 (col1 date) engine='NDB' 
 
4188
partition by list(day(col1)) 
 
4189
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
4190
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
4191
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
4192
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
4193
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
4194
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
4195
);
 
4196
create table t3 (col1 date) engine='NDB' 
 
4197
partition by hash(day(col1));
 
4198
create table t4 (colint int, col1 date) engine='NDB' 
 
4199
partition by range(colint) 
 
4200
subpartition by hash(day(col1)) subpartitions 2 
 
4201
(partition p0 values less than (15),
 
4202
partition p1 values less than maxvalue);
 
4203
create table t5 (colint int, col1 date) engine='NDB' 
 
4204
partition by list(colint)
 
4205
subpartition by hash(day(col1)) subpartitions 2 
 
4206
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
4207
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
4208
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
4209
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
4210
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
4211
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
4212
);
 
4213
create table t6 (colint int, col1 date) engine='NDB' 
 
4214
partition by range(colint) 
 
4215
(partition p0 values less than (day('2006-12-21')),
 
4216
partition p1 values less than maxvalue);
 
4217
-------------------------------------------------------------------------
 
4218
---  Access tables with day(col1) 
 
4219
-------------------------------------------------------------------------
 
4220
insert into t1 values ('2006-02-03');
 
4221
insert into t1 values ('2006-01-17');
 
4222
insert into t2 values ('2006-02-03');
 
4223
insert into t2 values ('2006-01-17');
 
4224
insert into t2 values ('2006-01-25');
 
4225
insert into t3 values ('2006-02-03');
 
4226
insert into t3 values ('2006-01-17');
 
4227
insert into t3 values ('2006-01-25');
 
4228
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
 
4229
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
 
4230
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
 
4231
select day(col1) from t1 order by col1;
 
4232
day(col1)
 
4233
17
 
4234
3
 
4235
select * from t1 order by col1;
 
4236
col1
 
4237
2006-01-17
 
4238
2006-02-03
 
4239
select * from t2 order by col1;
 
4240
col1
 
4241
2006-01-17
 
4242
2006-01-25
 
4243
2006-02-03
 
4244
select * from t3 order by col1;
 
4245
col1
 
4246
2006-01-17
 
4247
2006-01-25
 
4248
2006-02-03
 
4249
select * from t4 order by colint;
 
4250
colint  col1
 
4251
1       2006-02-03
 
4252
2       2006-01-17
 
4253
3       2006-01-25
 
4254
4       2006-02-05
 
4255
select * from t5 order by colint;
 
4256
colint  col1
 
4257
1       2006-02-03
 
4258
2       2006-01-17
 
4259
3       2006-01-25
 
4260
4       2006-02-05
 
4261
select * from t6 order by colint;
 
4262
colint  col1
 
4263
1       2006-02-03
 
4264
2       2006-01-17
 
4265
3       2006-01-25
 
4266
4       2006-02-05
 
4267
update t1 set col1='2006-02-05' where col1='2006-02-03';
 
4268
update t2 set col1='2006-02-05' where col1='2006-02-03';
 
4269
update t3 set col1='2006-02-05' where col1='2006-02-03';
 
4270
update t4 set col1='2006-02-05' where col1='2006-02-03';
 
4271
update t5 set col1='2006-02-05' where col1='2006-02-03';
 
4272
update t6 set col1='2006-02-05' where col1='2006-02-03';
 
4273
select * from t1 order by col1;
 
4274
col1
 
4275
2006-01-17
 
4276
2006-02-05
 
4277
select * from t2 order by col1;
 
4278
col1
 
4279
2006-01-17
 
4280
2006-01-25
 
4281
2006-02-05
 
4282
select * from t3 order by col1;
 
4283
col1
 
4284
2006-01-17
 
4285
2006-01-25
 
4286
2006-02-05
 
4287
select * from t4 order by colint;
 
4288
colint  col1
 
4289
1       2006-02-05
 
4290
2       2006-01-17
 
4291
3       2006-01-25
 
4292
4       2006-02-05
 
4293
select * from t5 order by colint;
 
4294
colint  col1
 
4295
1       2006-02-05
 
4296
2       2006-01-17
 
4297
3       2006-01-25
 
4298
4       2006-02-05
 
4299
select * from t6 order by colint;
 
4300
colint  col1
 
4301
1       2006-02-05
 
4302
2       2006-01-17
 
4303
3       2006-01-25
 
4304
4       2006-02-05
 
4305
-------------------------------------------------------------------------
 
4306
---  Alter tables with day(col1)
 
4307
-------------------------------------------------------------------------
 
4308
drop table if exists t11 ;
 
4309
drop table if exists t22 ;
 
4310
drop table if exists t33 ;
 
4311
drop table if exists t44 ;
 
4312
drop table if exists t55 ;
 
4313
drop table if exists t66 ;
 
4314
create table t11 engine='NDB' as select * from t1;
 
4315
create table t22 engine='NDB' as select * from t2;
 
4316
create table t33 engine='NDB' as select * from t3;
 
4317
create table t44 engine='NDB' as select * from t4;
 
4318
create table t55 engine='NDB' as select * from t5;
 
4319
create table t66 engine='NDB' as select * from t6;
 
4320
alter table t11
 
4321
partition by range(day(col1)) 
 
4322
(partition p0 values less than (15),
 
4323
partition p1 values less than maxvalue);
 
4324
alter table t22
 
4325
partition by list(day(col1)) 
 
4326
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
4327
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
4328
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
4329
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
4330
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
4331
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
4332
);
 
4333
alter table t33
 
4334
partition by hash(day(col1));
 
4335
alter table t44
 
4336
partition by range(colint) 
 
4337
subpartition by hash(day(col1)) subpartitions 2 
 
4338
(partition p0 values less than (15),
 
4339
partition p1 values less than maxvalue);
 
4340
alter table t55
 
4341
partition by list(colint)
 
4342
subpartition by hash(day(col1)) subpartitions 2 
 
4343
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
4344
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
4345
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
4346
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
4347
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
4348
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
4349
);
 
4350
alter table t66
 
4351
partition by range(colint) 
 
4352
(partition p0 values less than (day('2006-12-21')),
 
4353
partition p1 values less than maxvalue);
 
4354
select * from t11 order by col1;
 
4355
col1
 
4356
2006-01-17
 
4357
2006-02-05
 
4358
select * from t22 order by col1;
 
4359
col1
 
4360
2006-01-17
 
4361
2006-01-25
 
4362
2006-02-05
 
4363
select * from t33 order by col1;
 
4364
col1
 
4365
2006-01-17
 
4366
2006-01-25
 
4367
2006-02-05
 
4368
select * from t44 order by colint;
 
4369
colint  col1
 
4370
1       2006-02-05
 
4371
2       2006-01-17
 
4372
3       2006-01-25
 
4373
4       2006-02-05
 
4374
select * from t55 order by colint;
 
4375
colint  col1
 
4376
1       2006-02-05
 
4377
2       2006-01-17
 
4378
3       2006-01-25
 
4379
4       2006-02-05
 
4380
select * from t66 order by colint;
 
4381
colint  col1
 
4382
1       2006-02-05
 
4383
2       2006-01-17
 
4384
3       2006-01-25
 
4385
4       2006-02-05
 
4386
---------------------------
 
4387
---- some alter table begin
 
4388
---------------------------
 
4389
alter table t11
 
4390
reorganize partition p0,p1 into
 
4391
(partition s1 values less than maxvalue);
 
4392
select * from t11 order by col1;
 
4393
col1
 
4394
2006-01-17
 
4395
2006-02-05
 
4396
alter table t11
 
4397
reorganize partition s1 into
 
4398
(partition p0 values less than (15),
 
4399
partition p1 values less than maxvalue);
 
4400
select * from t11 order by col1;
 
4401
col1
 
4402
2006-01-17
 
4403
2006-02-05
 
4404
alter table t55
 
4405
partition by list(colint)
 
4406
subpartition by hash(day(col1)) subpartitions 5 
 
4407
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
4408
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
4409
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
4410
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
4411
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
4412
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
4413
);
 
4414
show create table t55;
 
4415
Table   Create Table
 
4416
t55     CREATE TABLE `t55` (
 
4417
  `colint` int(11) DEFAULT NULL,
 
4418
  `col1` date DEFAULT NULL
 
4419
) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (day(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
 
4420
select * from t55 order by colint;
 
4421
colint  col1
 
4422
1       2006-02-05
 
4423
2       2006-01-17
 
4424
3       2006-01-25
 
4425
4       2006-02-05
 
4426
alter table t66
 
4427
reorganize partition p0,p1 into
 
4428
(partition s1 values less than maxvalue);
 
4429
select * from t66 order by colint;
 
4430
colint  col1
 
4431
1       2006-02-05
 
4432
2       2006-01-17
 
4433
3       2006-01-25
 
4434
4       2006-02-05
 
4435
alter table t66
 
4436
reorganize partition s1 into
 
4437
(partition p0 values less than (day('2006-12-21')),
 
4438
partition p1 values less than maxvalue);
 
4439
select * from t66 order by colint;
 
4440
colint  col1
 
4441
1       2006-02-05
 
4442
2       2006-01-17
 
4443
3       2006-01-25
 
4444
4       2006-02-05
 
4445
alter table t66
 
4446
reorganize partition p0,p1 into
 
4447
(partition s1 values less than maxvalue);
 
4448
select * from t66 order by colint;
 
4449
colint  col1
 
4450
1       2006-02-05
 
4451
2       2006-01-17
 
4452
3       2006-01-25
 
4453
4       2006-02-05
 
4454
alter table t66
 
4455
reorganize partition s1 into
 
4456
(partition p0 values less than (day('2006-12-21')),
 
4457
partition p1 values less than maxvalue);
 
4458
select * from t66 order by colint;
 
4459
colint  col1
 
4460
1       2006-02-05
 
4461
2       2006-01-17
 
4462
3       2006-01-25
 
4463
4       2006-02-05
 
4464
-------------------------------------------------------------------------
 
4465
---  Delete rows and partitions of tables with day(col1)
 
4466
-------------------------------------------------------------------------
 
4467
delete from t1 where col1='2006-01-17';
 
4468
delete from t2 where col1='2006-01-17';
 
4469
delete from t3 where col1='2006-01-17';
 
4470
delete from t4 where col1='2006-01-17';
 
4471
delete from t5 where col1='2006-01-17';
 
4472
delete from t6 where col1='2006-01-17';
 
4473
select * from t1 order by col1;
 
4474
col1
 
4475
2006-02-05
 
4476
select * from t2 order by col1;
 
4477
col1
 
4478
2006-01-25
 
4479
2006-02-05
 
4480
select * from t3 order by col1;
 
4481
col1
 
4482
2006-01-25
 
4483
2006-02-05
 
4484
select * from t4 order by colint;
 
4485
colint  col1
 
4486
1       2006-02-05
 
4487
3       2006-01-25
 
4488
4       2006-02-05
 
4489
select * from t5 order by colint;
 
4490
colint  col1
 
4491
1       2006-02-05
 
4492
3       2006-01-25
 
4493
4       2006-02-05
 
4494
insert into t1 values ('2006-01-17');
 
4495
insert into t2 values ('2006-01-17');
 
4496
insert into t3 values ('2006-01-17');
 
4497
insert into t4 values (60,'2006-01-17');
 
4498
insert into t5 values (60,'2006-01-17');
 
4499
insert into t6 values (60,'2006-01-17');
 
4500
select * from t1 order by col1;
 
4501
col1
 
4502
2006-01-17
 
4503
2006-02-05
 
4504
select * from t2 order by col1;
 
4505
col1
 
4506
2006-01-17
 
4507
2006-01-25
 
4508
2006-02-05
 
4509
select * from t3 order by col1;
 
4510
col1
 
4511
2006-01-17
 
4512
2006-01-25
 
4513
2006-02-05
 
4514
select * from t4 order by colint;
 
4515
colint  col1
 
4516
1       2006-02-05
 
4517
3       2006-01-25
 
4518
4       2006-02-05
 
4519
60      2006-01-17
 
4520
select * from t5 order by colint;
 
4521
colint  col1
 
4522
1       2006-02-05
 
4523
3       2006-01-25
 
4524
4       2006-02-05
 
4525
60      2006-01-17
 
4526
select * from t6 order by colint;
 
4527
colint  col1
 
4528
1       2006-02-05
 
4529
3       2006-01-25
 
4530
4       2006-02-05
 
4531
60      2006-01-17
 
4532
alter table t1 drop partition p0;
 
4533
alter table t2 drop partition p0;
 
4534
alter table t4 drop partition p0;
 
4535
alter table t5 drop partition p0;
 
4536
alter table t6 drop partition p0;
 
4537
select * from t1 order by col1;
 
4538
col1
 
4539
2006-01-17
 
4540
select * from t2 order by col1;
 
4541
col1
 
4542
2006-01-17
 
4543
2006-01-25
 
4544
select * from t3 order by col1;
 
4545
col1
 
4546
2006-01-17
 
4547
2006-01-25
 
4548
2006-02-05
 
4549
select * from t4 order by colint;
 
4550
colint  col1
 
4551
60      2006-01-17
 
4552
select * from t5 order by colint;
 
4553
colint  col1
 
4554
60      2006-01-17
 
4555
select * from t6 order by colint;
 
4556
colint  col1
 
4557
60      2006-01-17
 
4558
-------------------------------------------------------------------------
 
4559
---  Delete rows and partitions of tables with day(col1)
 
4560
-------------------------------------------------------------------------
 
4561
delete from t11 where col1='2006-01-17';
 
4562
delete from t22 where col1='2006-01-17';
 
4563
delete from t33 where col1='2006-01-17';
 
4564
delete from t44 where col1='2006-01-17';
 
4565
delete from t55 where col1='2006-01-17';
 
4566
delete from t66 where col1='2006-01-17';
 
4567
select * from t11 order by col1;
 
4568
col1
 
4569
2006-02-05
 
4570
select * from t22 order by col1;
 
4571
col1
 
4572
2006-01-25
 
4573
2006-02-05
 
4574
select * from t33 order by col1;
 
4575
col1
 
4576
2006-01-25
 
4577
2006-02-05
 
4578
select * from t44 order by colint;
 
4579
colint  col1
 
4580
1       2006-02-05
 
4581
3       2006-01-25
 
4582
4       2006-02-05
 
4583
select * from t55 order by colint;
 
4584
colint  col1
 
4585
1       2006-02-05
 
4586
3       2006-01-25
 
4587
4       2006-02-05
 
4588
insert into t11 values ('2006-01-17');
 
4589
insert into t22 values ('2006-01-17');
 
4590
insert into t33 values ('2006-01-17');
 
4591
insert into t44 values (60,'2006-01-17');
 
4592
insert into t55 values (60,'2006-01-17');
 
4593
insert into t66 values (60,'2006-01-17');
 
4594
select * from t11 order by col1;
 
4595
col1
 
4596
2006-01-17
 
4597
2006-02-05
 
4598
select * from t22 order by col1;
 
4599
col1
 
4600
2006-01-17
 
4601
2006-01-25
 
4602
2006-02-05
 
4603
select * from t33 order by col1;
 
4604
col1
 
4605
2006-01-17
 
4606
2006-01-25
 
4607
2006-02-05
 
4608
select * from t44 order by colint;
 
4609
colint  col1
 
4610
1       2006-02-05
 
4611
3       2006-01-25
 
4612
4       2006-02-05
 
4613
60      2006-01-17
 
4614
select * from t55 order by colint;
 
4615
colint  col1
 
4616
1       2006-02-05
 
4617
3       2006-01-25
 
4618
4       2006-02-05
 
4619
60      2006-01-17
 
4620
select * from t66 order by colint;
 
4621
colint  col1
 
4622
1       2006-02-05
 
4623
3       2006-01-25
 
4624
4       2006-02-05
 
4625
60      2006-01-17
 
4626
alter table t11 drop partition p0;
 
4627
alter table t22 drop partition p0;
 
4628
alter table t44 drop partition p0;
 
4629
alter table t55 drop partition p0;
 
4630
alter table t66 drop partition p0;
 
4631
select * from t11 order by col1;
 
4632
col1
 
4633
2006-01-17
 
4634
select * from t22 order by col1;
 
4635
col1
 
4636
2006-01-17
 
4637
2006-01-25
 
4638
select * from t33 order by col1;
 
4639
col1
 
4640
2006-01-17
 
4641
2006-01-25
 
4642
2006-02-05
 
4643
select * from t44 order by colint;
 
4644
colint  col1
 
4645
60      2006-01-17
 
4646
select * from t55 order by colint;
 
4647
colint  col1
 
4648
60      2006-01-17
 
4649
select * from t66 order by colint;
 
4650
colint  col1
 
4651
60      2006-01-17
 
4652
-------------------------
 
4653
---- some alter table end
 
4654
-------------------------
 
4655
drop table if exists t1 ;
 
4656
drop table if exists t2 ;
 
4657
drop table if exists t3 ;
 
4658
drop table if exists t4 ;
 
4659
drop table if exists t5 ;
 
4660
drop table if exists t6 ;
 
4661
drop table if exists t11 ;
 
4662
drop table if exists t22 ;
 
4663
drop table if exists t33 ;
 
4664
drop table if exists t44 ;
 
4665
drop table if exists t55 ;
 
4666
drop table if exists t66 ;
 
4667
-------------------------------------------------------------------------
 
4668
---  dayofmonth(col1)  in partition with coltype  date
 
4669
-------------------------------------------------------------------------
 
4670
drop table if exists t1 ;
 
4671
drop table if exists t2 ;
 
4672
drop table if exists t3 ;
 
4673
drop table if exists t4 ;
 
4674
drop table if exists t5 ;
 
4675
drop table if exists t6 ;
 
4676
-------------------------------------------------------------------------
 
4677
---  Create tables with dayofmonth(col1)
 
4678
-------------------------------------------------------------------------
 
4679
create table t1 (col1 date) engine='NDB' 
 
4680
partition by range(dayofmonth(col1)) 
 
4681
(partition p0 values less than (15),
 
4682
partition p1 values less than maxvalue);
 
4683
create table t2 (col1 date) engine='NDB' 
 
4684
partition by list(dayofmonth(col1)) 
 
4685
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
4686
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
4687
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
4688
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
4689
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
4690
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
4691
);
 
4692
create table t3 (col1 date) engine='NDB' 
 
4693
partition by hash(dayofmonth(col1));
 
4694
create table t4 (colint int, col1 date) engine='NDB' 
 
4695
partition by range(colint) 
 
4696
subpartition by hash(dayofmonth(col1)) subpartitions 2 
 
4697
(partition p0 values less than (15),
 
4698
partition p1 values less than maxvalue);
 
4699
create table t5 (colint int, col1 date) engine='NDB' 
 
4700
partition by list(colint)
 
4701
subpartition by hash(dayofmonth(col1)) subpartitions 2 
 
4702
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
4703
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
4704
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
4705
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
4706
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
4707
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
4708
);
 
4709
create table t6 (colint int, col1 date) engine='NDB' 
 
4710
partition by range(colint) 
 
4711
(partition p0 values less than (dayofmonth('2006-12-24')),
 
4712
partition p1 values less than maxvalue);
 
4713
-------------------------------------------------------------------------
 
4714
---  Access tables with dayofmonth(col1) 
 
4715
-------------------------------------------------------------------------
 
4716
insert into t1 values ('2006-02-03');
 
4717
insert into t1 values ('2006-01-17');
 
4718
insert into t2 values ('2006-02-03');
 
4719
insert into t2 values ('2006-01-17');
 
4720
insert into t2 values ('2006-01-25');
 
4721
insert into t3 values ('2006-02-03');
 
4722
insert into t3 values ('2006-01-17');
 
4723
insert into t3 values ('2006-01-25');
 
4724
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
 
4725
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
 
4726
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
 
4727
select dayofmonth(col1) from t1 order by col1;
 
4728
dayofmonth(col1)
 
4729
17
 
4730
3
 
4731
select * from t1 order by col1;
 
4732
col1
 
4733
2006-01-17
 
4734
2006-02-03
 
4735
select * from t2 order by col1;
 
4736
col1
 
4737
2006-01-17
 
4738
2006-01-25
 
4739
2006-02-03
 
4740
select * from t3 order by col1;
 
4741
col1
 
4742
2006-01-17
 
4743
2006-01-25
 
4744
2006-02-03
 
4745
select * from t4 order by colint;
 
4746
colint  col1
 
4747
1       2006-02-03
 
4748
2       2006-01-17
 
4749
3       2006-01-25
 
4750
4       2006-02-05
 
4751
select * from t5 order by colint;
 
4752
colint  col1
 
4753
1       2006-02-03
 
4754
2       2006-01-17
 
4755
3       2006-01-25
 
4756
4       2006-02-05
 
4757
select * from t6 order by colint;
 
4758
colint  col1
 
4759
1       2006-02-03
 
4760
2       2006-01-17
 
4761
3       2006-01-25
 
4762
4       2006-02-05
 
4763
update t1 set col1='2006-02-05' where col1='2006-02-03';
 
4764
update t2 set col1='2006-02-05' where col1='2006-02-03';
 
4765
update t3 set col1='2006-02-05' where col1='2006-02-03';
 
4766
update t4 set col1='2006-02-05' where col1='2006-02-03';
 
4767
update t5 set col1='2006-02-05' where col1='2006-02-03';
 
4768
update t6 set col1='2006-02-05' where col1='2006-02-03';
 
4769
select * from t1 order by col1;
 
4770
col1
 
4771
2006-01-17
 
4772
2006-02-05
 
4773
select * from t2 order by col1;
 
4774
col1
 
4775
2006-01-17
 
4776
2006-01-25
 
4777
2006-02-05
 
4778
select * from t3 order by col1;
 
4779
col1
 
4780
2006-01-17
 
4781
2006-01-25
 
4782
2006-02-05
 
4783
select * from t4 order by colint;
 
4784
colint  col1
 
4785
1       2006-02-05
 
4786
2       2006-01-17
 
4787
3       2006-01-25
 
4788
4       2006-02-05
 
4789
select * from t5 order by colint;
 
4790
colint  col1
 
4791
1       2006-02-05
 
4792
2       2006-01-17
 
4793
3       2006-01-25
 
4794
4       2006-02-05
 
4795
select * from t6 order by colint;
 
4796
colint  col1
 
4797
1       2006-02-05
 
4798
2       2006-01-17
 
4799
3       2006-01-25
 
4800
4       2006-02-05
 
4801
-------------------------------------------------------------------------
 
4802
---  Alter tables with dayofmonth(col1)
 
4803
-------------------------------------------------------------------------
 
4804
drop table if exists t11 ;
 
4805
drop table if exists t22 ;
 
4806
drop table if exists t33 ;
 
4807
drop table if exists t44 ;
 
4808
drop table if exists t55 ;
 
4809
drop table if exists t66 ;
 
4810
create table t11 engine='NDB' as select * from t1;
 
4811
create table t22 engine='NDB' as select * from t2;
 
4812
create table t33 engine='NDB' as select * from t3;
 
4813
create table t44 engine='NDB' as select * from t4;
 
4814
create table t55 engine='NDB' as select * from t5;
 
4815
create table t66 engine='NDB' as select * from t6;
 
4816
alter table t11
 
4817
partition by range(dayofmonth(col1)) 
 
4818
(partition p0 values less than (15),
 
4819
partition p1 values less than maxvalue);
 
4820
alter table t22
 
4821
partition by list(dayofmonth(col1)) 
 
4822
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
4823
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
4824
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
4825
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
4826
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
4827
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
4828
);
 
4829
alter table t33
 
4830
partition by hash(dayofmonth(col1));
 
4831
alter table t44
 
4832
partition by range(colint) 
 
4833
subpartition by hash(dayofmonth(col1)) subpartitions 2 
 
4834
(partition p0 values less than (15),
 
4835
partition p1 values less than maxvalue);
 
4836
alter table t55
 
4837
partition by list(colint)
 
4838
subpartition by hash(dayofmonth(col1)) subpartitions 2 
 
4839
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
4840
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
4841
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
4842
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
4843
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
4844
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
4845
);
 
4846
alter table t66
 
4847
partition by range(colint) 
 
4848
(partition p0 values less than (dayofmonth('2006-12-24')),
 
4849
partition p1 values less than maxvalue);
 
4850
select * from t11 order by col1;
 
4851
col1
 
4852
2006-01-17
 
4853
2006-02-05
 
4854
select * from t22 order by col1;
 
4855
col1
 
4856
2006-01-17
 
4857
2006-01-25
 
4858
2006-02-05
 
4859
select * from t33 order by col1;
 
4860
col1
 
4861
2006-01-17
 
4862
2006-01-25
 
4863
2006-02-05
 
4864
select * from t44 order by colint;
 
4865
colint  col1
 
4866
1       2006-02-05
 
4867
2       2006-01-17
 
4868
3       2006-01-25
 
4869
4       2006-02-05
 
4870
select * from t55 order by colint;
 
4871
colint  col1
 
4872
1       2006-02-05
 
4873
2       2006-01-17
 
4874
3       2006-01-25
 
4875
4       2006-02-05
 
4876
select * from t66 order by colint;
 
4877
colint  col1
 
4878
1       2006-02-05
 
4879
2       2006-01-17
 
4880
3       2006-01-25
 
4881
4       2006-02-05
 
4882
---------------------------
 
4883
---- some alter table begin
 
4884
---------------------------
 
4885
alter table t11
 
4886
reorganize partition p0,p1 into
 
4887
(partition s1 values less than maxvalue);
 
4888
select * from t11 order by col1;
 
4889
col1
 
4890
2006-01-17
 
4891
2006-02-05
 
4892
alter table t11
 
4893
reorganize partition s1 into
 
4894
(partition p0 values less than (15),
 
4895
partition p1 values less than maxvalue);
 
4896
select * from t11 order by col1;
 
4897
col1
 
4898
2006-01-17
 
4899
2006-02-05
 
4900
alter table t55
 
4901
partition by list(colint)
 
4902
subpartition by hash(dayofmonth(col1)) subpartitions 5 
 
4903
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
4904
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
4905
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
4906
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
4907
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
4908
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
4909
);
 
4910
show create table t55;
 
4911
Table   Create Table
 
4912
t55     CREATE TABLE `t55` (
 
4913
  `colint` int(11) DEFAULT NULL,
 
4914
  `col1` date DEFAULT NULL
 
4915
) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (dayofmonth(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
 
4916
select * from t55 order by colint;
 
4917
colint  col1
 
4918
1       2006-02-05
 
4919
2       2006-01-17
 
4920
3       2006-01-25
 
4921
4       2006-02-05
 
4922
alter table t66
 
4923
reorganize partition p0,p1 into
 
4924
(partition s1 values less than maxvalue);
 
4925
select * from t66 order by colint;
 
4926
colint  col1
 
4927
1       2006-02-05
 
4928
2       2006-01-17
 
4929
3       2006-01-25
 
4930
4       2006-02-05
 
4931
alter table t66
 
4932
reorganize partition s1 into
 
4933
(partition p0 values less than (dayofmonth('2006-12-24')),
 
4934
partition p1 values less than maxvalue);
 
4935
select * from t66 order by colint;
 
4936
colint  col1
 
4937
1       2006-02-05
 
4938
2       2006-01-17
 
4939
3       2006-01-25
 
4940
4       2006-02-05
 
4941
alter table t66
 
4942
reorganize partition p0,p1 into
 
4943
(partition s1 values less than maxvalue);
 
4944
select * from t66 order by colint;
 
4945
colint  col1
 
4946
1       2006-02-05
 
4947
2       2006-01-17
 
4948
3       2006-01-25
 
4949
4       2006-02-05
 
4950
alter table t66
 
4951
reorganize partition s1 into
 
4952
(partition p0 values less than (dayofmonth('2006-12-24')),
 
4953
partition p1 values less than maxvalue);
 
4954
select * from t66 order by colint;
 
4955
colint  col1
 
4956
1       2006-02-05
 
4957
2       2006-01-17
 
4958
3       2006-01-25
 
4959
4       2006-02-05
 
4960
-------------------------------------------------------------------------
 
4961
---  Delete rows and partitions of tables with dayofmonth(col1)
 
4962
-------------------------------------------------------------------------
 
4963
delete from t1 where col1='2006-01-17';
 
4964
delete from t2 where col1='2006-01-17';
 
4965
delete from t3 where col1='2006-01-17';
 
4966
delete from t4 where col1='2006-01-17';
 
4967
delete from t5 where col1='2006-01-17';
 
4968
delete from t6 where col1='2006-01-17';
 
4969
select * from t1 order by col1;
 
4970
col1
 
4971
2006-02-05
 
4972
select * from t2 order by col1;
 
4973
col1
 
4974
2006-01-25
 
4975
2006-02-05
 
4976
select * from t3 order by col1;
 
4977
col1
 
4978
2006-01-25
 
4979
2006-02-05
 
4980
select * from t4 order by colint;
 
4981
colint  col1
 
4982
1       2006-02-05
 
4983
3       2006-01-25
 
4984
4       2006-02-05
 
4985
select * from t5 order by colint;
 
4986
colint  col1
 
4987
1       2006-02-05
 
4988
3       2006-01-25
 
4989
4       2006-02-05
 
4990
insert into t1 values ('2006-01-17');
 
4991
insert into t2 values ('2006-01-17');
 
4992
insert into t3 values ('2006-01-17');
 
4993
insert into t4 values (60,'2006-01-17');
 
4994
insert into t5 values (60,'2006-01-17');
 
4995
insert into t6 values (60,'2006-01-17');
 
4996
select * from t1 order by col1;
 
4997
col1
 
4998
2006-01-17
 
4999
2006-02-05
 
5000
select * from t2 order by col1;
 
5001
col1
 
5002
2006-01-17
 
5003
2006-01-25
 
5004
2006-02-05
 
5005
select * from t3 order by col1;
 
5006
col1
 
5007
2006-01-17
 
5008
2006-01-25
 
5009
2006-02-05
 
5010
select * from t4 order by colint;
 
5011
colint  col1
 
5012
1       2006-02-05
 
5013
3       2006-01-25
 
5014
4       2006-02-05
 
5015
60      2006-01-17
 
5016
select * from t5 order by colint;
 
5017
colint  col1
 
5018
1       2006-02-05
 
5019
3       2006-01-25
 
5020
4       2006-02-05
 
5021
60      2006-01-17
 
5022
select * from t6 order by colint;
 
5023
colint  col1
 
5024
1       2006-02-05
 
5025
3       2006-01-25
 
5026
4       2006-02-05
 
5027
60      2006-01-17
 
5028
alter table t1 drop partition p0;
 
5029
alter table t2 drop partition p0;
 
5030
alter table t4 drop partition p0;
 
5031
alter table t5 drop partition p0;
 
5032
alter table t6 drop partition p0;
 
5033
select * from t1 order by col1;
 
5034
col1
 
5035
2006-01-17
 
5036
select * from t2 order by col1;
 
5037
col1
 
5038
2006-01-17
 
5039
2006-01-25
 
5040
select * from t3 order by col1;
 
5041
col1
 
5042
2006-01-17
 
5043
2006-01-25
 
5044
2006-02-05
 
5045
select * from t4 order by colint;
 
5046
colint  col1
 
5047
60      2006-01-17
 
5048
select * from t5 order by colint;
 
5049
colint  col1
 
5050
60      2006-01-17
 
5051
select * from t6 order by colint;
 
5052
colint  col1
 
5053
60      2006-01-17
 
5054
-------------------------------------------------------------------------
 
5055
---  Delete rows and partitions of tables with dayofmonth(col1)
 
5056
-------------------------------------------------------------------------
 
5057
delete from t11 where col1='2006-01-17';
 
5058
delete from t22 where col1='2006-01-17';
 
5059
delete from t33 where col1='2006-01-17';
 
5060
delete from t44 where col1='2006-01-17';
 
5061
delete from t55 where col1='2006-01-17';
 
5062
delete from t66 where col1='2006-01-17';
 
5063
select * from t11 order by col1;
 
5064
col1
 
5065
2006-02-05
 
5066
select * from t22 order by col1;
 
5067
col1
 
5068
2006-01-25
 
5069
2006-02-05
 
5070
select * from t33 order by col1;
 
5071
col1
 
5072
2006-01-25
 
5073
2006-02-05
 
5074
select * from t44 order by colint;
 
5075
colint  col1
 
5076
1       2006-02-05
 
5077
3       2006-01-25
 
5078
4       2006-02-05
 
5079
select * from t55 order by colint;
 
5080
colint  col1
 
5081
1       2006-02-05
 
5082
3       2006-01-25
 
5083
4       2006-02-05
 
5084
insert into t11 values ('2006-01-17');
 
5085
insert into t22 values ('2006-01-17');
 
5086
insert into t33 values ('2006-01-17');
 
5087
insert into t44 values (60,'2006-01-17');
 
5088
insert into t55 values (60,'2006-01-17');
 
5089
insert into t66 values (60,'2006-01-17');
 
5090
select * from t11 order by col1;
 
5091
col1
 
5092
2006-01-17
 
5093
2006-02-05
 
5094
select * from t22 order by col1;
 
5095
col1
 
5096
2006-01-17
 
5097
2006-01-25
 
5098
2006-02-05
 
5099
select * from t33 order by col1;
 
5100
col1
 
5101
2006-01-17
 
5102
2006-01-25
 
5103
2006-02-05
 
5104
select * from t44 order by colint;
 
5105
colint  col1
 
5106
1       2006-02-05
 
5107
3       2006-01-25
 
5108
4       2006-02-05
 
5109
60      2006-01-17
 
5110
select * from t55 order by colint;
 
5111
colint  col1
 
5112
1       2006-02-05
 
5113
3       2006-01-25
 
5114
4       2006-02-05
 
5115
60      2006-01-17
 
5116
select * from t66 order by colint;
 
5117
colint  col1
 
5118
1       2006-02-05
 
5119
3       2006-01-25
 
5120
4       2006-02-05
 
5121
60      2006-01-17
 
5122
alter table t11 drop partition p0;
 
5123
alter table t22 drop partition p0;
 
5124
alter table t44 drop partition p0;
 
5125
alter table t55 drop partition p0;
 
5126
alter table t66 drop partition p0;
 
5127
select * from t11 order by col1;
 
5128
col1
 
5129
2006-01-17
 
5130
select * from t22 order by col1;
 
5131
col1
 
5132
2006-01-17
 
5133
2006-01-25
 
5134
select * from t33 order by col1;
 
5135
col1
 
5136
2006-01-17
 
5137
2006-01-25
 
5138
2006-02-05
 
5139
select * from t44 order by colint;
 
5140
colint  col1
 
5141
60      2006-01-17
 
5142
select * from t55 order by colint;
 
5143
colint  col1
 
5144
60      2006-01-17
 
5145
select * from t66 order by colint;
 
5146
colint  col1
 
5147
60      2006-01-17
 
5148
-------------------------
 
5149
---- some alter table end
 
5150
-------------------------
 
5151
drop table if exists t1 ;
 
5152
drop table if exists t2 ;
 
5153
drop table if exists t3 ;
 
5154
drop table if exists t4 ;
 
5155
drop table if exists t5 ;
 
5156
drop table if exists t6 ;
 
5157
drop table if exists t11 ;
 
5158
drop table if exists t22 ;
 
5159
drop table if exists t33 ;
 
5160
drop table if exists t44 ;
 
5161
drop table if exists t55 ;
 
5162
drop table if exists t66 ;
 
5163
-------------------------------------------------------------------------
 
5164
---  dayofweek(col1)  in partition with coltype  date
 
5165
-------------------------------------------------------------------------
 
5166
drop table if exists t1 ;
 
5167
drop table if exists t2 ;
 
5168
drop table if exists t3 ;
 
5169
drop table if exists t4 ;
 
5170
drop table if exists t5 ;
 
5171
drop table if exists t6 ;
 
5172
-------------------------------------------------------------------------
 
5173
---  Create tables with dayofweek(col1)
 
5174
-------------------------------------------------------------------------
 
5175
create table t1 (col1 date) engine='NDB' 
 
5176
partition by range(dayofweek(col1)) 
 
5177
(partition p0 values less than (15),
 
5178
partition p1 values less than maxvalue);
 
5179
create table t2 (col1 date) engine='NDB' 
 
5180
partition by list(dayofweek(col1)) 
 
5181
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
5182
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
5183
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
5184
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
5185
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
5186
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
5187
);
 
5188
create table t3 (col1 date) engine='NDB' 
 
5189
partition by hash(dayofweek(col1));
 
5190
create table t4 (colint int, col1 date) engine='NDB' 
 
5191
partition by range(colint) 
 
5192
subpartition by hash(dayofweek(col1)) subpartitions 2 
 
5193
(partition p0 values less than (15),
 
5194
partition p1 values less than maxvalue);
 
5195
create table t5 (colint int, col1 date) engine='NDB' 
 
5196
partition by list(colint)
 
5197
subpartition by hash(dayofweek(col1)) subpartitions 2 
 
5198
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
5199
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
5200
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
5201
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
5202
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
5203
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
5204
);
 
5205
create table t6 (colint int, col1 date) engine='NDB' 
 
5206
partition by range(colint) 
 
5207
(partition p0 values less than (dayofweek('2006-12-24')),
 
5208
partition p1 values less than maxvalue);
 
5209
-------------------------------------------------------------------------
 
5210
---  Access tables with dayofweek(col1) 
 
5211
-------------------------------------------------------------------------
 
5212
insert into t1 values ('2006-01-03');
 
5213
insert into t1 values ('2006-02-17');
 
5214
insert into t2 values ('2006-01-03');
 
5215
insert into t2 values ('2006-02-17');
 
5216
insert into t2 values ('2006-01-25');
 
5217
insert into t3 values ('2006-01-03');
 
5218
insert into t3 values ('2006-02-17');
 
5219
insert into t3 values ('2006-01-25');
 
5220
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
 
5221
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
 
5222
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
 
5223
select dayofweek(col1) from t1 order by col1;
 
5224
dayofweek(col1)
 
5225
3
 
5226
6
 
5227
select * from t1 order by col1;
 
5228
col1
 
5229
2006-01-03
 
5230
2006-02-17
 
5231
select * from t2 order by col1;
 
5232
col1
 
5233
2006-01-03
 
5234
2006-01-25
 
5235
2006-02-17
 
5236
select * from t3 order by col1;
 
5237
col1
 
5238
2006-01-03
 
5239
2006-01-25
 
5240
2006-02-17
 
5241
select * from t4 order by colint;
 
5242
colint  col1
 
5243
1       2006-02-03
 
5244
2       2006-01-17
 
5245
3       2006-01-25
 
5246
4       2006-02-05
 
5247
select * from t5 order by colint;
 
5248
colint  col1
 
5249
1       2006-02-03
 
5250
2       2006-01-17
 
5251
3       2006-01-25
 
5252
4       2006-02-05
 
5253
select * from t6 order by colint;
 
5254
colint  col1
 
5255
1       2006-02-03
 
5256
2       2006-01-17
 
5257
3       2006-01-25
 
5258
4       2006-02-05
 
5259
update t1 set col1='2006-02-05' where col1='2006-01-03';
 
5260
update t2 set col1='2006-02-05' where col1='2006-01-03';
 
5261
update t3 set col1='2006-02-05' where col1='2006-01-03';
 
5262
update t4 set col1='2006-02-05' where col1='2006-01-03';
 
5263
update t5 set col1='2006-02-05' where col1='2006-01-03';
 
5264
update t6 set col1='2006-02-05' where col1='2006-01-03';
 
5265
select * from t1 order by col1;
 
5266
col1
 
5267
2006-02-05
 
5268
2006-02-17
 
5269
select * from t2 order by col1;
 
5270
col1
 
5271
2006-01-25
 
5272
2006-02-05
 
5273
2006-02-17
 
5274
select * from t3 order by col1;
 
5275
col1
 
5276
2006-01-25
 
5277
2006-02-05
 
5278
2006-02-17
 
5279
select * from t4 order by colint;
 
5280
colint  col1
 
5281
1       2006-02-03
 
5282
2       2006-01-17
 
5283
3       2006-01-25
 
5284
4       2006-02-05
 
5285
select * from t5 order by colint;
 
5286
colint  col1
 
5287
1       2006-02-03
 
5288
2       2006-01-17
 
5289
3       2006-01-25
 
5290
4       2006-02-05
 
5291
select * from t6 order by colint;
 
5292
colint  col1
 
5293
1       2006-02-03
 
5294
2       2006-01-17
 
5295
3       2006-01-25
 
5296
4       2006-02-05
 
5297
-------------------------------------------------------------------------
 
5298
---  Alter tables with dayofweek(col1)
 
5299
-------------------------------------------------------------------------
 
5300
drop table if exists t11 ;
 
5301
drop table if exists t22 ;
 
5302
drop table if exists t33 ;
 
5303
drop table if exists t44 ;
 
5304
drop table if exists t55 ;
 
5305
drop table if exists t66 ;
 
5306
create table t11 engine='NDB' as select * from t1;
 
5307
create table t22 engine='NDB' as select * from t2;
 
5308
create table t33 engine='NDB' as select * from t3;
 
5309
create table t44 engine='NDB' as select * from t4;
 
5310
create table t55 engine='NDB' as select * from t5;
 
5311
create table t66 engine='NDB' as select * from t6;
 
5312
alter table t11
 
5313
partition by range(dayofweek(col1)) 
 
5314
(partition p0 values less than (15),
 
5315
partition p1 values less than maxvalue);
 
5316
alter table t22
 
5317
partition by list(dayofweek(col1)) 
 
5318
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
5319
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
5320
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
5321
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
5322
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
5323
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
5324
);
 
5325
alter table t33
 
5326
partition by hash(dayofweek(col1));
 
5327
alter table t44
 
5328
partition by range(colint) 
 
5329
subpartition by hash(dayofweek(col1)) subpartitions 2 
 
5330
(partition p0 values less than (15),
 
5331
partition p1 values less than maxvalue);
 
5332
alter table t55
 
5333
partition by list(colint)
 
5334
subpartition by hash(dayofweek(col1)) subpartitions 2 
 
5335
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
5336
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
5337
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
5338
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
5339
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
5340
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
5341
);
 
5342
alter table t66
 
5343
partition by range(colint) 
 
5344
(partition p0 values less than (dayofweek('2006-12-24')),
 
5345
partition p1 values less than maxvalue);
 
5346
select * from t11 order by col1;
 
5347
col1
 
5348
2006-02-05
 
5349
2006-02-17
 
5350
select * from t22 order by col1;
 
5351
col1
 
5352
2006-01-25
 
5353
2006-02-05
 
5354
2006-02-17
 
5355
select * from t33 order by col1;
 
5356
col1
 
5357
2006-01-25
 
5358
2006-02-05
 
5359
2006-02-17
 
5360
select * from t44 order by colint;
 
5361
colint  col1
 
5362
1       2006-02-03
 
5363
2       2006-01-17
 
5364
3       2006-01-25
 
5365
4       2006-02-05
 
5366
select * from t55 order by colint;
 
5367
colint  col1
 
5368
1       2006-02-03
 
5369
2       2006-01-17
 
5370
3       2006-01-25
 
5371
4       2006-02-05
 
5372
select * from t66 order by colint;
 
5373
colint  col1
 
5374
1       2006-02-03
 
5375
2       2006-01-17
 
5376
3       2006-01-25
 
5377
4       2006-02-05
 
5378
---------------------------
 
5379
---- some alter table begin
 
5380
---------------------------
 
5381
alter table t11
 
5382
reorganize partition p0,p1 into
 
5383
(partition s1 values less than maxvalue);
 
5384
select * from t11 order by col1;
 
5385
col1
 
5386
2006-02-05
 
5387
2006-02-17
 
5388
alter table t11
 
5389
reorganize partition s1 into
 
5390
(partition p0 values less than (15),
 
5391
partition p1 values less than maxvalue);
 
5392
select * from t11 order by col1;
 
5393
col1
 
5394
2006-02-05
 
5395
2006-02-17
 
5396
alter table t55
 
5397
partition by list(colint)
 
5398
subpartition by hash(dayofweek(col1)) subpartitions 5 
 
5399
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
5400
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
5401
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
5402
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
5403
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
5404
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
5405
);
 
5406
show create table t55;
 
5407
Table   Create Table
 
5408
t55     CREATE TABLE `t55` (
 
5409
  `colint` int(11) DEFAULT NULL,
 
5410
  `col1` date DEFAULT NULL
 
5411
) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (dayofweek(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
 
5412
select * from t55 order by colint;
 
5413
colint  col1
 
5414
1       2006-02-03
 
5415
2       2006-01-17
 
5416
3       2006-01-25
 
5417
4       2006-02-05
 
5418
alter table t66
 
5419
reorganize partition p0,p1 into
 
5420
(partition s1 values less than maxvalue);
 
5421
select * from t66 order by colint;
 
5422
colint  col1
 
5423
1       2006-02-03
 
5424
2       2006-01-17
 
5425
3       2006-01-25
 
5426
4       2006-02-05
 
5427
alter table t66
 
5428
reorganize partition s1 into
 
5429
(partition p0 values less than (dayofweek('2006-12-24')),
 
5430
partition p1 values less than maxvalue);
 
5431
select * from t66 order by colint;
 
5432
colint  col1
 
5433
1       2006-02-03
 
5434
2       2006-01-17
 
5435
3       2006-01-25
 
5436
4       2006-02-05
 
5437
alter table t66
 
5438
reorganize partition p0,p1 into
 
5439
(partition s1 values less than maxvalue);
 
5440
select * from t66 order by colint;
 
5441
colint  col1
 
5442
1       2006-02-03
 
5443
2       2006-01-17
 
5444
3       2006-01-25
 
5445
4       2006-02-05
 
5446
alter table t66
 
5447
reorganize partition s1 into
 
5448
(partition p0 values less than (dayofweek('2006-12-24')),
 
5449
partition p1 values less than maxvalue);
 
5450
select * from t66 order by colint;
 
5451
colint  col1
 
5452
1       2006-02-03
 
5453
2       2006-01-17
 
5454
3       2006-01-25
 
5455
4       2006-02-05
 
5456
-------------------------------------------------------------------------
 
5457
---  Delete rows and partitions of tables with dayofweek(col1)
 
5458
-------------------------------------------------------------------------
 
5459
delete from t1 where col1='2006-02-17';
 
5460
delete from t2 where col1='2006-02-17';
 
5461
delete from t3 where col1='2006-02-17';
 
5462
delete from t4 where col1='2006-02-17';
 
5463
delete from t5 where col1='2006-02-17';
 
5464
delete from t6 where col1='2006-02-17';
 
5465
select * from t1 order by col1;
 
5466
col1
 
5467
2006-02-05
 
5468
select * from t2 order by col1;
 
5469
col1
 
5470
2006-01-25
 
5471
2006-02-05
 
5472
select * from t3 order by col1;
 
5473
col1
 
5474
2006-01-25
 
5475
2006-02-05
 
5476
select * from t4 order by colint;
 
5477
colint  col1
 
5478
1       2006-02-03
 
5479
2       2006-01-17
 
5480
3       2006-01-25
 
5481
4       2006-02-05
 
5482
select * from t5 order by colint;
 
5483
colint  col1
 
5484
1       2006-02-03
 
5485
2       2006-01-17
 
5486
3       2006-01-25
 
5487
4       2006-02-05
 
5488
insert into t1 values ('2006-02-17');
 
5489
insert into t2 values ('2006-02-17');
 
5490
insert into t3 values ('2006-02-17');
 
5491
insert into t4 values (60,'2006-02-17');
 
5492
insert into t5 values (60,'2006-02-17');
 
5493
insert into t6 values (60,'2006-02-17');
 
5494
select * from t1 order by col1;
 
5495
col1
 
5496
2006-02-05
 
5497
2006-02-17
 
5498
select * from t2 order by col1;
 
5499
col1
 
5500
2006-01-25
 
5501
2006-02-05
 
5502
2006-02-17
 
5503
select * from t3 order by col1;
 
5504
col1
 
5505
2006-01-25
 
5506
2006-02-05
 
5507
2006-02-17
 
5508
select * from t4 order by colint;
 
5509
colint  col1
 
5510
1       2006-02-03
 
5511
2       2006-01-17
 
5512
3       2006-01-25
 
5513
4       2006-02-05
 
5514
60      2006-02-17
 
5515
select * from t5 order by colint;
 
5516
colint  col1
 
5517
1       2006-02-03
 
5518
2       2006-01-17
 
5519
3       2006-01-25
 
5520
4       2006-02-05
 
5521
60      2006-02-17
 
5522
select * from t6 order by colint;
 
5523
colint  col1
 
5524
1       2006-02-03
 
5525
2       2006-01-17
 
5526
3       2006-01-25
 
5527
4       2006-02-05
 
5528
60      2006-02-17
 
5529
alter table t1 drop partition p0;
 
5530
alter table t2 drop partition p0;
 
5531
alter table t4 drop partition p0;
 
5532
alter table t5 drop partition p0;
 
5533
alter table t6 drop partition p0;
 
5534
select * from t1 order by col1;
 
5535
col1
 
5536
select * from t2 order by col1;
 
5537
col1
 
5538
select * from t3 order by col1;
 
5539
col1
 
5540
2006-01-25
 
5541
2006-02-05
 
5542
2006-02-17
 
5543
select * from t4 order by colint;
 
5544
colint  col1
 
5545
60      2006-02-17
 
5546
select * from t5 order by colint;
 
5547
colint  col1
 
5548
60      2006-02-17
 
5549
select * from t6 order by colint;
 
5550
colint  col1
 
5551
1       2006-02-03
 
5552
2       2006-01-17
 
5553
3       2006-01-25
 
5554
4       2006-02-05
 
5555
60      2006-02-17
 
5556
-------------------------------------------------------------------------
 
5557
---  Delete rows and partitions of tables with dayofweek(col1)
 
5558
-------------------------------------------------------------------------
 
5559
delete from t11 where col1='2006-02-17';
 
5560
delete from t22 where col1='2006-02-17';
 
5561
delete from t33 where col1='2006-02-17';
 
5562
delete from t44 where col1='2006-02-17';
 
5563
delete from t55 where col1='2006-02-17';
 
5564
delete from t66 where col1='2006-02-17';
 
5565
select * from t11 order by col1;
 
5566
col1
 
5567
2006-02-05
 
5568
select * from t22 order by col1;
 
5569
col1
 
5570
2006-01-25
 
5571
2006-02-05
 
5572
select * from t33 order by col1;
 
5573
col1
 
5574
2006-01-25
 
5575
2006-02-05
 
5576
select * from t44 order by colint;
 
5577
colint  col1
 
5578
1       2006-02-03
 
5579
2       2006-01-17
 
5580
3       2006-01-25
 
5581
4       2006-02-05
 
5582
select * from t55 order by colint;
 
5583
colint  col1
 
5584
1       2006-02-03
 
5585
2       2006-01-17
 
5586
3       2006-01-25
 
5587
4       2006-02-05
 
5588
insert into t11 values ('2006-02-17');
 
5589
insert into t22 values ('2006-02-17');
 
5590
insert into t33 values ('2006-02-17');
 
5591
insert into t44 values (60,'2006-02-17');
 
5592
insert into t55 values (60,'2006-02-17');
 
5593
insert into t66 values (60,'2006-02-17');
 
5594
select * from t11 order by col1;
 
5595
col1
 
5596
2006-02-05
 
5597
2006-02-17
 
5598
select * from t22 order by col1;
 
5599
col1
 
5600
2006-01-25
 
5601
2006-02-05
 
5602
2006-02-17
 
5603
select * from t33 order by col1;
 
5604
col1
 
5605
2006-01-25
 
5606
2006-02-05
 
5607
2006-02-17
 
5608
select * from t44 order by colint;
 
5609
colint  col1
 
5610
1       2006-02-03
 
5611
2       2006-01-17
 
5612
3       2006-01-25
 
5613
4       2006-02-05
 
5614
60      2006-02-17
 
5615
select * from t55 order by colint;
 
5616
colint  col1
 
5617
1       2006-02-03
 
5618
2       2006-01-17
 
5619
3       2006-01-25
 
5620
4       2006-02-05
 
5621
60      2006-02-17
 
5622
select * from t66 order by colint;
 
5623
colint  col1
 
5624
1       2006-02-03
 
5625
2       2006-01-17
 
5626
3       2006-01-25
 
5627
4       2006-02-05
 
5628
60      2006-02-17
 
5629
alter table t11 drop partition p0;
 
5630
alter table t22 drop partition p0;
 
5631
alter table t44 drop partition p0;
 
5632
alter table t55 drop partition p0;
 
5633
alter table t66 drop partition p0;
 
5634
select * from t11 order by col1;
 
5635
col1
 
5636
select * from t22 order by col1;
 
5637
col1
 
5638
select * from t33 order by col1;
 
5639
col1
 
5640
2006-01-25
 
5641
2006-02-05
 
5642
2006-02-17
 
5643
select * from t44 order by colint;
 
5644
colint  col1
 
5645
60      2006-02-17
 
5646
select * from t55 order by colint;
 
5647
colint  col1
 
5648
60      2006-02-17
 
5649
select * from t66 order by colint;
 
5650
colint  col1
 
5651
1       2006-02-03
 
5652
2       2006-01-17
 
5653
3       2006-01-25
 
5654
4       2006-02-05
 
5655
60      2006-02-17
 
5656
-------------------------
 
5657
---- some alter table end
 
5658
-------------------------
 
5659
drop table if exists t1 ;
 
5660
drop table if exists t2 ;
 
5661
drop table if exists t3 ;
 
5662
drop table if exists t4 ;
 
5663
drop table if exists t5 ;
 
5664
drop table if exists t6 ;
 
5665
drop table if exists t11 ;
 
5666
drop table if exists t22 ;
 
5667
drop table if exists t33 ;
 
5668
drop table if exists t44 ;
 
5669
drop table if exists t55 ;
 
5670
drop table if exists t66 ;
 
5671
-------------------------------------------------------------------------
 
5672
---  dayofyear(col1)  in partition with coltype  date
 
5673
-------------------------------------------------------------------------
 
5674
drop table if exists t1 ;
 
5675
drop table if exists t2 ;
 
5676
drop table if exists t3 ;
 
5677
drop table if exists t4 ;
 
5678
drop table if exists t5 ;
 
5679
drop table if exists t6 ;
 
5680
-------------------------------------------------------------------------
 
5681
---  Create tables with dayofyear(col1)
 
5682
-------------------------------------------------------------------------
 
5683
create table t1 (col1 date) engine='NDB' 
 
5684
partition by range(dayofyear(col1)) 
 
5685
(partition p0 values less than (15),
 
5686
partition p1 values less than maxvalue);
 
5687
create table t2 (col1 date) engine='NDB' 
 
5688
partition by list(dayofyear(col1)) 
 
5689
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
5690
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
5691
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
5692
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
5693
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
5694
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
5695
);
 
5696
create table t3 (col1 date) engine='NDB' 
 
5697
partition by hash(dayofyear(col1));
 
5698
create table t4 (colint int, col1 date) engine='NDB' 
 
5699
partition by range(colint) 
 
5700
subpartition by hash(dayofyear(col1)) subpartitions 2 
 
5701
(partition p0 values less than (15),
 
5702
partition p1 values less than maxvalue);
 
5703
create table t5 (colint int, col1 date) engine='NDB' 
 
5704
partition by list(colint)
 
5705
subpartition by hash(dayofyear(col1)) subpartitions 2 
 
5706
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
5707
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
5708
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
5709
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
5710
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
5711
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
5712
);
 
5713
create table t6 (colint int, col1 date) engine='NDB' 
 
5714
partition by range(colint) 
 
5715
(partition p0 values less than (dayofyear('2006-12-25')),
 
5716
partition p1 values less than maxvalue);
 
5717
-------------------------------------------------------------------------
 
5718
---  Access tables with dayofyear(col1) 
 
5719
-------------------------------------------------------------------------
 
5720
insert into t1 values ('2006-01-03');
 
5721
insert into t1 values ('2006-01-17');
 
5722
insert into t2 values ('2006-01-03');
 
5723
insert into t2 values ('2006-01-17');
 
5724
insert into t2 values ('2006-02-25');
 
5725
insert into t3 values ('2006-01-03');
 
5726
insert into t3 values ('2006-01-17');
 
5727
insert into t3 values ('2006-02-25');
 
5728
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
 
5729
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
 
5730
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
 
5731
select dayofyear(col1) from t1 order by col1;
 
5732
dayofyear(col1)
 
5733
3
 
5734
17
 
5735
select * from t1 order by col1;
 
5736
col1
 
5737
2006-01-03
 
5738
2006-01-17
 
5739
select * from t2 order by col1;
 
5740
col1
 
5741
2006-01-03
 
5742
2006-01-17
 
5743
2006-02-25
 
5744
select * from t3 order by col1;
 
5745
col1
 
5746
2006-01-03
 
5747
2006-01-17
 
5748
2006-02-25
 
5749
select * from t4 order by colint;
 
5750
colint  col1
 
5751
1       2006-02-03
 
5752
2       2006-01-17
 
5753
3       2006-01-25
 
5754
4       2006-02-05
 
5755
select * from t5 order by colint;
 
5756
colint  col1
 
5757
1       2006-02-03
 
5758
2       2006-01-17
 
5759
3       2006-01-25
 
5760
4       2006-02-05
 
5761
select * from t6 order by colint;
 
5762
colint  col1
 
5763
1       2006-02-03
 
5764
2       2006-01-17
 
5765
3       2006-01-25
 
5766
4       2006-02-05
 
5767
update t1 set col1='2006-02-05' where col1='2006-01-03';
 
5768
update t2 set col1='2006-02-05' where col1='2006-01-03';
 
5769
update t3 set col1='2006-02-05' where col1='2006-01-03';
 
5770
update t4 set col1='2006-02-05' where col1='2006-01-03';
 
5771
update t5 set col1='2006-02-05' where col1='2006-01-03';
 
5772
update t6 set col1='2006-02-05' where col1='2006-01-03';
 
5773
select * from t1 order by col1;
 
5774
col1
 
5775
2006-01-17
 
5776
2006-02-05
 
5777
select * from t2 order by col1;
 
5778
col1
 
5779
2006-01-17
 
5780
2006-02-05
 
5781
2006-02-25
 
5782
select * from t3 order by col1;
 
5783
col1
 
5784
2006-01-17
 
5785
2006-02-05
 
5786
2006-02-25
 
5787
select * from t4 order by colint;
 
5788
colint  col1
 
5789
1       2006-02-03
 
5790
2       2006-01-17
 
5791
3       2006-01-25
 
5792
4       2006-02-05
 
5793
select * from t5 order by colint;
 
5794
colint  col1
 
5795
1       2006-02-03
 
5796
2       2006-01-17
 
5797
3       2006-01-25
 
5798
4       2006-02-05
 
5799
select * from t6 order by colint;
 
5800
colint  col1
 
5801
1       2006-02-03
 
5802
2       2006-01-17
 
5803
3       2006-01-25
 
5804
4       2006-02-05
 
5805
-------------------------------------------------------------------------
 
5806
---  Alter tables with dayofyear(col1)
 
5807
-------------------------------------------------------------------------
 
5808
drop table if exists t11 ;
 
5809
drop table if exists t22 ;
 
5810
drop table if exists t33 ;
 
5811
drop table if exists t44 ;
 
5812
drop table if exists t55 ;
 
5813
drop table if exists t66 ;
 
5814
create table t11 engine='NDB' as select * from t1;
 
5815
create table t22 engine='NDB' as select * from t2;
 
5816
create table t33 engine='NDB' as select * from t3;
 
5817
create table t44 engine='NDB' as select * from t4;
 
5818
create table t55 engine='NDB' as select * from t5;
 
5819
create table t66 engine='NDB' as select * from t6;
 
5820
alter table t11
 
5821
partition by range(dayofyear(col1)) 
 
5822
(partition p0 values less than (15),
 
5823
partition p1 values less than maxvalue);
 
5824
alter table t22
 
5825
partition by list(dayofyear(col1)) 
 
5826
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
5827
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
5828
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
5829
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
5830
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
5831
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
5832
);
 
5833
alter table t33
 
5834
partition by hash(dayofyear(col1));
 
5835
alter table t44
 
5836
partition by range(colint) 
 
5837
subpartition by hash(dayofyear(col1)) subpartitions 2 
 
5838
(partition p0 values less than (15),
 
5839
partition p1 values less than maxvalue);
 
5840
alter table t55
 
5841
partition by list(colint)
 
5842
subpartition by hash(dayofyear(col1)) subpartitions 2 
 
5843
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
5844
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
5845
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
5846
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
5847
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
5848
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
5849
);
 
5850
alter table t66
 
5851
partition by range(colint) 
 
5852
(partition p0 values less than (dayofyear('2006-12-25')),
 
5853
partition p1 values less than maxvalue);
 
5854
select * from t11 order by col1;
 
5855
col1
 
5856
2006-01-17
 
5857
2006-02-05
 
5858
select * from t22 order by col1;
 
5859
col1
 
5860
2006-01-17
 
5861
2006-02-05
 
5862
2006-02-25
 
5863
select * from t33 order by col1;
 
5864
col1
 
5865
2006-01-17
 
5866
2006-02-05
 
5867
2006-02-25
 
5868
select * from t44 order by colint;
 
5869
colint  col1
 
5870
1       2006-02-03
 
5871
2       2006-01-17
 
5872
3       2006-01-25
 
5873
4       2006-02-05
 
5874
select * from t55 order by colint;
 
5875
colint  col1
 
5876
1       2006-02-03
 
5877
2       2006-01-17
 
5878
3       2006-01-25
 
5879
4       2006-02-05
 
5880
select * from t66 order by colint;
 
5881
colint  col1
 
5882
1       2006-02-03
 
5883
2       2006-01-17
 
5884
3       2006-01-25
 
5885
4       2006-02-05
 
5886
---------------------------
 
5887
---- some alter table begin
 
5888
---------------------------
 
5889
alter table t11
 
5890
reorganize partition p0,p1 into
 
5891
(partition s1 values less than maxvalue);
 
5892
select * from t11 order by col1;
 
5893
col1
 
5894
2006-01-17
 
5895
2006-02-05
 
5896
alter table t11
 
5897
reorganize partition s1 into
 
5898
(partition p0 values less than (15),
 
5899
partition p1 values less than maxvalue);
 
5900
select * from t11 order by col1;
 
5901
col1
 
5902
2006-01-17
 
5903
2006-02-05
 
5904
alter table t55
 
5905
partition by list(colint)
 
5906
subpartition by hash(dayofyear(col1)) subpartitions 5 
 
5907
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
5908
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
5909
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
5910
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
5911
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
5912
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
5913
);
 
5914
show create table t55;
 
5915
Table   Create Table
 
5916
t55     CREATE TABLE `t55` (
 
5917
  `colint` int(11) DEFAULT NULL,
 
5918
  `col1` date DEFAULT NULL
 
5919
) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (dayofyear(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
 
5920
select * from t55 order by colint;
 
5921
colint  col1
 
5922
1       2006-02-03
 
5923
2       2006-01-17
 
5924
3       2006-01-25
 
5925
4       2006-02-05
 
5926
alter table t66
 
5927
reorganize partition p0,p1 into
 
5928
(partition s1 values less than maxvalue);
 
5929
select * from t66 order by colint;
 
5930
colint  col1
 
5931
1       2006-02-03
 
5932
2       2006-01-17
 
5933
3       2006-01-25
 
5934
4       2006-02-05
 
5935
alter table t66
 
5936
reorganize partition s1 into
 
5937
(partition p0 values less than (dayofyear('2006-12-25')),
 
5938
partition p1 values less than maxvalue);
 
5939
select * from t66 order by colint;
 
5940
colint  col1
 
5941
1       2006-02-03
 
5942
2       2006-01-17
 
5943
3       2006-01-25
 
5944
4       2006-02-05
 
5945
alter table t66
 
5946
reorganize partition p0,p1 into
 
5947
(partition s1 values less than maxvalue);
 
5948
select * from t66 order by colint;
 
5949
colint  col1
 
5950
1       2006-02-03
 
5951
2       2006-01-17
 
5952
3       2006-01-25
 
5953
4       2006-02-05
 
5954
alter table t66
 
5955
reorganize partition s1 into
 
5956
(partition p0 values less than (dayofyear('2006-12-25')),
 
5957
partition p1 values less than maxvalue);
 
5958
select * from t66 order by colint;
 
5959
colint  col1
 
5960
1       2006-02-03
 
5961
2       2006-01-17
 
5962
3       2006-01-25
 
5963
4       2006-02-05
 
5964
-------------------------------------------------------------------------
 
5965
---  Delete rows and partitions of tables with dayofyear(col1)
 
5966
-------------------------------------------------------------------------
 
5967
delete from t1 where col1='2006-01-17';
 
5968
delete from t2 where col1='2006-01-17';
 
5969
delete from t3 where col1='2006-01-17';
 
5970
delete from t4 where col1='2006-01-17';
 
5971
delete from t5 where col1='2006-01-17';
 
5972
delete from t6 where col1='2006-01-17';
 
5973
select * from t1 order by col1;
 
5974
col1
 
5975
2006-02-05
 
5976
select * from t2 order by col1;
 
5977
col1
 
5978
2006-02-05
 
5979
2006-02-25
 
5980
select * from t3 order by col1;
 
5981
col1
 
5982
2006-02-05
 
5983
2006-02-25
 
5984
select * from t4 order by colint;
 
5985
colint  col1
 
5986
1       2006-02-03
 
5987
3       2006-01-25
 
5988
4       2006-02-05
 
5989
select * from t5 order by colint;
 
5990
colint  col1
 
5991
1       2006-02-03
 
5992
3       2006-01-25
 
5993
4       2006-02-05
 
5994
insert into t1 values ('2006-01-17');
 
5995
insert into t2 values ('2006-01-17');
 
5996
insert into t3 values ('2006-01-17');
 
5997
insert into t4 values (60,'2006-01-17');
 
5998
insert into t5 values (60,'2006-01-17');
 
5999
insert into t6 values (60,'2006-01-17');
 
6000
select * from t1 order by col1;
 
6001
col1
 
6002
2006-01-17
 
6003
2006-02-05
 
6004
select * from t2 order by col1;
 
6005
col1
 
6006
2006-01-17
 
6007
2006-02-05
 
6008
2006-02-25
 
6009
select * from t3 order by col1;
 
6010
col1
 
6011
2006-01-17
 
6012
2006-02-05
 
6013
2006-02-25
 
6014
select * from t4 order by colint;
 
6015
colint  col1
 
6016
1       2006-02-03
 
6017
3       2006-01-25
 
6018
4       2006-02-05
 
6019
60      2006-01-17
 
6020
select * from t5 order by colint;
 
6021
colint  col1
 
6022
1       2006-02-03
 
6023
3       2006-01-25
 
6024
4       2006-02-05
 
6025
60      2006-01-17
 
6026
select * from t6 order by colint;
 
6027
colint  col1
 
6028
1       2006-02-03
 
6029
3       2006-01-25
 
6030
4       2006-02-05
 
6031
60      2006-01-17
 
6032
alter table t1 drop partition p0;
 
6033
alter table t2 drop partition p0;
 
6034
alter table t4 drop partition p0;
 
6035
alter table t5 drop partition p0;
 
6036
alter table t6 drop partition p0;
 
6037
select * from t1 order by col1;
 
6038
col1
 
6039
2006-01-17
 
6040
2006-02-05
 
6041
select * from t2 order by col1;
 
6042
col1
 
6043
2006-01-17
 
6044
2006-02-05
 
6045
2006-02-25
 
6046
select * from t3 order by col1;
 
6047
col1
 
6048
2006-01-17
 
6049
2006-02-05
 
6050
2006-02-25
 
6051
select * from t4 order by colint;
 
6052
colint  col1
 
6053
60      2006-01-17
 
6054
select * from t5 order by colint;
 
6055
colint  col1
 
6056
60      2006-01-17
 
6057
select * from t6 order by colint;
 
6058
colint  col1
 
6059
-------------------------------------------------------------------------
 
6060
---  Delete rows and partitions of tables with dayofyear(col1)
 
6061
-------------------------------------------------------------------------
 
6062
delete from t11 where col1='2006-01-17';
 
6063
delete from t22 where col1='2006-01-17';
 
6064
delete from t33 where col1='2006-01-17';
 
6065
delete from t44 where col1='2006-01-17';
 
6066
delete from t55 where col1='2006-01-17';
 
6067
delete from t66 where col1='2006-01-17';
 
6068
select * from t11 order by col1;
 
6069
col1
 
6070
2006-02-05
 
6071
select * from t22 order by col1;
 
6072
col1
 
6073
2006-02-05
 
6074
2006-02-25
 
6075
select * from t33 order by col1;
 
6076
col1
 
6077
2006-02-05
 
6078
2006-02-25
 
6079
select * from t44 order by colint;
 
6080
colint  col1
 
6081
1       2006-02-03
 
6082
3       2006-01-25
 
6083
4       2006-02-05
 
6084
select * from t55 order by colint;
 
6085
colint  col1
 
6086
1       2006-02-03
 
6087
3       2006-01-25
 
6088
4       2006-02-05
 
6089
insert into t11 values ('2006-01-17');
 
6090
insert into t22 values ('2006-01-17');
 
6091
insert into t33 values ('2006-01-17');
 
6092
insert into t44 values (60,'2006-01-17');
 
6093
insert into t55 values (60,'2006-01-17');
 
6094
insert into t66 values (60,'2006-01-17');
 
6095
select * from t11 order by col1;
 
6096
col1
 
6097
2006-01-17
 
6098
2006-02-05
 
6099
select * from t22 order by col1;
 
6100
col1
 
6101
2006-01-17
 
6102
2006-02-05
 
6103
2006-02-25
 
6104
select * from t33 order by col1;
 
6105
col1
 
6106
2006-01-17
 
6107
2006-02-05
 
6108
2006-02-25
 
6109
select * from t44 order by colint;
 
6110
colint  col1
 
6111
1       2006-02-03
 
6112
3       2006-01-25
 
6113
4       2006-02-05
 
6114
60      2006-01-17
 
6115
select * from t55 order by colint;
 
6116
colint  col1
 
6117
1       2006-02-03
 
6118
3       2006-01-25
 
6119
4       2006-02-05
 
6120
60      2006-01-17
 
6121
select * from t66 order by colint;
 
6122
colint  col1
 
6123
1       2006-02-03
 
6124
3       2006-01-25
 
6125
4       2006-02-05
 
6126
60      2006-01-17
 
6127
alter table t11 drop partition p0;
 
6128
alter table t22 drop partition p0;
 
6129
alter table t44 drop partition p0;
 
6130
alter table t55 drop partition p0;
 
6131
alter table t66 drop partition p0;
 
6132
select * from t11 order by col1;
 
6133
col1
 
6134
2006-01-17
 
6135
2006-02-05
 
6136
select * from t22 order by col1;
 
6137
col1
 
6138
2006-01-17
 
6139
2006-02-05
 
6140
2006-02-25
 
6141
select * from t33 order by col1;
 
6142
col1
 
6143
2006-01-17
 
6144
2006-02-05
 
6145
2006-02-25
 
6146
select * from t44 order by colint;
 
6147
colint  col1
 
6148
60      2006-01-17
 
6149
select * from t55 order by colint;
 
6150
colint  col1
 
6151
60      2006-01-17
 
6152
select * from t66 order by colint;
 
6153
colint  col1
 
6154
-------------------------
 
6155
---- some alter table end
 
6156
-------------------------
 
6157
drop table if exists t1 ;
 
6158
drop table if exists t2 ;
 
6159
drop table if exists t3 ;
 
6160
drop table if exists t4 ;
 
6161
drop table if exists t5 ;
 
6162
drop table if exists t6 ;
 
6163
drop table if exists t11 ;
 
6164
drop table if exists t22 ;
 
6165
drop table if exists t33 ;
 
6166
drop table if exists t44 ;
 
6167
drop table if exists t55 ;
 
6168
drop table if exists t66 ;
 
6169
-------------------------------------------------------------------------
 
6170
---  dayofyear(col1)  in partition with coltype  char(30)
 
6171
-------------------------------------------------------------------------
 
6172
drop table if exists t1 ;
 
6173
drop table if exists t2 ;
 
6174
drop table if exists t3 ;
 
6175
drop table if exists t4 ;
 
6176
drop table if exists t5 ;
 
6177
drop table if exists t6 ;
 
6178
-------------------------------------------------------------------------
 
6179
---  Create tables with dayofyear(col1)
 
6180
-------------------------------------------------------------------------
 
6181
create table t1 (col1 char(30)) engine='NDB' 
 
6182
partition by range(dayofyear(col1)) 
 
6183
(partition p0 values less than (15),
 
6184
partition p1 values less than maxvalue);
 
6185
create table t2 (col1 char(30)) engine='NDB' 
 
6186
partition by list(dayofyear(col1)) 
 
6187
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
6188
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
6189
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
6190
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
6191
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
6192
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
6193
);
 
6194
create table t3 (col1 char(30)) engine='NDB' 
 
6195
partition by hash(dayofyear(col1));
 
6196
create table t4 (colint int, col1 char(30)) engine='NDB' 
 
6197
partition by range(colint) 
 
6198
subpartition by hash(dayofyear(col1)) subpartitions 2 
 
6199
(partition p0 values less than (15),
 
6200
partition p1 values less than maxvalue);
 
6201
create table t5 (colint int, col1 char(30)) engine='NDB' 
 
6202
partition by list(colint)
 
6203
subpartition by hash(dayofyear(col1)) subpartitions 2 
 
6204
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
6205
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
6206
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
6207
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
6208
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
6209
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
6210
);
 
6211
create table t6 (colint int, col1 char(30)) engine='NDB' 
 
6212
partition by range(colint) 
 
6213
(partition p0 values less than (dayofyear('2006-12-25')),
 
6214
partition p1 values less than maxvalue);
 
6215
-------------------------------------------------------------------------
 
6216
---  Access tables with dayofyear(col1) 
 
6217
-------------------------------------------------------------------------
 
6218
insert into t1 values ('2006-01-03');
 
6219
insert into t1 values ('2006-01-17');
 
6220
insert into t2 values ('2006-01-03');
 
6221
insert into t2 values ('2006-01-17');
 
6222
insert into t2 values ('2006-02-25');
 
6223
insert into t3 values ('2006-01-03');
 
6224
insert into t3 values ('2006-01-17');
 
6225
insert into t3 values ('2006-02-25');
 
6226
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
 
6227
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
 
6228
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
 
6229
select dayofyear(col1) from t1 order by col1;
 
6230
dayofyear(col1)
 
6231
3
 
6232
17
 
6233
select * from t1 order by col1;
 
6234
col1
 
6235
2006-01-03
 
6236
2006-01-17
 
6237
select * from t2 order by col1;
 
6238
col1
 
6239
2006-01-03
 
6240
2006-01-17
 
6241
2006-02-25
 
6242
select * from t3 order by col1;
 
6243
col1
 
6244
2006-01-03
 
6245
2006-01-17
 
6246
2006-02-25
 
6247
select * from t4 order by colint;
 
6248
colint  col1
 
6249
1       2006-02-03
 
6250
2       2006-01-17
 
6251
3       2006-01-25
 
6252
4       2006-02-05
 
6253
select * from t5 order by colint;
 
6254
colint  col1
 
6255
1       2006-02-03
 
6256
2       2006-01-17
 
6257
3       2006-01-25
 
6258
4       2006-02-05
 
6259
select * from t6 order by colint;
 
6260
colint  col1
 
6261
1       2006-02-03
 
6262
2       2006-01-17
 
6263
3       2006-01-25
 
6264
4       2006-02-05
 
6265
update t1 set col1='2006-02-05' where col1='2006-01-03';
 
6266
update t2 set col1='2006-02-05' where col1='2006-01-03';
 
6267
update t3 set col1='2006-02-05' where col1='2006-01-03';
 
6268
update t4 set col1='2006-02-05' where col1='2006-01-03';
 
6269
update t5 set col1='2006-02-05' where col1='2006-01-03';
 
6270
update t6 set col1='2006-02-05' where col1='2006-01-03';
 
6271
select * from t1 order by col1;
 
6272
col1
 
6273
2006-01-17
 
6274
2006-02-05
 
6275
select * from t2 order by col1;
 
6276
col1
 
6277
2006-01-17
 
6278
2006-02-05
 
6279
2006-02-25
 
6280
select * from t3 order by col1;
 
6281
col1
 
6282
2006-01-17
 
6283
2006-02-05
 
6284
2006-02-25
 
6285
select * from t4 order by colint;
 
6286
colint  col1
 
6287
1       2006-02-03
 
6288
2       2006-01-17
 
6289
3       2006-01-25
 
6290
4       2006-02-05
 
6291
select * from t5 order by colint;
 
6292
colint  col1
 
6293
1       2006-02-03
 
6294
2       2006-01-17
 
6295
3       2006-01-25
 
6296
4       2006-02-05
 
6297
select * from t6 order by colint;
 
6298
colint  col1
 
6299
1       2006-02-03
 
6300
2       2006-01-17
 
6301
3       2006-01-25
 
6302
4       2006-02-05
 
6303
-------------------------------------------------------------------------
 
6304
---  Alter tables with dayofyear(col1)
 
6305
-------------------------------------------------------------------------
 
6306
drop table if exists t11 ;
 
6307
drop table if exists t22 ;
 
6308
drop table if exists t33 ;
 
6309
drop table if exists t44 ;
 
6310
drop table if exists t55 ;
 
6311
drop table if exists t66 ;
 
6312
create table t11 engine='NDB' as select * from t1;
 
6313
create table t22 engine='NDB' as select * from t2;
 
6314
create table t33 engine='NDB' as select * from t3;
 
6315
create table t44 engine='NDB' as select * from t4;
 
6316
create table t55 engine='NDB' as select * from t5;
 
6317
create table t66 engine='NDB' as select * from t6;
 
6318
alter table t11
 
6319
partition by range(dayofyear(col1)) 
 
6320
(partition p0 values less than (15),
 
6321
partition p1 values less than maxvalue);
 
6322
alter table t22
 
6323
partition by list(dayofyear(col1)) 
 
6324
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
6325
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
6326
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
6327
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
6328
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
6329
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
6330
);
 
6331
alter table t33
 
6332
partition by hash(dayofyear(col1));
 
6333
alter table t44
 
6334
partition by range(colint) 
 
6335
subpartition by hash(dayofyear(col1)) subpartitions 2 
 
6336
(partition p0 values less than (15),
 
6337
partition p1 values less than maxvalue);
 
6338
alter table t55
 
6339
partition by list(colint)
 
6340
subpartition by hash(dayofyear(col1)) subpartitions 2 
 
6341
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
6342
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
6343
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
6344
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
6345
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
6346
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
6347
);
 
6348
alter table t66
 
6349
partition by range(colint) 
 
6350
(partition p0 values less than (dayofyear('2006-12-25')),
 
6351
partition p1 values less than maxvalue);
 
6352
select * from t11 order by col1;
 
6353
col1
 
6354
2006-01-17
 
6355
2006-02-05
 
6356
select * from t22 order by col1;
 
6357
col1
 
6358
2006-01-17
 
6359
2006-02-05
 
6360
2006-02-25
 
6361
select * from t33 order by col1;
 
6362
col1
 
6363
2006-01-17
 
6364
2006-02-05
 
6365
2006-02-25
 
6366
select * from t44 order by colint;
 
6367
colint  col1
 
6368
1       2006-02-03
 
6369
2       2006-01-17
 
6370
3       2006-01-25
 
6371
4       2006-02-05
 
6372
select * from t55 order by colint;
 
6373
colint  col1
 
6374
1       2006-02-03
 
6375
2       2006-01-17
 
6376
3       2006-01-25
 
6377
4       2006-02-05
 
6378
select * from t66 order by colint;
 
6379
colint  col1
 
6380
1       2006-02-03
 
6381
2       2006-01-17
 
6382
3       2006-01-25
 
6383
4       2006-02-05
 
6384
---------------------------
 
6385
---- some alter table begin
 
6386
---------------------------
 
6387
alter table t11
 
6388
reorganize partition p0,p1 into
 
6389
(partition s1 values less than maxvalue);
 
6390
select * from t11 order by col1;
 
6391
col1
 
6392
2006-01-17
 
6393
2006-02-05
 
6394
alter table t11
 
6395
reorganize partition s1 into
 
6396
(partition p0 values less than (15),
 
6397
partition p1 values less than maxvalue);
 
6398
select * from t11 order by col1;
 
6399
col1
 
6400
2006-01-17
 
6401
2006-02-05
 
6402
alter table t55
 
6403
partition by list(colint)
 
6404
subpartition by hash(dayofyear(col1)) subpartitions 5 
 
6405
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
6406
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
6407
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
6408
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
6409
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
6410
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
6411
);
 
6412
show create table t55;
 
6413
Table   Create Table
 
6414
t55     CREATE TABLE `t55` (
 
6415
  `colint` int(11) DEFAULT NULL,
 
6416
  `col1` char(30) DEFAULT NULL
 
6417
) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (dayofyear(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
 
6418
select * from t55 order by colint;
 
6419
colint  col1
 
6420
1       2006-02-03
 
6421
2       2006-01-17
 
6422
3       2006-01-25
 
6423
4       2006-02-05
 
6424
alter table t66
 
6425
reorganize partition p0,p1 into
 
6426
(partition s1 values less than maxvalue);
 
6427
select * from t66 order by colint;
 
6428
colint  col1
 
6429
1       2006-02-03
 
6430
2       2006-01-17
 
6431
3       2006-01-25
 
6432
4       2006-02-05
 
6433
alter table t66
 
6434
reorganize partition s1 into
 
6435
(partition p0 values less than (dayofyear('2006-12-25')),
 
6436
partition p1 values less than maxvalue);
 
6437
select * from t66 order by colint;
 
6438
colint  col1
 
6439
1       2006-02-03
 
6440
2       2006-01-17
 
6441
3       2006-01-25
 
6442
4       2006-02-05
 
6443
alter table t66
 
6444
reorganize partition p0,p1 into
 
6445
(partition s1 values less than maxvalue);
 
6446
select * from t66 order by colint;
 
6447
colint  col1
 
6448
1       2006-02-03
 
6449
2       2006-01-17
 
6450
3       2006-01-25
 
6451
4       2006-02-05
 
6452
alter table t66
 
6453
reorganize partition s1 into
 
6454
(partition p0 values less than (dayofyear('2006-12-25')),
 
6455
partition p1 values less than maxvalue);
 
6456
select * from t66 order by colint;
 
6457
colint  col1
 
6458
1       2006-02-03
 
6459
2       2006-01-17
 
6460
3       2006-01-25
 
6461
4       2006-02-05
 
6462
-------------------------------------------------------------------------
 
6463
---  Delete rows and partitions of tables with dayofyear(col1)
 
6464
-------------------------------------------------------------------------
 
6465
delete from t1 where col1='2006-01-17';
 
6466
delete from t2 where col1='2006-01-17';
 
6467
delete from t3 where col1='2006-01-17';
 
6468
delete from t4 where col1='2006-01-17';
 
6469
delete from t5 where col1='2006-01-17';
 
6470
delete from t6 where col1='2006-01-17';
 
6471
select * from t1 order by col1;
 
6472
col1
 
6473
2006-02-05
 
6474
select * from t2 order by col1;
 
6475
col1
 
6476
2006-02-05
 
6477
2006-02-25
 
6478
select * from t3 order by col1;
 
6479
col1
 
6480
2006-02-05
 
6481
2006-02-25
 
6482
select * from t4 order by colint;
 
6483
colint  col1
 
6484
1       2006-02-03
 
6485
3       2006-01-25
 
6486
4       2006-02-05
 
6487
select * from t5 order by colint;
 
6488
colint  col1
 
6489
1       2006-02-03
 
6490
3       2006-01-25
 
6491
4       2006-02-05
 
6492
insert into t1 values ('2006-01-17');
 
6493
insert into t2 values ('2006-01-17');
 
6494
insert into t3 values ('2006-01-17');
 
6495
insert into t4 values (60,'2006-01-17');
 
6496
insert into t5 values (60,'2006-01-17');
 
6497
insert into t6 values (60,'2006-01-17');
 
6498
select * from t1 order by col1;
 
6499
col1
 
6500
2006-01-17
 
6501
2006-02-05
 
6502
select * from t2 order by col1;
 
6503
col1
 
6504
2006-01-17
 
6505
2006-02-05
 
6506
2006-02-25
 
6507
select * from t3 order by col1;
 
6508
col1
 
6509
2006-01-17
 
6510
2006-02-05
 
6511
2006-02-25
 
6512
select * from t4 order by colint;
 
6513
colint  col1
 
6514
1       2006-02-03
 
6515
3       2006-01-25
 
6516
4       2006-02-05
 
6517
60      2006-01-17
 
6518
select * from t5 order by colint;
 
6519
colint  col1
 
6520
1       2006-02-03
 
6521
3       2006-01-25
 
6522
4       2006-02-05
 
6523
60      2006-01-17
 
6524
select * from t6 order by colint;
 
6525
colint  col1
 
6526
1       2006-02-03
 
6527
3       2006-01-25
 
6528
4       2006-02-05
 
6529
60      2006-01-17
 
6530
alter table t1 drop partition p0;
 
6531
alter table t2 drop partition p0;
 
6532
alter table t4 drop partition p0;
 
6533
alter table t5 drop partition p0;
 
6534
alter table t6 drop partition p0;
 
6535
select * from t1 order by col1;
 
6536
col1
 
6537
2006-01-17
 
6538
2006-02-05
 
6539
select * from t2 order by col1;
 
6540
col1
 
6541
2006-01-17
 
6542
2006-02-05
 
6543
2006-02-25
 
6544
select * from t3 order by col1;
 
6545
col1
 
6546
2006-01-17
 
6547
2006-02-05
 
6548
2006-02-25
 
6549
select * from t4 order by colint;
 
6550
colint  col1
 
6551
60      2006-01-17
 
6552
select * from t5 order by colint;
 
6553
colint  col1
 
6554
60      2006-01-17
 
6555
select * from t6 order by colint;
 
6556
colint  col1
 
6557
-------------------------------------------------------------------------
 
6558
---  Delete rows and partitions of tables with dayofyear(col1)
 
6559
-------------------------------------------------------------------------
 
6560
delete from t11 where col1='2006-01-17';
 
6561
delete from t22 where col1='2006-01-17';
 
6562
delete from t33 where col1='2006-01-17';
 
6563
delete from t44 where col1='2006-01-17';
 
6564
delete from t55 where col1='2006-01-17';
 
6565
delete from t66 where col1='2006-01-17';
 
6566
select * from t11 order by col1;
 
6567
col1
 
6568
2006-02-05
 
6569
select * from t22 order by col1;
 
6570
col1
 
6571
2006-02-05
 
6572
2006-02-25
 
6573
select * from t33 order by col1;
 
6574
col1
 
6575
2006-02-05
 
6576
2006-02-25
 
6577
select * from t44 order by colint;
 
6578
colint  col1
 
6579
1       2006-02-03
 
6580
3       2006-01-25
 
6581
4       2006-02-05
 
6582
select * from t55 order by colint;
 
6583
colint  col1
 
6584
1       2006-02-03
 
6585
3       2006-01-25
 
6586
4       2006-02-05
 
6587
insert into t11 values ('2006-01-17');
 
6588
insert into t22 values ('2006-01-17');
 
6589
insert into t33 values ('2006-01-17');
 
6590
insert into t44 values (60,'2006-01-17');
 
6591
insert into t55 values (60,'2006-01-17');
 
6592
insert into t66 values (60,'2006-01-17');
 
6593
select * from t11 order by col1;
 
6594
col1
 
6595
2006-01-17
 
6596
2006-02-05
 
6597
select * from t22 order by col1;
 
6598
col1
 
6599
2006-01-17
 
6600
2006-02-05
 
6601
2006-02-25
 
6602
select * from t33 order by col1;
 
6603
col1
 
6604
2006-01-17
 
6605
2006-02-05
 
6606
2006-02-25
 
6607
select * from t44 order by colint;
 
6608
colint  col1
 
6609
1       2006-02-03
 
6610
3       2006-01-25
 
6611
4       2006-02-05
 
6612
60      2006-01-17
 
6613
select * from t55 order by colint;
 
6614
colint  col1
 
6615
1       2006-02-03
 
6616
3       2006-01-25
 
6617
4       2006-02-05
 
6618
60      2006-01-17
 
6619
select * from t66 order by colint;
 
6620
colint  col1
 
6621
1       2006-02-03
 
6622
3       2006-01-25
 
6623
4       2006-02-05
 
6624
60      2006-01-17
 
6625
alter table t11 drop partition p0;
 
6626
alter table t22 drop partition p0;
 
6627
alter table t44 drop partition p0;
 
6628
alter table t55 drop partition p0;
 
6629
alter table t66 drop partition p0;
 
6630
select * from t11 order by col1;
 
6631
col1
 
6632
2006-01-17
 
6633
2006-02-05
 
6634
select * from t22 order by col1;
 
6635
col1
 
6636
2006-01-17
 
6637
2006-02-05
 
6638
2006-02-25
 
6639
select * from t33 order by col1;
 
6640
col1
 
6641
2006-01-17
 
6642
2006-02-05
 
6643
2006-02-25
 
6644
select * from t44 order by colint;
 
6645
colint  col1
 
6646
60      2006-01-17
 
6647
select * from t55 order by colint;
 
6648
colint  col1
 
6649
60      2006-01-17
 
6650
select * from t66 order by colint;
 
6651
colint  col1
 
6652
-------------------------
 
6653
---- some alter table end
 
6654
-------------------------
 
6655
drop table if exists t1 ;
 
6656
drop table if exists t2 ;
 
6657
drop table if exists t3 ;
 
6658
drop table if exists t4 ;
 
6659
drop table if exists t5 ;
 
6660
drop table if exists t6 ;
 
6661
drop table if exists t11 ;
 
6662
drop table if exists t22 ;
 
6663
drop table if exists t33 ;
 
6664
drop table if exists t44 ;
 
6665
drop table if exists t55 ;
 
6666
drop table if exists t66 ;
 
6667
-------------------------------------------------------------------------
 
6668
---  extract(month from col1)  in partition with coltype  date
 
6669
-------------------------------------------------------------------------
 
6670
drop table if exists t1 ;
 
6671
drop table if exists t2 ;
 
6672
drop table if exists t3 ;
 
6673
drop table if exists t4 ;
 
6674
drop table if exists t5 ;
 
6675
drop table if exists t6 ;
 
6676
-------------------------------------------------------------------------
 
6677
---  Create tables with extract(month from col1)
 
6678
-------------------------------------------------------------------------
 
6679
create table t1 (col1 date) engine='NDB' 
 
6680
partition by range(extract(month from col1)) 
 
6681
(partition p0 values less than (15),
 
6682
partition p1 values less than maxvalue);
 
6683
create table t2 (col1 date) engine='NDB' 
 
6684
partition by list(extract(month from col1)) 
 
6685
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
6686
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
6687
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
6688
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
6689
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
6690
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
6691
);
 
6692
create table t3 (col1 date) engine='NDB' 
 
6693
partition by hash(extract(month from col1));
 
6694
create table t4 (colint int, col1 date) engine='NDB' 
 
6695
partition by range(colint) 
 
6696
subpartition by hash(extract(month from col1)) subpartitions 2 
 
6697
(partition p0 values less than (15),
 
6698
partition p1 values less than maxvalue);
 
6699
create table t5 (colint int, col1 date) engine='NDB' 
 
6700
partition by list(colint)
 
6701
subpartition by hash(extract(month from col1)) subpartitions 2 
 
6702
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
6703
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
6704
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
6705
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
6706
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
6707
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
6708
);
 
6709
create table t6 (colint int, col1 date) engine='NDB' 
 
6710
partition by range(colint) 
 
6711
(partition p0 values less than (extract(year from '1998-11-23')),
 
6712
partition p1 values less than maxvalue);
 
6713
-------------------------------------------------------------------------
 
6714
---  Access tables with extract(month from col1) 
 
6715
-------------------------------------------------------------------------
 
6716
insert into t1 values ('2006-01-03');
 
6717
insert into t1 values ('2006-02-17');
 
6718
insert into t2 values ('2006-01-03');
 
6719
insert into t2 values ('2006-02-17');
 
6720
insert into t2 values ('2006-01-25');
 
6721
insert into t3 values ('2006-01-03');
 
6722
insert into t3 values ('2006-02-17');
 
6723
insert into t3 values ('2006-01-25');
 
6724
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
 
6725
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
 
6726
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
 
6727
select extract(month from col1) from t1 order by col1;
 
6728
extract(month from col1)
 
6729
1
 
6730
2
 
6731
select * from t1 order by col1;
 
6732
col1
 
6733
2006-01-03
 
6734
2006-02-17
 
6735
select * from t2 order by col1;
 
6736
col1
 
6737
2006-01-03
 
6738
2006-01-25
 
6739
2006-02-17
 
6740
select * from t3 order by col1;
 
6741
col1
 
6742
2006-01-03
 
6743
2006-01-25
 
6744
2006-02-17
 
6745
select * from t4 order by colint;
 
6746
colint  col1
 
6747
1       2006-02-03
 
6748
2       2006-01-17
 
6749
3       2006-01-25
 
6750
4       2006-02-05
 
6751
select * from t5 order by colint;
 
6752
colint  col1
 
6753
1       2006-02-03
 
6754
2       2006-01-17
 
6755
3       2006-01-25
 
6756
4       2006-02-05
 
6757
select * from t6 order by colint;
 
6758
colint  col1
 
6759
1       2006-02-03
 
6760
2       2006-01-17
 
6761
3       2006-01-25
 
6762
4       2006-02-05
 
6763
update t1 set col1='2006-02-05' where col1='2006-01-03';
 
6764
update t2 set col1='2006-02-05' where col1='2006-01-03';
 
6765
update t3 set col1='2006-02-05' where col1='2006-01-03';
 
6766
update t4 set col1='2006-02-05' where col1='2006-01-03';
 
6767
update t5 set col1='2006-02-05' where col1='2006-01-03';
 
6768
update t6 set col1='2006-02-05' where col1='2006-01-03';
 
6769
select * from t1 order by col1;
 
6770
col1
 
6771
2006-02-05
 
6772
2006-02-17
 
6773
select * from t2 order by col1;
 
6774
col1
 
6775
2006-01-25
 
6776
2006-02-05
 
6777
2006-02-17
 
6778
select * from t3 order by col1;
 
6779
col1
 
6780
2006-01-25
 
6781
2006-02-05
 
6782
2006-02-17
 
6783
select * from t4 order by colint;
 
6784
colint  col1
 
6785
1       2006-02-03
 
6786
2       2006-01-17
 
6787
3       2006-01-25
 
6788
4       2006-02-05
 
6789
select * from t5 order by colint;
 
6790
colint  col1
 
6791
1       2006-02-03
 
6792
2       2006-01-17
 
6793
3       2006-01-25
 
6794
4       2006-02-05
 
6795
select * from t6 order by colint;
 
6796
colint  col1
 
6797
1       2006-02-03
 
6798
2       2006-01-17
 
6799
3       2006-01-25
 
6800
4       2006-02-05
 
6801
-------------------------------------------------------------------------
 
6802
---  Alter tables with extract(month from col1)
 
6803
-------------------------------------------------------------------------
 
6804
drop table if exists t11 ;
 
6805
drop table if exists t22 ;
 
6806
drop table if exists t33 ;
 
6807
drop table if exists t44 ;
 
6808
drop table if exists t55 ;
 
6809
drop table if exists t66 ;
 
6810
create table t11 engine='NDB' as select * from t1;
 
6811
create table t22 engine='NDB' as select * from t2;
 
6812
create table t33 engine='NDB' as select * from t3;
 
6813
create table t44 engine='NDB' as select * from t4;
 
6814
create table t55 engine='NDB' as select * from t5;
 
6815
create table t66 engine='NDB' as select * from t6;
 
6816
alter table t11
 
6817
partition by range(extract(month from col1)) 
 
6818
(partition p0 values less than (15),
 
6819
partition p1 values less than maxvalue);
 
6820
alter table t22
 
6821
partition by list(extract(month from col1)) 
 
6822
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
6823
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
6824
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
6825
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
6826
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
6827
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
6828
);
 
6829
alter table t33
 
6830
partition by hash(extract(month from col1));
 
6831
alter table t44
 
6832
partition by range(colint) 
 
6833
subpartition by hash(extract(month from col1)) subpartitions 2 
 
6834
(partition p0 values less than (15),
 
6835
partition p1 values less than maxvalue);
 
6836
alter table t55
 
6837
partition by list(colint)
 
6838
subpartition by hash(extract(month from col1)) subpartitions 2 
 
6839
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
6840
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
6841
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
6842
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
6843
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
6844
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
6845
);
 
6846
alter table t66
 
6847
partition by range(colint) 
 
6848
(partition p0 values less than (extract(year from '1998-11-23')),
 
6849
partition p1 values less than maxvalue);
 
6850
select * from t11 order by col1;
 
6851
col1
 
6852
2006-02-05
 
6853
2006-02-17
 
6854
select * from t22 order by col1;
 
6855
col1
 
6856
2006-01-25
 
6857
2006-02-05
 
6858
2006-02-17
 
6859
select * from t33 order by col1;
 
6860
col1
 
6861
2006-01-25
 
6862
2006-02-05
 
6863
2006-02-17
 
6864
select * from t44 order by colint;
 
6865
colint  col1
 
6866
1       2006-02-03
 
6867
2       2006-01-17
 
6868
3       2006-01-25
 
6869
4       2006-02-05
 
6870
select * from t55 order by colint;
 
6871
colint  col1
 
6872
1       2006-02-03
 
6873
2       2006-01-17
 
6874
3       2006-01-25
 
6875
4       2006-02-05
 
6876
select * from t66 order by colint;
 
6877
colint  col1
 
6878
1       2006-02-03
 
6879
2       2006-01-17
 
6880
3       2006-01-25
 
6881
4       2006-02-05
 
6882
---------------------------
 
6883
---- some alter table begin
 
6884
---------------------------
 
6885
alter table t11
 
6886
reorganize partition p0,p1 into
 
6887
(partition s1 values less than maxvalue);
 
6888
select * from t11 order by col1;
 
6889
col1
 
6890
2006-02-05
 
6891
2006-02-17
 
6892
alter table t11
 
6893
reorganize partition s1 into
 
6894
(partition p0 values less than (15),
 
6895
partition p1 values less than maxvalue);
 
6896
select * from t11 order by col1;
 
6897
col1
 
6898
2006-02-05
 
6899
2006-02-17
 
6900
alter table t55
 
6901
partition by list(colint)
 
6902
subpartition by hash(extract(month from col1)) subpartitions 5 
 
6903
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
6904
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
6905
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
6906
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
6907
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
6908
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
6909
);
 
6910
show create table t55;
 
6911
Table   Create Table
 
6912
t55     CREATE TABLE `t55` (
 
6913
  `colint` int(11) DEFAULT NULL,
 
6914
  `col1` date DEFAULT NULL
 
6915
) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (extract(month from col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
 
6916
select * from t55 order by colint;
 
6917
colint  col1
 
6918
1       2006-02-03
 
6919
2       2006-01-17
 
6920
3       2006-01-25
 
6921
4       2006-02-05
 
6922
alter table t66
 
6923
reorganize partition p0,p1 into
 
6924
(partition s1 values less than maxvalue);
 
6925
select * from t66 order by colint;
 
6926
colint  col1
 
6927
1       2006-02-03
 
6928
2       2006-01-17
 
6929
3       2006-01-25
 
6930
4       2006-02-05
 
6931
alter table t66
 
6932
reorganize partition s1 into
 
6933
(partition p0 values less than (extract(year from '1998-11-23')),
 
6934
partition p1 values less than maxvalue);
 
6935
select * from t66 order by colint;
 
6936
colint  col1
 
6937
1       2006-02-03
 
6938
2       2006-01-17
 
6939
3       2006-01-25
 
6940
4       2006-02-05
 
6941
alter table t66
 
6942
reorganize partition p0,p1 into
 
6943
(partition s1 values less than maxvalue);
 
6944
select * from t66 order by colint;
 
6945
colint  col1
 
6946
1       2006-02-03
 
6947
2       2006-01-17
 
6948
3       2006-01-25
 
6949
4       2006-02-05
 
6950
alter table t66
 
6951
reorganize partition s1 into
 
6952
(partition p0 values less than (extract(year from '1998-11-23')),
 
6953
partition p1 values less than maxvalue);
 
6954
select * from t66 order by colint;
 
6955
colint  col1
 
6956
1       2006-02-03
 
6957
2       2006-01-17
 
6958
3       2006-01-25
 
6959
4       2006-02-05
 
6960
-------------------------------------------------------------------------
 
6961
---  Delete rows and partitions of tables with extract(month from col1)
 
6962
-------------------------------------------------------------------------
 
6963
delete from t1 where col1='2006-02-17';
 
6964
delete from t2 where col1='2006-02-17';
 
6965
delete from t3 where col1='2006-02-17';
 
6966
delete from t4 where col1='2006-02-17';
 
6967
delete from t5 where col1='2006-02-17';
 
6968
delete from t6 where col1='2006-02-17';
 
6969
select * from t1 order by col1;
 
6970
col1
 
6971
2006-02-05
 
6972
select * from t2 order by col1;
 
6973
col1
 
6974
2006-01-25
 
6975
2006-02-05
 
6976
select * from t3 order by col1;
 
6977
col1
 
6978
2006-01-25
 
6979
2006-02-05
 
6980
select * from t4 order by colint;
 
6981
colint  col1
 
6982
1       2006-02-03
 
6983
2       2006-01-17
 
6984
3       2006-01-25
 
6985
4       2006-02-05
 
6986
select * from t5 order by colint;
 
6987
colint  col1
 
6988
1       2006-02-03
 
6989
2       2006-01-17
 
6990
3       2006-01-25
 
6991
4       2006-02-05
 
6992
insert into t1 values ('2006-02-17');
 
6993
insert into t2 values ('2006-02-17');
 
6994
insert into t3 values ('2006-02-17');
 
6995
insert into t4 values (60,'2006-02-17');
 
6996
insert into t5 values (60,'2006-02-17');
 
6997
insert into t6 values (60,'2006-02-17');
 
6998
select * from t1 order by col1;
 
6999
col1
 
7000
2006-02-05
 
7001
2006-02-17
 
7002
select * from t2 order by col1;
 
7003
col1
 
7004
2006-01-25
 
7005
2006-02-05
 
7006
2006-02-17
 
7007
select * from t3 order by col1;
 
7008
col1
 
7009
2006-01-25
 
7010
2006-02-05
 
7011
2006-02-17
 
7012
select * from t4 order by colint;
 
7013
colint  col1
 
7014
1       2006-02-03
 
7015
2       2006-01-17
 
7016
3       2006-01-25
 
7017
4       2006-02-05
 
7018
60      2006-02-17
 
7019
select * from t5 order by colint;
 
7020
colint  col1
 
7021
1       2006-02-03
 
7022
2       2006-01-17
 
7023
3       2006-01-25
 
7024
4       2006-02-05
 
7025
60      2006-02-17
 
7026
select * from t6 order by colint;
 
7027
colint  col1
 
7028
1       2006-02-03
 
7029
2       2006-01-17
 
7030
3       2006-01-25
 
7031
4       2006-02-05
 
7032
60      2006-02-17
 
7033
alter table t1 drop partition p0;
 
7034
alter table t2 drop partition p0;
 
7035
alter table t4 drop partition p0;
 
7036
alter table t5 drop partition p0;
 
7037
alter table t6 drop partition p0;
 
7038
select * from t1 order by col1;
 
7039
col1
 
7040
select * from t2 order by col1;
 
7041
col1
 
7042
select * from t3 order by col1;
 
7043
col1
 
7044
2006-01-25
 
7045
2006-02-05
 
7046
2006-02-17
 
7047
select * from t4 order by colint;
 
7048
colint  col1
 
7049
60      2006-02-17
 
7050
select * from t5 order by colint;
 
7051
colint  col1
 
7052
60      2006-02-17
 
7053
select * from t6 order by colint;
 
7054
colint  col1
 
7055
-------------------------------------------------------------------------
 
7056
---  Delete rows and partitions of tables with extract(month from col1)
 
7057
-------------------------------------------------------------------------
 
7058
delete from t11 where col1='2006-02-17';
 
7059
delete from t22 where col1='2006-02-17';
 
7060
delete from t33 where col1='2006-02-17';
 
7061
delete from t44 where col1='2006-02-17';
 
7062
delete from t55 where col1='2006-02-17';
 
7063
delete from t66 where col1='2006-02-17';
 
7064
select * from t11 order by col1;
 
7065
col1
 
7066
2006-02-05
 
7067
select * from t22 order by col1;
 
7068
col1
 
7069
2006-01-25
 
7070
2006-02-05
 
7071
select * from t33 order by col1;
 
7072
col1
 
7073
2006-01-25
 
7074
2006-02-05
 
7075
select * from t44 order by colint;
 
7076
colint  col1
 
7077
1       2006-02-03
 
7078
2       2006-01-17
 
7079
3       2006-01-25
 
7080
4       2006-02-05
 
7081
select * from t55 order by colint;
 
7082
colint  col1
 
7083
1       2006-02-03
 
7084
2       2006-01-17
 
7085
3       2006-01-25
 
7086
4       2006-02-05
 
7087
insert into t11 values ('2006-02-17');
 
7088
insert into t22 values ('2006-02-17');
 
7089
insert into t33 values ('2006-02-17');
 
7090
insert into t44 values (60,'2006-02-17');
 
7091
insert into t55 values (60,'2006-02-17');
 
7092
insert into t66 values (60,'2006-02-17');
 
7093
select * from t11 order by col1;
 
7094
col1
 
7095
2006-02-05
 
7096
2006-02-17
 
7097
select * from t22 order by col1;
 
7098
col1
 
7099
2006-01-25
 
7100
2006-02-05
 
7101
2006-02-17
 
7102
select * from t33 order by col1;
 
7103
col1
 
7104
2006-01-25
 
7105
2006-02-05
 
7106
2006-02-17
 
7107
select * from t44 order by colint;
 
7108
colint  col1
 
7109
1       2006-02-03
 
7110
2       2006-01-17
 
7111
3       2006-01-25
 
7112
4       2006-02-05
 
7113
60      2006-02-17
 
7114
select * from t55 order by colint;
 
7115
colint  col1
 
7116
1       2006-02-03
 
7117
2       2006-01-17
 
7118
3       2006-01-25
 
7119
4       2006-02-05
 
7120
60      2006-02-17
 
7121
select * from t66 order by colint;
 
7122
colint  col1
 
7123
1       2006-02-03
 
7124
2       2006-01-17
 
7125
3       2006-01-25
 
7126
4       2006-02-05
 
7127
60      2006-02-17
 
7128
alter table t11 drop partition p0;
 
7129
alter table t22 drop partition p0;
 
7130
alter table t44 drop partition p0;
 
7131
alter table t55 drop partition p0;
 
7132
alter table t66 drop partition p0;
 
7133
select * from t11 order by col1;
 
7134
col1
 
7135
select * from t22 order by col1;
 
7136
col1
 
7137
select * from t33 order by col1;
 
7138
col1
 
7139
2006-01-25
 
7140
2006-02-05
 
7141
2006-02-17
 
7142
select * from t44 order by colint;
 
7143
colint  col1
 
7144
60      2006-02-17
 
7145
select * from t55 order by colint;
 
7146
colint  col1
 
7147
60      2006-02-17
 
7148
select * from t66 order by colint;
 
7149
colint  col1
 
7150
-------------------------
 
7151
---- some alter table end
 
7152
-------------------------
 
7153
drop table if exists t1 ;
 
7154
drop table if exists t2 ;
 
7155
drop table if exists t3 ;
 
7156
drop table if exists t4 ;
 
7157
drop table if exists t5 ;
 
7158
drop table if exists t6 ;
 
7159
drop table if exists t11 ;
 
7160
drop table if exists t22 ;
 
7161
drop table if exists t33 ;
 
7162
drop table if exists t44 ;
 
7163
drop table if exists t55 ;
 
7164
drop table if exists t66 ;
 
7165
-------------------------------------------------------------------------
 
7166
---  hour(col1)  in partition with coltype  time
 
7167
-------------------------------------------------------------------------
 
7168
drop table if exists t1 ;
 
7169
drop table if exists t2 ;
 
7170
drop table if exists t3 ;
 
7171
drop table if exists t4 ;
 
7172
drop table if exists t5 ;
 
7173
drop table if exists t6 ;
 
7174
-------------------------------------------------------------------------
 
7175
---  Create tables with hour(col1)
 
7176
-------------------------------------------------------------------------
 
7177
create table t1 (col1 time) engine='NDB' 
 
7178
partition by range(hour(col1)) 
 
7179
(partition p0 values less than (15),
 
7180
partition p1 values less than maxvalue);
 
7181
create table t2 (col1 time) engine='NDB' 
 
7182
partition by list(hour(col1)) 
 
7183
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
7184
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
7185
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
7186
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
7187
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
7188
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
7189
);
 
7190
create table t3 (col1 time) engine='NDB' 
 
7191
partition by hash(hour(col1));
 
7192
create table t4 (colint int, col1 time) engine='NDB' 
 
7193
partition by range(colint) 
 
7194
subpartition by hash(hour(col1)) subpartitions 2 
 
7195
(partition p0 values less than (15),
 
7196
partition p1 values less than maxvalue);
 
7197
create table t5 (colint int, col1 time) engine='NDB' 
 
7198
partition by list(colint)
 
7199
subpartition by hash(hour(col1)) subpartitions 2 
 
7200
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
7201
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
7202
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
7203
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
7204
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
7205
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
7206
);
 
7207
create table t6 (colint int, col1 time) engine='NDB' 
 
7208
partition by range(colint) 
 
7209
(partition p0 values less than (hour('18:30')),
 
7210
partition p1 values less than maxvalue);
 
7211
-------------------------------------------------------------------------
 
7212
---  Access tables with hour(col1) 
 
7213
-------------------------------------------------------------------------
 
7214
insert into t1 values ('09:09');
 
7215
insert into t1 values ('14:30');
 
7216
insert into t2 values ('09:09');
 
7217
insert into t2 values ('14:30');
 
7218
insert into t2 values ('21:59');
 
7219
insert into t3 values ('09:09');
 
7220
insert into t3 values ('14:30');
 
7221
insert into t3 values ('21:59');
 
7222
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t4;
 
7223
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t5;
 
7224
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t6;
 
7225
select hour(col1) from t1 order by col1;
 
7226
hour(col1)
 
7227
9
 
7228
14
 
7229
select * from t1 order by col1;
 
7230
col1
 
7231
09:09:00
 
7232
14:30:00
 
7233
select * from t2 order by col1;
 
7234
col1
 
7235
09:09:00
 
7236
14:30:00
 
7237
21:59:00
 
7238
select * from t3 order by col1;
 
7239
col1
 
7240
09:09:00
 
7241
14:30:00
 
7242
21:59:00
 
7243
select * from t4 order by colint;
 
7244
colint  col1
 
7245
1       09:09:15
 
7246
2       04:30:01
 
7247
3       00:59:22
 
7248
4       05:30:34
 
7249
select * from t5 order by colint;
 
7250
colint  col1
 
7251
1       09:09:15
 
7252
2       04:30:01
 
7253
3       00:59:22
 
7254
4       05:30:34
 
7255
select * from t6 order by colint;
 
7256
colint  col1
 
7257
1       09:09:15
 
7258
2       04:30:01
 
7259
3       00:59:22
 
7260
4       05:30:34
 
7261
update t1 set col1='10:30' where col1='09:09';
 
7262
update t2 set col1='10:30' where col1='09:09';
 
7263
update t3 set col1='10:30' where col1='09:09';
 
7264
update t4 set col1='10:30' where col1='09:09';
 
7265
update t5 set col1='10:30' where col1='09:09';
 
7266
update t6 set col1='10:30' where col1='09:09';
 
7267
select * from t1 order by col1;
 
7268
col1
 
7269
10:30:00
 
7270
14:30:00
 
7271
select * from t2 order by col1;
 
7272
col1
 
7273
10:30:00
 
7274
14:30:00
 
7275
21:59:00
 
7276
select * from t3 order by col1;
 
7277
col1
 
7278
10:30:00
 
7279
14:30:00
 
7280
21:59:00
 
7281
select * from t4 order by colint;
 
7282
colint  col1
 
7283
1       09:09:15
 
7284
2       04:30:01
 
7285
3       00:59:22
 
7286
4       05:30:34
 
7287
select * from t5 order by colint;
 
7288
colint  col1
 
7289
1       09:09:15
 
7290
2       04:30:01
 
7291
3       00:59:22
 
7292
4       05:30:34
 
7293
select * from t6 order by colint;
 
7294
colint  col1
 
7295
1       09:09:15
 
7296
2       04:30:01
 
7297
3       00:59:22
 
7298
4       05:30:34
 
7299
-------------------------------------------------------------------------
 
7300
---  Alter tables with hour(col1)
 
7301
-------------------------------------------------------------------------
 
7302
drop table if exists t11 ;
 
7303
drop table if exists t22 ;
 
7304
drop table if exists t33 ;
 
7305
drop table if exists t44 ;
 
7306
drop table if exists t55 ;
 
7307
drop table if exists t66 ;
 
7308
create table t11 engine='NDB' as select * from t1;
 
7309
create table t22 engine='NDB' as select * from t2;
 
7310
create table t33 engine='NDB' as select * from t3;
 
7311
create table t44 engine='NDB' as select * from t4;
 
7312
create table t55 engine='NDB' as select * from t5;
 
7313
create table t66 engine='NDB' as select * from t6;
 
7314
alter table t11
 
7315
partition by range(hour(col1)) 
 
7316
(partition p0 values less than (15),
 
7317
partition p1 values less than maxvalue);
 
7318
alter table t22
 
7319
partition by list(hour(col1)) 
 
7320
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
7321
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
7322
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
7323
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
7324
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
7325
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
7326
);
 
7327
alter table t33
 
7328
partition by hash(hour(col1));
 
7329
alter table t44
 
7330
partition by range(colint) 
 
7331
subpartition by hash(hour(col1)) subpartitions 2 
 
7332
(partition p0 values less than (15),
 
7333
partition p1 values less than maxvalue);
 
7334
alter table t55
 
7335
partition by list(colint)
 
7336
subpartition by hash(hour(col1)) subpartitions 2 
 
7337
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
7338
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
7339
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
7340
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
7341
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
7342
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
7343
);
 
7344
alter table t66
 
7345
partition by range(colint) 
 
7346
(partition p0 values less than (hour('18:30')),
 
7347
partition p1 values less than maxvalue);
 
7348
select * from t11 order by col1;
 
7349
col1
 
7350
10:30:00
 
7351
14:30:00
 
7352
select * from t22 order by col1;
 
7353
col1
 
7354
10:30:00
 
7355
14:30:00
 
7356
21:59:00
 
7357
select * from t33 order by col1;
 
7358
col1
 
7359
10:30:00
 
7360
14:30:00
 
7361
21:59:00
 
7362
select * from t44 order by colint;
 
7363
colint  col1
 
7364
1       09:09:15
 
7365
2       04:30:01
 
7366
3       00:59:22
 
7367
4       05:30:34
 
7368
select * from t55 order by colint;
 
7369
colint  col1
 
7370
1       09:09:15
 
7371
2       04:30:01
 
7372
3       00:59:22
 
7373
4       05:30:34
 
7374
select * from t66 order by colint;
 
7375
colint  col1
 
7376
1       09:09:15
 
7377
2       04:30:01
 
7378
3       00:59:22
 
7379
4       05:30:34
 
7380
---------------------------
 
7381
---- some alter table begin
 
7382
---------------------------
 
7383
alter table t11
 
7384
reorganize partition p0,p1 into
 
7385
(partition s1 values less than maxvalue);
 
7386
select * from t11 order by col1;
 
7387
col1
 
7388
10:30:00
 
7389
14:30:00
 
7390
alter table t11
 
7391
reorganize partition s1 into
 
7392
(partition p0 values less than (15),
 
7393
partition p1 values less than maxvalue);
 
7394
select * from t11 order by col1;
 
7395
col1
 
7396
10:30:00
 
7397
14:30:00
 
7398
alter table t55
 
7399
partition by list(colint)
 
7400
subpartition by hash(hour(col1)) subpartitions 5 
 
7401
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
7402
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
7403
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
7404
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
7405
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
7406
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
7407
);
 
7408
show create table t55;
 
7409
Table   Create Table
 
7410
t55     CREATE TABLE `t55` (
 
7411
  `colint` int(11) DEFAULT NULL,
 
7412
  `col1` time DEFAULT NULL
 
7413
) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (hour(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
 
7414
select * from t55 order by colint;
 
7415
colint  col1
 
7416
1       09:09:15
 
7417
2       04:30:01
 
7418
3       00:59:22
 
7419
4       05:30:34
 
7420
alter table t66
 
7421
reorganize partition p0,p1 into
 
7422
(partition s1 values less than maxvalue);
 
7423
select * from t66 order by colint;
 
7424
colint  col1
 
7425
1       09:09:15
 
7426
2       04:30:01
 
7427
3       00:59:22
 
7428
4       05:30:34
 
7429
alter table t66
 
7430
reorganize partition s1 into
 
7431
(partition p0 values less than (hour('18:30')),
 
7432
partition p1 values less than maxvalue);
 
7433
select * from t66 order by colint;
 
7434
colint  col1
 
7435
1       09:09:15
 
7436
2       04:30:01
 
7437
3       00:59:22
 
7438
4       05:30:34
 
7439
alter table t66
 
7440
reorganize partition p0,p1 into
 
7441
(partition s1 values less than maxvalue);
 
7442
select * from t66 order by colint;
 
7443
colint  col1
 
7444
1       09:09:15
 
7445
2       04:30:01
 
7446
3       00:59:22
 
7447
4       05:30:34
 
7448
alter table t66
 
7449
reorganize partition s1 into
 
7450
(partition p0 values less than (hour('18:30')),
 
7451
partition p1 values less than maxvalue);
 
7452
select * from t66 order by colint;
 
7453
colint  col1
 
7454
1       09:09:15
 
7455
2       04:30:01
 
7456
3       00:59:22
 
7457
4       05:30:34
 
7458
-------------------------------------------------------------------------
 
7459
---  Delete rows and partitions of tables with hour(col1)
 
7460
-------------------------------------------------------------------------
 
7461
delete from t1 where col1='14:30';
 
7462
delete from t2 where col1='14:30';
 
7463
delete from t3 where col1='14:30';
 
7464
delete from t4 where col1='14:30';
 
7465
delete from t5 where col1='14:30';
 
7466
delete from t6 where col1='14:30';
 
7467
select * from t1 order by col1;
 
7468
col1
 
7469
10:30:00
 
7470
select * from t2 order by col1;
 
7471
col1
 
7472
10:30:00
 
7473
21:59:00
 
7474
select * from t3 order by col1;
 
7475
col1
 
7476
10:30:00
 
7477
21:59:00
 
7478
select * from t4 order by colint;
 
7479
colint  col1
 
7480
1       09:09:15
 
7481
2       04:30:01
 
7482
3       00:59:22
 
7483
4       05:30:34
 
7484
select * from t5 order by colint;
 
7485
colint  col1
 
7486
1       09:09:15
 
7487
2       04:30:01
 
7488
3       00:59:22
 
7489
4       05:30:34
 
7490
insert into t1 values ('14:30');
 
7491
insert into t2 values ('14:30');
 
7492
insert into t3 values ('14:30');
 
7493
insert into t4 values (60,'14:30');
 
7494
insert into t5 values (60,'14:30');
 
7495
insert into t6 values (60,'14:30');
 
7496
select * from t1 order by col1;
 
7497
col1
 
7498
10:30:00
 
7499
14:30:00
 
7500
select * from t2 order by col1;
 
7501
col1
 
7502
10:30:00
 
7503
14:30:00
 
7504
21:59:00
 
7505
select * from t3 order by col1;
 
7506
col1
 
7507
10:30:00
 
7508
14:30:00
 
7509
21:59:00
 
7510
select * from t4 order by colint;
 
7511
colint  col1
 
7512
1       09:09:15
 
7513
2       04:30:01
 
7514
3       00:59:22
 
7515
4       05:30:34
 
7516
60      14:30:00
 
7517
select * from t5 order by colint;
 
7518
colint  col1
 
7519
1       09:09:15
 
7520
2       04:30:01
 
7521
3       00:59:22
 
7522
4       05:30:34
 
7523
60      14:30:00
 
7524
select * from t6 order by colint;
 
7525
colint  col1
 
7526
1       09:09:15
 
7527
2       04:30:01
 
7528
3       00:59:22
 
7529
4       05:30:34
 
7530
60      14:30:00
 
7531
alter table t1 drop partition p0;
 
7532
alter table t2 drop partition p0;
 
7533
alter table t4 drop partition p0;
 
7534
alter table t5 drop partition p0;
 
7535
alter table t6 drop partition p0;
 
7536
select * from t1 order by col1;
 
7537
col1
 
7538
select * from t2 order by col1;
 
7539
col1
 
7540
14:30:00
 
7541
21:59:00
 
7542
select * from t3 order by col1;
 
7543
col1
 
7544
10:30:00
 
7545
14:30:00
 
7546
21:59:00
 
7547
select * from t4 order by colint;
 
7548
colint  col1
 
7549
60      14:30:00
 
7550
select * from t5 order by colint;
 
7551
colint  col1
 
7552
60      14:30:00
 
7553
select * from t6 order by colint;
 
7554
colint  col1
 
7555
60      14:30:00
 
7556
-------------------------------------------------------------------------
 
7557
---  Delete rows and partitions of tables with hour(col1)
 
7558
-------------------------------------------------------------------------
 
7559
delete from t11 where col1='14:30';
 
7560
delete from t22 where col1='14:30';
 
7561
delete from t33 where col1='14:30';
 
7562
delete from t44 where col1='14:30';
 
7563
delete from t55 where col1='14:30';
 
7564
delete from t66 where col1='14:30';
 
7565
select * from t11 order by col1;
 
7566
col1
 
7567
10:30:00
 
7568
select * from t22 order by col1;
 
7569
col1
 
7570
10:30:00
 
7571
21:59:00
 
7572
select * from t33 order by col1;
 
7573
col1
 
7574
10:30:00
 
7575
21:59:00
 
7576
select * from t44 order by colint;
 
7577
colint  col1
 
7578
1       09:09:15
 
7579
2       04:30:01
 
7580
3       00:59:22
 
7581
4       05:30:34
 
7582
select * from t55 order by colint;
 
7583
colint  col1
 
7584
1       09:09:15
 
7585
2       04:30:01
 
7586
3       00:59:22
 
7587
4       05:30:34
 
7588
insert into t11 values ('14:30');
 
7589
insert into t22 values ('14:30');
 
7590
insert into t33 values ('14:30');
 
7591
insert into t44 values (60,'14:30');
 
7592
insert into t55 values (60,'14:30');
 
7593
insert into t66 values (60,'14:30');
 
7594
select * from t11 order by col1;
 
7595
col1
 
7596
10:30:00
 
7597
14:30:00
 
7598
select * from t22 order by col1;
 
7599
col1
 
7600
10:30:00
 
7601
14:30:00
 
7602
21:59:00
 
7603
select * from t33 order by col1;
 
7604
col1
 
7605
10:30:00
 
7606
14:30:00
 
7607
21:59:00
 
7608
select * from t44 order by colint;
 
7609
colint  col1
 
7610
1       09:09:15
 
7611
2       04:30:01
 
7612
3       00:59:22
 
7613
4       05:30:34
 
7614
60      14:30:00
 
7615
select * from t55 order by colint;
 
7616
colint  col1
 
7617
1       09:09:15
 
7618
2       04:30:01
 
7619
3       00:59:22
 
7620
4       05:30:34
 
7621
60      14:30:00
 
7622
select * from t66 order by colint;
 
7623
colint  col1
 
7624
1       09:09:15
 
7625
2       04:30:01
 
7626
3       00:59:22
 
7627
4       05:30:34
 
7628
60      14:30:00
 
7629
alter table t11 drop partition p0;
 
7630
alter table t22 drop partition p0;
 
7631
alter table t44 drop partition p0;
 
7632
alter table t55 drop partition p0;
 
7633
alter table t66 drop partition p0;
 
7634
select * from t11 order by col1;
 
7635
col1
 
7636
select * from t22 order by col1;
 
7637
col1
 
7638
14:30:00
 
7639
21:59:00
 
7640
select * from t33 order by col1;
 
7641
col1
 
7642
10:30:00
 
7643
14:30:00
 
7644
21:59:00
 
7645
select * from t44 order by colint;
 
7646
colint  col1
 
7647
60      14:30:00
 
7648
select * from t55 order by colint;
 
7649
colint  col1
 
7650
60      14:30:00
 
7651
select * from t66 order by colint;
 
7652
colint  col1
 
7653
60      14:30:00
 
7654
-------------------------
 
7655
---- some alter table end
 
7656
-------------------------
 
7657
drop table if exists t1 ;
 
7658
drop table if exists t2 ;
 
7659
drop table if exists t3 ;
 
7660
drop table if exists t4 ;
 
7661
drop table if exists t5 ;
 
7662
drop table if exists t6 ;
 
7663
drop table if exists t11 ;
 
7664
drop table if exists t22 ;
 
7665
drop table if exists t33 ;
 
7666
drop table if exists t44 ;
 
7667
drop table if exists t55 ;
 
7668
drop table if exists t66 ;
 
7669
-------------------------------------------------------------------------
 
7670
---  microsecond(col1)  in partition with coltype  time
 
7671
-------------------------------------------------------------------------
 
7672
drop table if exists t1 ;
 
7673
drop table if exists t2 ;
 
7674
drop table if exists t3 ;
 
7675
drop table if exists t4 ;
 
7676
drop table if exists t5 ;
 
7677
drop table if exists t6 ;
 
7678
-------------------------------------------------------------------------
 
7679
---  Create tables with microsecond(col1)
 
7680
-------------------------------------------------------------------------
 
7681
create table t1 (col1 time) engine='NDB' 
 
7682
partition by range(microsecond(col1)) 
 
7683
(partition p0 values less than (15),
 
7684
partition p1 values less than maxvalue);
 
7685
create table t2 (col1 time) engine='NDB' 
 
7686
partition by list(microsecond(col1)) 
 
7687
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
7688
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
7689
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
7690
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
7691
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
7692
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
7693
);
 
7694
create table t3 (col1 time) engine='NDB' 
 
7695
partition by hash(microsecond(col1));
 
7696
create table t4 (colint int, col1 time) engine='NDB' 
 
7697
partition by range(colint) 
 
7698
subpartition by hash(microsecond(col1)) subpartitions 2 
 
7699
(partition p0 values less than (15),
 
7700
partition p1 values less than maxvalue);
 
7701
create table t5 (colint int, col1 time) engine='NDB' 
 
7702
partition by list(colint)
 
7703
subpartition by hash(microsecond(col1)) subpartitions 2 
 
7704
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
7705
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
7706
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
7707
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
7708
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
7709
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
7710
);
 
7711
create table t6 (colint int, col1 time) engine='NDB' 
 
7712
partition by range(colint) 
 
7713
(partition p0 values less than (microsecond('10:30:10.000010')),
 
7714
partition p1 values less than maxvalue);
 
7715
-------------------------------------------------------------------------
 
7716
---  Access tables with microsecond(col1) 
 
7717
-------------------------------------------------------------------------
 
7718
insert into t1 values ('09:09:15.000002');
 
7719
insert into t1 values ('04:30:01.000018');
 
7720
insert into t2 values ('09:09:15.000002');
 
7721
insert into t2 values ('04:30:01.000018');
 
7722
insert into t2 values ('00:59:22.000024');
 
7723
insert into t3 values ('09:09:15.000002');
 
7724
insert into t3 values ('04:30:01.000018');
 
7725
insert into t3 values ('00:59:22.000024');
 
7726
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t4;
 
7727
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t5;
 
7728
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t6;
 
7729
select microsecond(col1) from t1 order by col1;
 
7730
microsecond(col1)
 
7731
0
 
7732
0
 
7733
select * from t1 order by col1;
 
7734
col1
 
7735
04:30:01
 
7736
09:09:15
 
7737
select * from t2 order by col1;
 
7738
col1
 
7739
00:59:22
 
7740
04:30:01
 
7741
09:09:15
 
7742
select * from t3 order by col1;
 
7743
col1
 
7744
00:59:22
 
7745
04:30:01
 
7746
09:09:15
 
7747
select * from t4 order by colint;
 
7748
colint  col1
 
7749
1       09:09:15
 
7750
2       04:30:01
 
7751
3       00:59:22
 
7752
4       05:30:34
 
7753
select * from t5 order by colint;
 
7754
colint  col1
 
7755
1       09:09:15
 
7756
2       04:30:01
 
7757
3       00:59:22
 
7758
4       05:30:34
 
7759
select * from t6 order by colint;
 
7760
colint  col1
 
7761
1       09:09:15
 
7762
2       04:30:01
 
7763
3       00:59:22
 
7764
4       05:30:34
 
7765
update t1 set col1='05:30:34.000037' where col1='09:09:15.000002';
 
7766
update t2 set col1='05:30:34.000037' where col1='09:09:15.000002';
 
7767
update t3 set col1='05:30:34.000037' where col1='09:09:15.000002';
 
7768
update t4 set col1='05:30:34.000037' where col1='09:09:15.000002';
 
7769
update t5 set col1='05:30:34.000037' where col1='09:09:15.000002';
 
7770
update t6 set col1='05:30:34.000037' where col1='09:09:15.000002';
 
7771
select * from t1 order by col1;
 
7772
col1
 
7773
04:30:01
 
7774
05:30:34
 
7775
select * from t2 order by col1;
 
7776
col1
 
7777
00:59:22
 
7778
04:30:01
 
7779
05:30:34
 
7780
select * from t3 order by col1;
 
7781
col1
 
7782
00:59:22
 
7783
04:30:01
 
7784
05:30:34
 
7785
select * from t4 order by colint;
 
7786
colint  col1
 
7787
1       05:30:34
 
7788
2       04:30:01
 
7789
3       00:59:22
 
7790
4       05:30:34
 
7791
select * from t5 order by colint;
 
7792
colint  col1
 
7793
1       05:30:34
 
7794
2       04:30:01
 
7795
3       00:59:22
 
7796
4       05:30:34
 
7797
select * from t6 order by colint;
 
7798
colint  col1
 
7799
1       05:30:34
 
7800
2       04:30:01
 
7801
3       00:59:22
 
7802
4       05:30:34
 
7803
-------------------------------------------------------------------------
 
7804
---  Alter tables with microsecond(col1)
 
7805
-------------------------------------------------------------------------
 
7806
drop table if exists t11 ;
 
7807
drop table if exists t22 ;
 
7808
drop table if exists t33 ;
 
7809
drop table if exists t44 ;
 
7810
drop table if exists t55 ;
 
7811
drop table if exists t66 ;
 
7812
create table t11 engine='NDB' as select * from t1;
 
7813
create table t22 engine='NDB' as select * from t2;
 
7814
create table t33 engine='NDB' as select * from t3;
 
7815
create table t44 engine='NDB' as select * from t4;
 
7816
create table t55 engine='NDB' as select * from t5;
 
7817
create table t66 engine='NDB' as select * from t6;
 
7818
alter table t11
 
7819
partition by range(microsecond(col1)) 
 
7820
(partition p0 values less than (15),
 
7821
partition p1 values less than maxvalue);
 
7822
alter table t22
 
7823
partition by list(microsecond(col1)) 
 
7824
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
7825
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
7826
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
7827
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
7828
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
7829
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
7830
);
 
7831
alter table t33
 
7832
partition by hash(microsecond(col1));
 
7833
alter table t44
 
7834
partition by range(colint) 
 
7835
subpartition by hash(microsecond(col1)) subpartitions 2 
 
7836
(partition p0 values less than (15),
 
7837
partition p1 values less than maxvalue);
 
7838
alter table t55
 
7839
partition by list(colint)
 
7840
subpartition by hash(microsecond(col1)) subpartitions 2 
 
7841
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
7842
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
7843
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
7844
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
7845
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
7846
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
7847
);
 
7848
alter table t66
 
7849
partition by range(colint) 
 
7850
(partition p0 values less than (microsecond('10:30:10.000010')),
 
7851
partition p1 values less than maxvalue);
 
7852
select * from t11 order by col1;
 
7853
col1
 
7854
04:30:01
 
7855
05:30:34
 
7856
select * from t22 order by col1;
 
7857
col1
 
7858
00:59:22
 
7859
04:30:01
 
7860
05:30:34
 
7861
select * from t33 order by col1;
 
7862
col1
 
7863
00:59:22
 
7864
04:30:01
 
7865
05:30:34
 
7866
select * from t44 order by colint;
 
7867
colint  col1
 
7868
1       05:30:34
 
7869
2       04:30:01
 
7870
3       00:59:22
 
7871
4       05:30:34
 
7872
select * from t55 order by colint;
 
7873
colint  col1
 
7874
1       05:30:34
 
7875
2       04:30:01
 
7876
3       00:59:22
 
7877
4       05:30:34
 
7878
select * from t66 order by colint;
 
7879
colint  col1
 
7880
1       05:30:34
 
7881
2       04:30:01
 
7882
3       00:59:22
 
7883
4       05:30:34
 
7884
---------------------------
 
7885
---- some alter table begin
 
7886
---------------------------
 
7887
alter table t11
 
7888
reorganize partition p0,p1 into
 
7889
(partition s1 values less than maxvalue);
 
7890
select * from t11 order by col1;
 
7891
col1
 
7892
04:30:01
 
7893
05:30:34
 
7894
alter table t11
 
7895
reorganize partition s1 into
 
7896
(partition p0 values less than (15),
 
7897
partition p1 values less than maxvalue);
 
7898
select * from t11 order by col1;
 
7899
col1
 
7900
04:30:01
 
7901
05:30:34
 
7902
alter table t55
 
7903
partition by list(colint)
 
7904
subpartition by hash(microsecond(col1)) subpartitions 5 
 
7905
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
7906
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
7907
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
7908
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
7909
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
7910
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
7911
);
 
7912
show create table t55;
 
7913
Table   Create Table
 
7914
t55     CREATE TABLE `t55` (
 
7915
  `colint` int(11) DEFAULT NULL,
 
7916
  `col1` time DEFAULT NULL
 
7917
) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (microsecond(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
 
7918
select * from t55 order by colint;
 
7919
colint  col1
 
7920
1       05:30:34
 
7921
2       04:30:01
 
7922
3       00:59:22
 
7923
4       05:30:34
 
7924
alter table t66
 
7925
reorganize partition p0,p1 into
 
7926
(partition s1 values less than maxvalue);
 
7927
select * from t66 order by colint;
 
7928
colint  col1
 
7929
1       05:30:34
 
7930
2       04:30:01
 
7931
3       00:59:22
 
7932
4       05:30:34
 
7933
alter table t66
 
7934
reorganize partition s1 into
 
7935
(partition p0 values less than (microsecond('10:30:10.000010')),
 
7936
partition p1 values less than maxvalue);
 
7937
select * from t66 order by colint;
 
7938
colint  col1
 
7939
1       05:30:34
 
7940
2       04:30:01
 
7941
3       00:59:22
 
7942
4       05:30:34
 
7943
alter table t66
 
7944
reorganize partition p0,p1 into
 
7945
(partition s1 values less than maxvalue);
 
7946
select * from t66 order by colint;
 
7947
colint  col1
 
7948
1       05:30:34
 
7949
2       04:30:01
 
7950
3       00:59:22
 
7951
4       05:30:34
 
7952
alter table t66
 
7953
reorganize partition s1 into
 
7954
(partition p0 values less than (microsecond('10:30:10.000010')),
 
7955
partition p1 values less than maxvalue);
 
7956
select * from t66 order by colint;
 
7957
colint  col1
 
7958
1       05:30:34
 
7959
2       04:30:01
 
7960
3       00:59:22
 
7961
4       05:30:34
 
7962
-------------------------------------------------------------------------
 
7963
---  Delete rows and partitions of tables with microsecond(col1)
 
7964
-------------------------------------------------------------------------
 
7965
delete from t1 where col1='04:30:01.000018';
 
7966
delete from t2 where col1='04:30:01.000018';
 
7967
delete from t3 where col1='04:30:01.000018';
 
7968
delete from t4 where col1='04:30:01.000018';
 
7969
delete from t5 where col1='04:30:01.000018';
 
7970
delete from t6 where col1='04:30:01.000018';
 
7971
select * from t1 order by col1;
 
7972
col1
 
7973
05:30:34
 
7974
select * from t2 order by col1;
 
7975
col1
 
7976
00:59:22
 
7977
05:30:34
 
7978
select * from t3 order by col1;
 
7979
col1
 
7980
00:59:22
 
7981
05:30:34
 
7982
select * from t4 order by colint;
 
7983
colint  col1
 
7984
1       05:30:34
 
7985
3       00:59:22
 
7986
4       05:30:34
 
7987
select * from t5 order by colint;
 
7988
colint  col1
 
7989
1       05:30:34
 
7990
3       00:59:22
 
7991
4       05:30:34
 
7992
insert into t1 values ('04:30:01.000018');
 
7993
insert into t2 values ('04:30:01.000018');
 
7994
insert into t3 values ('04:30:01.000018');
 
7995
insert into t4 values (60,'04:30:01.000018');
 
7996
insert into t5 values (60,'04:30:01.000018');
 
7997
insert into t6 values (60,'04:30:01.000018');
 
7998
select * from t1 order by col1;
 
7999
col1
 
8000
04:30:01
 
8001
05:30:34
 
8002
select * from t2 order by col1;
 
8003
col1
 
8004
00:59:22
 
8005
04:30:01
 
8006
05:30:34
 
8007
select * from t3 order by col1;
 
8008
col1
 
8009
00:59:22
 
8010
04:30:01
 
8011
05:30:34
 
8012
select * from t4 order by colint;
 
8013
colint  col1
 
8014
1       05:30:34
 
8015
3       00:59:22
 
8016
4       05:30:34
 
8017
60      04:30:01
 
8018
select * from t5 order by colint;
 
8019
colint  col1
 
8020
1       05:30:34
 
8021
3       00:59:22
 
8022
4       05:30:34
 
8023
60      04:30:01
 
8024
select * from t6 order by colint;
 
8025
colint  col1
 
8026
1       05:30:34
 
8027
3       00:59:22
 
8028
4       05:30:34
 
8029
60      04:30:01
 
8030
alter table t1 drop partition p0;
 
8031
alter table t2 drop partition p0;
 
8032
alter table t4 drop partition p0;
 
8033
alter table t5 drop partition p0;
 
8034
alter table t6 drop partition p0;
 
8035
select * from t1 order by col1;
 
8036
col1
 
8037
select * from t2 order by col1;
 
8038
col1
 
8039
select * from t3 order by col1;
 
8040
col1
 
8041
00:59:22
 
8042
04:30:01
 
8043
05:30:34
 
8044
select * from t4 order by colint;
 
8045
colint  col1
 
8046
60      04:30:01
 
8047
select * from t5 order by colint;
 
8048
colint  col1
 
8049
60      04:30:01
 
8050
select * from t6 order by colint;
 
8051
colint  col1
 
8052
60      04:30:01
 
8053
-------------------------------------------------------------------------
 
8054
---  Delete rows and partitions of tables with microsecond(col1)
 
8055
-------------------------------------------------------------------------
 
8056
delete from t11 where col1='04:30:01.000018';
 
8057
delete from t22 where col1='04:30:01.000018';
 
8058
delete from t33 where col1='04:30:01.000018';
 
8059
delete from t44 where col1='04:30:01.000018';
 
8060
delete from t55 where col1='04:30:01.000018';
 
8061
delete from t66 where col1='04:30:01.000018';
 
8062
select * from t11 order by col1;
 
8063
col1
 
8064
05:30:34
 
8065
select * from t22 order by col1;
 
8066
col1
 
8067
00:59:22
 
8068
05:30:34
 
8069
select * from t33 order by col1;
 
8070
col1
 
8071
00:59:22
 
8072
05:30:34
 
8073
select * from t44 order by colint;
 
8074
colint  col1
 
8075
1       05:30:34
 
8076
3       00:59:22
 
8077
4       05:30:34
 
8078
select * from t55 order by colint;
 
8079
colint  col1
 
8080
1       05:30:34
 
8081
3       00:59:22
 
8082
4       05:30:34
 
8083
insert into t11 values ('04:30:01.000018');
 
8084
insert into t22 values ('04:30:01.000018');
 
8085
insert into t33 values ('04:30:01.000018');
 
8086
insert into t44 values (60,'04:30:01.000018');
 
8087
insert into t55 values (60,'04:30:01.000018');
 
8088
insert into t66 values (60,'04:30:01.000018');
 
8089
select * from t11 order by col1;
 
8090
col1
 
8091
04:30:01
 
8092
05:30:34
 
8093
select * from t22 order by col1;
 
8094
col1
 
8095
00:59:22
 
8096
04:30:01
 
8097
05:30:34
 
8098
select * from t33 order by col1;
 
8099
col1
 
8100
00:59:22
 
8101
04:30:01
 
8102
05:30:34
 
8103
select * from t44 order by colint;
 
8104
colint  col1
 
8105
1       05:30:34
 
8106
3       00:59:22
 
8107
4       05:30:34
 
8108
60      04:30:01
 
8109
select * from t55 order by colint;
 
8110
colint  col1
 
8111
1       05:30:34
 
8112
3       00:59:22
 
8113
4       05:30:34
 
8114
60      04:30:01
 
8115
select * from t66 order by colint;
 
8116
colint  col1
 
8117
1       05:30:34
 
8118
3       00:59:22
 
8119
4       05:30:34
 
8120
60      04:30:01
 
8121
alter table t11 drop partition p0;
 
8122
alter table t22 drop partition p0;
 
8123
alter table t44 drop partition p0;
 
8124
alter table t55 drop partition p0;
 
8125
alter table t66 drop partition p0;
 
8126
select * from t11 order by col1;
 
8127
col1
 
8128
select * from t22 order by col1;
 
8129
col1
 
8130
select * from t33 order by col1;
 
8131
col1
 
8132
00:59:22
 
8133
04:30:01
 
8134
05:30:34
 
8135
select * from t44 order by colint;
 
8136
colint  col1
 
8137
60      04:30:01
 
8138
select * from t55 order by colint;
 
8139
colint  col1
 
8140
60      04:30:01
 
8141
select * from t66 order by colint;
 
8142
colint  col1
 
8143
60      04:30:01
 
8144
-------------------------
 
8145
---- some alter table end
 
8146
-------------------------
 
8147
drop table if exists t1 ;
 
8148
drop table if exists t2 ;
 
8149
drop table if exists t3 ;
 
8150
drop table if exists t4 ;
 
8151
drop table if exists t5 ;
 
8152
drop table if exists t6 ;
 
8153
drop table if exists t11 ;
 
8154
drop table if exists t22 ;
 
8155
drop table if exists t33 ;
 
8156
drop table if exists t44 ;
 
8157
drop table if exists t55 ;
 
8158
drop table if exists t66 ;
 
8159
-------------------------------------------------------------------------
 
8160
---  minute(col1)  in partition with coltype  time
 
8161
-------------------------------------------------------------------------
 
8162
drop table if exists t1 ;
 
8163
drop table if exists t2 ;
 
8164
drop table if exists t3 ;
 
8165
drop table if exists t4 ;
 
8166
drop table if exists t5 ;
 
8167
drop table if exists t6 ;
 
8168
-------------------------------------------------------------------------
 
8169
---  Create tables with minute(col1)
 
8170
-------------------------------------------------------------------------
 
8171
create table t1 (col1 time) engine='NDB' 
 
8172
partition by range(minute(col1)) 
 
8173
(partition p0 values less than (15),
 
8174
partition p1 values less than maxvalue);
 
8175
create table t2 (col1 time) engine='NDB' 
 
8176
partition by list(minute(col1)) 
 
8177
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
8178
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
8179
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
8180
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
8181
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
8182
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
8183
);
 
8184
create table t3 (col1 time) engine='NDB' 
 
8185
partition by hash(minute(col1));
 
8186
create table t4 (colint int, col1 time) engine='NDB' 
 
8187
partition by range(colint) 
 
8188
subpartition by hash(minute(col1)) subpartitions 2 
 
8189
(partition p0 values less than (15),
 
8190
partition p1 values less than maxvalue);
 
8191
create table t5 (colint int, col1 time) engine='NDB' 
 
8192
partition by list(colint)
 
8193
subpartition by hash(minute(col1)) subpartitions 2 
 
8194
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
8195
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
8196
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
8197
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
8198
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
8199
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
8200
);
 
8201
create table t6 (colint int, col1 time) engine='NDB' 
 
8202
partition by range(colint) 
 
8203
(partition p0 values less than (minute('18:30')),
 
8204
partition p1 values less than maxvalue);
 
8205
-------------------------------------------------------------------------
 
8206
---  Access tables with minute(col1) 
 
8207
-------------------------------------------------------------------------
 
8208
insert into t1 values ('09:09:15');
 
8209
insert into t1 values ('14:30:45');
 
8210
insert into t2 values ('09:09:15');
 
8211
insert into t2 values ('14:30:45');
 
8212
insert into t2 values ('21:59:22');
 
8213
insert into t3 values ('09:09:15');
 
8214
insert into t3 values ('14:30:45');
 
8215
insert into t3 values ('21:59:22');
 
8216
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t4;
 
8217
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t5;
 
8218
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t6;
 
8219
select minute(col1) from t1 order by col1;
 
8220
minute(col1)
 
8221
9
 
8222
30
 
8223
select * from t1 order by col1;
 
8224
col1
 
8225
09:09:15
 
8226
14:30:45
 
8227
select * from t2 order by col1;
 
8228
col1
 
8229
09:09:15
 
8230
14:30:45
 
8231
21:59:22
 
8232
select * from t3 order by col1;
 
8233
col1
 
8234
09:09:15
 
8235
14:30:45
 
8236
21:59:22
 
8237
select * from t4 order by colint;
 
8238
colint  col1
 
8239
1       09:09:15
 
8240
2       04:30:01
 
8241
3       00:59:22
 
8242
4       05:30:34
 
8243
select * from t5 order by colint;
 
8244
colint  col1
 
8245
1       09:09:15
 
8246
2       04:30:01
 
8247
3       00:59:22
 
8248
4       05:30:34
 
8249
select * from t6 order by colint;
 
8250
colint  col1
 
8251
1       09:09:15
 
8252
2       04:30:01
 
8253
3       00:59:22
 
8254
4       05:30:34
 
8255
update t1 set col1='10:24:23' where col1='09:09:15';
 
8256
update t2 set col1='10:24:23' where col1='09:09:15';
 
8257
update t3 set col1='10:24:23' where col1='09:09:15';
 
8258
update t4 set col1='10:24:23' where col1='09:09:15';
 
8259
update t5 set col1='10:24:23' where col1='09:09:15';
 
8260
update t6 set col1='10:24:23' where col1='09:09:15';
 
8261
select * from t1 order by col1;
 
8262
col1
 
8263
10:24:23
 
8264
14:30:45
 
8265
select * from t2 order by col1;
 
8266
col1
 
8267
10:24:23
 
8268
14:30:45
 
8269
21:59:22
 
8270
select * from t3 order by col1;
 
8271
col1
 
8272
10:24:23
 
8273
14:30:45
 
8274
21:59:22
 
8275
select * from t4 order by colint;
 
8276
colint  col1
 
8277
1       10:24:23
 
8278
2       04:30:01
 
8279
3       00:59:22
 
8280
4       05:30:34
 
8281
select * from t5 order by colint;
 
8282
colint  col1
 
8283
1       10:24:23
 
8284
2       04:30:01
 
8285
3       00:59:22
 
8286
4       05:30:34
 
8287
select * from t6 order by colint;
 
8288
colint  col1
 
8289
1       10:24:23
 
8290
2       04:30:01
 
8291
3       00:59:22
 
8292
4       05:30:34
 
8293
-------------------------------------------------------------------------
 
8294
---  Alter tables with minute(col1)
 
8295
-------------------------------------------------------------------------
 
8296
drop table if exists t11 ;
 
8297
drop table if exists t22 ;
 
8298
drop table if exists t33 ;
 
8299
drop table if exists t44 ;
 
8300
drop table if exists t55 ;
 
8301
drop table if exists t66 ;
 
8302
create table t11 engine='NDB' as select * from t1;
 
8303
create table t22 engine='NDB' as select * from t2;
 
8304
create table t33 engine='NDB' as select * from t3;
 
8305
create table t44 engine='NDB' as select * from t4;
 
8306
create table t55 engine='NDB' as select * from t5;
 
8307
create table t66 engine='NDB' as select * from t6;
 
8308
alter table t11
 
8309
partition by range(minute(col1)) 
 
8310
(partition p0 values less than (15),
 
8311
partition p1 values less than maxvalue);
 
8312
alter table t22
 
8313
partition by list(minute(col1)) 
 
8314
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
8315
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
8316
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
8317
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
8318
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
8319
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
8320
);
 
8321
alter table t33
 
8322
partition by hash(minute(col1));
 
8323
alter table t44
 
8324
partition by range(colint) 
 
8325
subpartition by hash(minute(col1)) subpartitions 2 
 
8326
(partition p0 values less than (15),
 
8327
partition p1 values less than maxvalue);
 
8328
alter table t55
 
8329
partition by list(colint)
 
8330
subpartition by hash(minute(col1)) subpartitions 2 
 
8331
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
8332
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
8333
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
8334
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
8335
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
8336
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
8337
);
 
8338
alter table t66
 
8339
partition by range(colint) 
 
8340
(partition p0 values less than (minute('18:30')),
 
8341
partition p1 values less than maxvalue);
 
8342
select * from t11 order by col1;
 
8343
col1
 
8344
10:24:23
 
8345
14:30:45
 
8346
select * from t22 order by col1;
 
8347
col1
 
8348
10:24:23
 
8349
14:30:45
 
8350
21:59:22
 
8351
select * from t33 order by col1;
 
8352
col1
 
8353
10:24:23
 
8354
14:30:45
 
8355
21:59:22
 
8356
select * from t44 order by colint;
 
8357
colint  col1
 
8358
1       10:24:23
 
8359
2       04:30:01
 
8360
3       00:59:22
 
8361
4       05:30:34
 
8362
select * from t55 order by colint;
 
8363
colint  col1
 
8364
1       10:24:23
 
8365
2       04:30:01
 
8366
3       00:59:22
 
8367
4       05:30:34
 
8368
select * from t66 order by colint;
 
8369
colint  col1
 
8370
1       10:24:23
 
8371
2       04:30:01
 
8372
3       00:59:22
 
8373
4       05:30:34
 
8374
---------------------------
 
8375
---- some alter table begin
 
8376
---------------------------
 
8377
alter table t11
 
8378
reorganize partition p0,p1 into
 
8379
(partition s1 values less than maxvalue);
 
8380
select * from t11 order by col1;
 
8381
col1
 
8382
10:24:23
 
8383
14:30:45
 
8384
alter table t11
 
8385
reorganize partition s1 into
 
8386
(partition p0 values less than (15),
 
8387
partition p1 values less than maxvalue);
 
8388
select * from t11 order by col1;
 
8389
col1
 
8390
10:24:23
 
8391
14:30:45
 
8392
alter table t55
 
8393
partition by list(colint)
 
8394
subpartition by hash(minute(col1)) subpartitions 5 
 
8395
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
8396
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
8397
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
8398
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
8399
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
8400
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
8401
);
 
8402
show create table t55;
 
8403
Table   Create Table
 
8404
t55     CREATE TABLE `t55` (
 
8405
  `colint` int(11) DEFAULT NULL,
 
8406
  `col1` time DEFAULT NULL
 
8407
) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (minute(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
 
8408
select * from t55 order by colint;
 
8409
colint  col1
 
8410
1       10:24:23
 
8411
2       04:30:01
 
8412
3       00:59:22
 
8413
4       05:30:34
 
8414
alter table t66
 
8415
reorganize partition p0,p1 into
 
8416
(partition s1 values less than maxvalue);
 
8417
select * from t66 order by colint;
 
8418
colint  col1
 
8419
1       10:24:23
 
8420
2       04:30:01
 
8421
3       00:59:22
 
8422
4       05:30:34
 
8423
alter table t66
 
8424
reorganize partition s1 into
 
8425
(partition p0 values less than (minute('18:30')),
 
8426
partition p1 values less than maxvalue);
 
8427
select * from t66 order by colint;
 
8428
colint  col1
 
8429
1       10:24:23
 
8430
2       04:30:01
 
8431
3       00:59:22
 
8432
4       05:30:34
 
8433
alter table t66
 
8434
reorganize partition p0,p1 into
 
8435
(partition s1 values less than maxvalue);
 
8436
select * from t66 order by colint;
 
8437
colint  col1
 
8438
1       10:24:23
 
8439
2       04:30:01
 
8440
3       00:59:22
 
8441
4       05:30:34
 
8442
alter table t66
 
8443
reorganize partition s1 into
 
8444
(partition p0 values less than (minute('18:30')),
 
8445
partition p1 values less than maxvalue);
 
8446
select * from t66 order by colint;
 
8447
colint  col1
 
8448
1       10:24:23
 
8449
2       04:30:01
 
8450
3       00:59:22
 
8451
4       05:30:34
 
8452
-------------------------------------------------------------------------
 
8453
---  Delete rows and partitions of tables with minute(col1)
 
8454
-------------------------------------------------------------------------
 
8455
delete from t1 where col1='14:30:45';
 
8456
delete from t2 where col1='14:30:45';
 
8457
delete from t3 where col1='14:30:45';
 
8458
delete from t4 where col1='14:30:45';
 
8459
delete from t5 where col1='14:30:45';
 
8460
delete from t6 where col1='14:30:45';
 
8461
select * from t1 order by col1;
 
8462
col1
 
8463
10:24:23
 
8464
select * from t2 order by col1;
 
8465
col1
 
8466
10:24:23
 
8467
21:59:22
 
8468
select * from t3 order by col1;
 
8469
col1
 
8470
10:24:23
 
8471
21:59:22
 
8472
select * from t4 order by colint;
 
8473
colint  col1
 
8474
1       10:24:23
 
8475
2       04:30:01
 
8476
3       00:59:22
 
8477
4       05:30:34
 
8478
select * from t5 order by colint;
 
8479
colint  col1
 
8480
1       10:24:23
 
8481
2       04:30:01
 
8482
3       00:59:22
 
8483
4       05:30:34
 
8484
insert into t1 values ('14:30:45');
 
8485
insert into t2 values ('14:30:45');
 
8486
insert into t3 values ('14:30:45');
 
8487
insert into t4 values (60,'14:30:45');
 
8488
insert into t5 values (60,'14:30:45');
 
8489
insert into t6 values (60,'14:30:45');
 
8490
select * from t1 order by col1;
 
8491
col1
 
8492
10:24:23
 
8493
14:30:45
 
8494
select * from t2 order by col1;
 
8495
col1
 
8496
10:24:23
 
8497
14:30:45
 
8498
21:59:22
 
8499
select * from t3 order by col1;
 
8500
col1
 
8501
10:24:23
 
8502
14:30:45
 
8503
21:59:22
 
8504
select * from t4 order by colint;
 
8505
colint  col1
 
8506
1       10:24:23
 
8507
2       04:30:01
 
8508
3       00:59:22
 
8509
4       05:30:34
 
8510
60      14:30:45
 
8511
select * from t5 order by colint;
 
8512
colint  col1
 
8513
1       10:24:23
 
8514
2       04:30:01
 
8515
3       00:59:22
 
8516
4       05:30:34
 
8517
60      14:30:45
 
8518
select * from t6 order by colint;
 
8519
colint  col1
 
8520
1       10:24:23
 
8521
2       04:30:01
 
8522
3       00:59:22
 
8523
4       05:30:34
 
8524
60      14:30:45
 
8525
alter table t1 drop partition p0;
 
8526
alter table t2 drop partition p0;
 
8527
alter table t4 drop partition p0;
 
8528
alter table t5 drop partition p0;
 
8529
alter table t6 drop partition p0;
 
8530
select * from t1 order by col1;
 
8531
col1
 
8532
10:24:23
 
8533
14:30:45
 
8534
select * from t2 order by col1;
 
8535
col1
 
8536
10:24:23
 
8537
14:30:45
 
8538
21:59:22
 
8539
select * from t3 order by col1;
 
8540
col1
 
8541
10:24:23
 
8542
14:30:45
 
8543
21:59:22
 
8544
select * from t4 order by colint;
 
8545
colint  col1
 
8546
60      14:30:45
 
8547
select * from t5 order by colint;
 
8548
colint  col1
 
8549
60      14:30:45
 
8550
select * from t6 order by colint;
 
8551
colint  col1
 
8552
60      14:30:45
 
8553
-------------------------------------------------------------------------
 
8554
---  Delete rows and partitions of tables with minute(col1)
 
8555
-------------------------------------------------------------------------
 
8556
delete from t11 where col1='14:30:45';
 
8557
delete from t22 where col1='14:30:45';
 
8558
delete from t33 where col1='14:30:45';
 
8559
delete from t44 where col1='14:30:45';
 
8560
delete from t55 where col1='14:30:45';
 
8561
delete from t66 where col1='14:30:45';
 
8562
select * from t11 order by col1;
 
8563
col1
 
8564
10:24:23
 
8565
select * from t22 order by col1;
 
8566
col1
 
8567
10:24:23
 
8568
21:59:22
 
8569
select * from t33 order by col1;
 
8570
col1
 
8571
10:24:23
 
8572
21:59:22
 
8573
select * from t44 order by colint;
 
8574
colint  col1
 
8575
1       10:24:23
 
8576
2       04:30:01
 
8577
3       00:59:22
 
8578
4       05:30:34
 
8579
select * from t55 order by colint;
 
8580
colint  col1
 
8581
1       10:24:23
 
8582
2       04:30:01
 
8583
3       00:59:22
 
8584
4       05:30:34
 
8585
insert into t11 values ('14:30:45');
 
8586
insert into t22 values ('14:30:45');
 
8587
insert into t33 values ('14:30:45');
 
8588
insert into t44 values (60,'14:30:45');
 
8589
insert into t55 values (60,'14:30:45');
 
8590
insert into t66 values (60,'14:30:45');
 
8591
select * from t11 order by col1;
 
8592
col1
 
8593
10:24:23
 
8594
14:30:45
 
8595
select * from t22 order by col1;
 
8596
col1
 
8597
10:24:23
 
8598
14:30:45
 
8599
21:59:22
 
8600
select * from t33 order by col1;
 
8601
col1
 
8602
10:24:23
 
8603
14:30:45
 
8604
21:59:22
 
8605
select * from t44 order by colint;
 
8606
colint  col1
 
8607
1       10:24:23
 
8608
2       04:30:01
 
8609
3       00:59:22
 
8610
4       05:30:34
 
8611
60      14:30:45
 
8612
select * from t55 order by colint;
 
8613
colint  col1
 
8614
1       10:24:23
 
8615
2       04:30:01
 
8616
3       00:59:22
 
8617
4       05:30:34
 
8618
60      14:30:45
 
8619
select * from t66 order by colint;
 
8620
colint  col1
 
8621
1       10:24:23
 
8622
2       04:30:01
 
8623
3       00:59:22
 
8624
4       05:30:34
 
8625
60      14:30:45
 
8626
alter table t11 drop partition p0;
 
8627
alter table t22 drop partition p0;
 
8628
alter table t44 drop partition p0;
 
8629
alter table t55 drop partition p0;
 
8630
alter table t66 drop partition p0;
 
8631
select * from t11 order by col1;
 
8632
col1
 
8633
10:24:23
 
8634
14:30:45
 
8635
select * from t22 order by col1;
 
8636
col1
 
8637
10:24:23
 
8638
14:30:45
 
8639
21:59:22
 
8640
select * from t33 order by col1;
 
8641
col1
 
8642
10:24:23
 
8643
14:30:45
 
8644
21:59:22
 
8645
select * from t44 order by colint;
 
8646
colint  col1
 
8647
60      14:30:45
 
8648
select * from t55 order by colint;
 
8649
colint  col1
 
8650
60      14:30:45
 
8651
select * from t66 order by colint;
 
8652
colint  col1
 
8653
60      14:30:45
 
8654
-------------------------
 
8655
---- some alter table end
 
8656
-------------------------
 
8657
drop table if exists t1 ;
 
8658
drop table if exists t2 ;
 
8659
drop table if exists t3 ;
 
8660
drop table if exists t4 ;
 
8661
drop table if exists t5 ;
 
8662
drop table if exists t6 ;
 
8663
drop table if exists t11 ;
 
8664
drop table if exists t22 ;
 
8665
drop table if exists t33 ;
 
8666
drop table if exists t44 ;
 
8667
drop table if exists t55 ;
 
8668
drop table if exists t66 ;
 
8669
-------------------------------------------------------------------------
 
8670
---  second(col1)  in partition with coltype  time
 
8671
-------------------------------------------------------------------------
 
8672
drop table if exists t1 ;
 
8673
drop table if exists t2 ;
 
8674
drop table if exists t3 ;
 
8675
drop table if exists t4 ;
 
8676
drop table if exists t5 ;
 
8677
drop table if exists t6 ;
 
8678
-------------------------------------------------------------------------
 
8679
---  Create tables with second(col1)
 
8680
-------------------------------------------------------------------------
 
8681
create table t1 (col1 time) engine='NDB' 
 
8682
partition by range(second(col1)) 
 
8683
(partition p0 values less than (15),
 
8684
partition p1 values less than maxvalue);
 
8685
create table t2 (col1 time) engine='NDB' 
 
8686
partition by list(second(col1)) 
 
8687
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
8688
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
8689
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
8690
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
8691
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
8692
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
8693
);
 
8694
create table t3 (col1 time) engine='NDB' 
 
8695
partition by hash(second(col1));
 
8696
create table t4 (colint int, col1 time) engine='NDB' 
 
8697
partition by range(colint) 
 
8698
subpartition by hash(second(col1)) subpartitions 2 
 
8699
(partition p0 values less than (15),
 
8700
partition p1 values less than maxvalue);
 
8701
create table t5 (colint int, col1 time) engine='NDB' 
 
8702
partition by list(colint)
 
8703
subpartition by hash(second(col1)) subpartitions 2 
 
8704
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
8705
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
8706
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
8707
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
8708
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
8709
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
8710
);
 
8711
create table t6 (colint int, col1 time) engine='NDB' 
 
8712
partition by range(colint) 
 
8713
(partition p0 values less than (second('18:30:14')),
 
8714
partition p1 values less than maxvalue);
 
8715
-------------------------------------------------------------------------
 
8716
---  Access tables with second(col1) 
 
8717
-------------------------------------------------------------------------
 
8718
insert into t1 values ('09:09:09');
 
8719
insert into t1 values ('14:30:20');
 
8720
insert into t2 values ('09:09:09');
 
8721
insert into t2 values ('14:30:20');
 
8722
insert into t2 values ('21:59:22');
 
8723
insert into t3 values ('09:09:09');
 
8724
insert into t3 values ('14:30:20');
 
8725
insert into t3 values ('21:59:22');
 
8726
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t4;
 
8727
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t5;
 
8728
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t6;
 
8729
select second(col1) from t1 order by col1;
 
8730
second(col1)
 
8731
9
 
8732
20
 
8733
select * from t1 order by col1;
 
8734
col1
 
8735
09:09:09
 
8736
14:30:20
 
8737
select * from t2 order by col1;
 
8738
col1
 
8739
09:09:09
 
8740
14:30:20
 
8741
21:59:22
 
8742
select * from t3 order by col1;
 
8743
col1
 
8744
09:09:09
 
8745
14:30:20
 
8746
21:59:22
 
8747
select * from t4 order by colint;
 
8748
colint  col1
 
8749
1       09:09:15
 
8750
2       04:30:01
 
8751
3       00:59:22
 
8752
4       05:30:34
 
8753
select * from t5 order by colint;
 
8754
colint  col1
 
8755
1       09:09:15
 
8756
2       04:30:01
 
8757
3       00:59:22
 
8758
4       05:30:34
 
8759
select * from t6 order by colint;
 
8760
colint  col1
 
8761
1       09:09:15
 
8762
2       04:30:01
 
8763
3       00:59:22
 
8764
4       05:30:34
 
8765
update t1 set col1='10:22:33' where col1='09:09:09';
 
8766
update t2 set col1='10:22:33' where col1='09:09:09';
 
8767
update t3 set col1='10:22:33' where col1='09:09:09';
 
8768
update t4 set col1='10:22:33' where col1='09:09:09';
 
8769
update t5 set col1='10:22:33' where col1='09:09:09';
 
8770
update t6 set col1='10:22:33' where col1='09:09:09';
 
8771
select * from t1 order by col1;
 
8772
col1
 
8773
10:22:33
 
8774
14:30:20
 
8775
select * from t2 order by col1;
 
8776
col1
 
8777
10:22:33
 
8778
14:30:20
 
8779
21:59:22
 
8780
select * from t3 order by col1;
 
8781
col1
 
8782
10:22:33
 
8783
14:30:20
 
8784
21:59:22
 
8785
select * from t4 order by colint;
 
8786
colint  col1
 
8787
1       09:09:15
 
8788
2       04:30:01
 
8789
3       00:59:22
 
8790
4       05:30:34
 
8791
select * from t5 order by colint;
 
8792
colint  col1
 
8793
1       09:09:15
 
8794
2       04:30:01
 
8795
3       00:59:22
 
8796
4       05:30:34
 
8797
select * from t6 order by colint;
 
8798
colint  col1
 
8799
1       09:09:15
 
8800
2       04:30:01
 
8801
3       00:59:22
 
8802
4       05:30:34
 
8803
-------------------------------------------------------------------------
 
8804
---  Alter tables with second(col1)
 
8805
-------------------------------------------------------------------------
 
8806
drop table if exists t11 ;
 
8807
drop table if exists t22 ;
 
8808
drop table if exists t33 ;
 
8809
drop table if exists t44 ;
 
8810
drop table if exists t55 ;
 
8811
drop table if exists t66 ;
 
8812
create table t11 engine='NDB' as select * from t1;
 
8813
create table t22 engine='NDB' as select * from t2;
 
8814
create table t33 engine='NDB' as select * from t3;
 
8815
create table t44 engine='NDB' as select * from t4;
 
8816
create table t55 engine='NDB' as select * from t5;
 
8817
create table t66 engine='NDB' as select * from t6;
 
8818
alter table t11
 
8819
partition by range(second(col1)) 
 
8820
(partition p0 values less than (15),
 
8821
partition p1 values less than maxvalue);
 
8822
alter table t22
 
8823
partition by list(second(col1)) 
 
8824
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
8825
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
8826
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
8827
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
8828
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
8829
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
8830
);
 
8831
alter table t33
 
8832
partition by hash(second(col1));
 
8833
alter table t44
 
8834
partition by range(colint) 
 
8835
subpartition by hash(second(col1)) subpartitions 2 
 
8836
(partition p0 values less than (15),
 
8837
partition p1 values less than maxvalue);
 
8838
alter table t55
 
8839
partition by list(colint)
 
8840
subpartition by hash(second(col1)) subpartitions 2 
 
8841
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
8842
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
8843
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
8844
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
8845
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
8846
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
8847
);
 
8848
alter table t66
 
8849
partition by range(colint) 
 
8850
(partition p0 values less than (second('18:30:14')),
 
8851
partition p1 values less than maxvalue);
 
8852
select * from t11 order by col1;
 
8853
col1
 
8854
10:22:33
 
8855
14:30:20
 
8856
select * from t22 order by col1;
 
8857
col1
 
8858
10:22:33
 
8859
14:30:20
 
8860
21:59:22
 
8861
select * from t33 order by col1;
 
8862
col1
 
8863
10:22:33
 
8864
14:30:20
 
8865
21:59:22
 
8866
select * from t44 order by colint;
 
8867
colint  col1
 
8868
1       09:09:15
 
8869
2       04:30:01
 
8870
3       00:59:22
 
8871
4       05:30:34
 
8872
select * from t55 order by colint;
 
8873
colint  col1
 
8874
1       09:09:15
 
8875
2       04:30:01
 
8876
3       00:59:22
 
8877
4       05:30:34
 
8878
select * from t66 order by colint;
 
8879
colint  col1
 
8880
1       09:09:15
 
8881
2       04:30:01
 
8882
3       00:59:22
 
8883
4       05:30:34
 
8884
---------------------------
 
8885
---- some alter table begin
 
8886
---------------------------
 
8887
alter table t11
 
8888
reorganize partition p0,p1 into
 
8889
(partition s1 values less than maxvalue);
 
8890
select * from t11 order by col1;
 
8891
col1
 
8892
10:22:33
 
8893
14:30:20
 
8894
alter table t11
 
8895
reorganize partition s1 into
 
8896
(partition p0 values less than (15),
 
8897
partition p1 values less than maxvalue);
 
8898
select * from t11 order by col1;
 
8899
col1
 
8900
10:22:33
 
8901
14:30:20
 
8902
alter table t55
 
8903
partition by list(colint)
 
8904
subpartition by hash(second(col1)) subpartitions 5 
 
8905
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
8906
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
8907
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
8908
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
8909
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
8910
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
8911
);
 
8912
show create table t55;
 
8913
Table   Create Table
 
8914
t55     CREATE TABLE `t55` (
 
8915
  `colint` int(11) DEFAULT NULL,
 
8916
  `col1` time DEFAULT NULL
 
8917
) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (second(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
 
8918
select * from t55 order by colint;
 
8919
colint  col1
 
8920
1       09:09:15
 
8921
2       04:30:01
 
8922
3       00:59:22
 
8923
4       05:30:34
 
8924
alter table t66
 
8925
reorganize partition p0,p1 into
 
8926
(partition s1 values less than maxvalue);
 
8927
select * from t66 order by colint;
 
8928
colint  col1
 
8929
1       09:09:15
 
8930
2       04:30:01
 
8931
3       00:59:22
 
8932
4       05:30:34
 
8933
alter table t66
 
8934
reorganize partition s1 into
 
8935
(partition p0 values less than (second('18:30:14')),
 
8936
partition p1 values less than maxvalue);
 
8937
select * from t66 order by colint;
 
8938
colint  col1
 
8939
1       09:09:15
 
8940
2       04:30:01
 
8941
3       00:59:22
 
8942
4       05:30:34
 
8943
alter table t66
 
8944
reorganize partition p0,p1 into
 
8945
(partition s1 values less than maxvalue);
 
8946
select * from t66 order by colint;
 
8947
colint  col1
 
8948
1       09:09:15
 
8949
2       04:30:01
 
8950
3       00:59:22
 
8951
4       05:30:34
 
8952
alter table t66
 
8953
reorganize partition s1 into
 
8954
(partition p0 values less than (second('18:30:14')),
 
8955
partition p1 values less than maxvalue);
 
8956
select * from t66 order by colint;
 
8957
colint  col1
 
8958
1       09:09:15
 
8959
2       04:30:01
 
8960
3       00:59:22
 
8961
4       05:30:34
 
8962
-------------------------------------------------------------------------
 
8963
---  Delete rows and partitions of tables with second(col1)
 
8964
-------------------------------------------------------------------------
 
8965
delete from t1 where col1='14:30:20';
 
8966
delete from t2 where col1='14:30:20';
 
8967
delete from t3 where col1='14:30:20';
 
8968
delete from t4 where col1='14:30:20';
 
8969
delete from t5 where col1='14:30:20';
 
8970
delete from t6 where col1='14:30:20';
 
8971
select * from t1 order by col1;
 
8972
col1
 
8973
10:22:33
 
8974
select * from t2 order by col1;
 
8975
col1
 
8976
10:22:33
 
8977
21:59:22
 
8978
select * from t3 order by col1;
 
8979
col1
 
8980
10:22:33
 
8981
21:59:22
 
8982
select * from t4 order by colint;
 
8983
colint  col1
 
8984
1       09:09:15
 
8985
2       04:30:01
 
8986
3       00:59:22
 
8987
4       05:30:34
 
8988
select * from t5 order by colint;
 
8989
colint  col1
 
8990
1       09:09:15
 
8991
2       04:30:01
 
8992
3       00:59:22
 
8993
4       05:30:34
 
8994
insert into t1 values ('14:30:20');
 
8995
insert into t2 values ('14:30:20');
 
8996
insert into t3 values ('14:30:20');
 
8997
insert into t4 values (60,'14:30:20');
 
8998
insert into t5 values (60,'14:30:20');
 
8999
insert into t6 values (60,'14:30:20');
 
9000
select * from t1 order by col1;
 
9001
col1
 
9002
10:22:33
 
9003
14:30:20
 
9004
select * from t2 order by col1;
 
9005
col1
 
9006
10:22:33
 
9007
14:30:20
 
9008
21:59:22
 
9009
select * from t3 order by col1;
 
9010
col1
 
9011
10:22:33
 
9012
14:30:20
 
9013
21:59:22
 
9014
select * from t4 order by colint;
 
9015
colint  col1
 
9016
1       09:09:15
 
9017
2       04:30:01
 
9018
3       00:59:22
 
9019
4       05:30:34
 
9020
60      14:30:20
 
9021
select * from t5 order by colint;
 
9022
colint  col1
 
9023
1       09:09:15
 
9024
2       04:30:01
 
9025
3       00:59:22
 
9026
4       05:30:34
 
9027
60      14:30:20
 
9028
select * from t6 order by colint;
 
9029
colint  col1
 
9030
1       09:09:15
 
9031
2       04:30:01
 
9032
3       00:59:22
 
9033
4       05:30:34
 
9034
60      14:30:20
 
9035
alter table t1 drop partition p0;
 
9036
alter table t2 drop partition p0;
 
9037
alter table t4 drop partition p0;
 
9038
alter table t5 drop partition p0;
 
9039
alter table t6 drop partition p0;
 
9040
select * from t1 order by col1;
 
9041
col1
 
9042
10:22:33
 
9043
14:30:20
 
9044
select * from t2 order by col1;
 
9045
col1
 
9046
10:22:33
 
9047
14:30:20
 
9048
21:59:22
 
9049
select * from t3 order by col1;
 
9050
col1
 
9051
10:22:33
 
9052
14:30:20
 
9053
21:59:22
 
9054
select * from t4 order by colint;
 
9055
colint  col1
 
9056
60      14:30:20
 
9057
select * from t5 order by colint;
 
9058
colint  col1
 
9059
60      14:30:20
 
9060
select * from t6 order by colint;
 
9061
colint  col1
 
9062
60      14:30:20
 
9063
-------------------------------------------------------------------------
 
9064
---  Delete rows and partitions of tables with second(col1)
 
9065
-------------------------------------------------------------------------
 
9066
delete from t11 where col1='14:30:20';
 
9067
delete from t22 where col1='14:30:20';
 
9068
delete from t33 where col1='14:30:20';
 
9069
delete from t44 where col1='14:30:20';
 
9070
delete from t55 where col1='14:30:20';
 
9071
delete from t66 where col1='14:30:20';
 
9072
select * from t11 order by col1;
 
9073
col1
 
9074
10:22:33
 
9075
select * from t22 order by col1;
 
9076
col1
 
9077
10:22:33
 
9078
21:59:22
 
9079
select * from t33 order by col1;
 
9080
col1
 
9081
10:22:33
 
9082
21:59:22
 
9083
select * from t44 order by colint;
 
9084
colint  col1
 
9085
1       09:09:15
 
9086
2       04:30:01
 
9087
3       00:59:22
 
9088
4       05:30:34
 
9089
select * from t55 order by colint;
 
9090
colint  col1
 
9091
1       09:09:15
 
9092
2       04:30:01
 
9093
3       00:59:22
 
9094
4       05:30:34
 
9095
insert into t11 values ('14:30:20');
 
9096
insert into t22 values ('14:30:20');
 
9097
insert into t33 values ('14:30:20');
 
9098
insert into t44 values (60,'14:30:20');
 
9099
insert into t55 values (60,'14:30:20');
 
9100
insert into t66 values (60,'14:30:20');
 
9101
select * from t11 order by col1;
 
9102
col1
 
9103
10:22:33
 
9104
14:30:20
 
9105
select * from t22 order by col1;
 
9106
col1
 
9107
10:22:33
 
9108
14:30:20
 
9109
21:59:22
 
9110
select * from t33 order by col1;
 
9111
col1
 
9112
10:22:33
 
9113
14:30:20
 
9114
21:59:22
 
9115
select * from t44 order by colint;
 
9116
colint  col1
 
9117
1       09:09:15
 
9118
2       04:30:01
 
9119
3       00:59:22
 
9120
4       05:30:34
 
9121
60      14:30:20
 
9122
select * from t55 order by colint;
 
9123
colint  col1
 
9124
1       09:09:15
 
9125
2       04:30:01
 
9126
3       00:59:22
 
9127
4       05:30:34
 
9128
60      14:30:20
 
9129
select * from t66 order by colint;
 
9130
colint  col1
 
9131
1       09:09:15
 
9132
2       04:30:01
 
9133
3       00:59:22
 
9134
4       05:30:34
 
9135
60      14:30:20
 
9136
alter table t11 drop partition p0;
 
9137
alter table t22 drop partition p0;
 
9138
alter table t44 drop partition p0;
 
9139
alter table t55 drop partition p0;
 
9140
alter table t66 drop partition p0;
 
9141
select * from t11 order by col1;
 
9142
col1
 
9143
10:22:33
 
9144
14:30:20
 
9145
select * from t22 order by col1;
 
9146
col1
 
9147
10:22:33
 
9148
14:30:20
 
9149
21:59:22
 
9150
select * from t33 order by col1;
 
9151
col1
 
9152
10:22:33
 
9153
14:30:20
 
9154
21:59:22
 
9155
select * from t44 order by colint;
 
9156
colint  col1
 
9157
60      14:30:20
 
9158
select * from t55 order by colint;
 
9159
colint  col1
 
9160
60      14:30:20
 
9161
select * from t66 order by colint;
 
9162
colint  col1
 
9163
60      14:30:20
 
9164
-------------------------
 
9165
---- some alter table end
 
9166
-------------------------
 
9167
drop table if exists t1 ;
 
9168
drop table if exists t2 ;
 
9169
drop table if exists t3 ;
 
9170
drop table if exists t4 ;
 
9171
drop table if exists t5 ;
 
9172
drop table if exists t6 ;
 
9173
drop table if exists t11 ;
 
9174
drop table if exists t22 ;
 
9175
drop table if exists t33 ;
 
9176
drop table if exists t44 ;
 
9177
drop table if exists t55 ;
 
9178
drop table if exists t66 ;
 
9179
-------------------------------------------------------------------------
 
9180
---  second(col1)  in partition with coltype  char(30)
 
9181
-------------------------------------------------------------------------
 
9182
drop table if exists t1 ;
 
9183
drop table if exists t2 ;
 
9184
drop table if exists t3 ;
 
9185
drop table if exists t4 ;
 
9186
drop table if exists t5 ;
 
9187
drop table if exists t6 ;
 
9188
-------------------------------------------------------------------------
 
9189
---  Create tables with second(col1)
 
9190
-------------------------------------------------------------------------
 
9191
create table t1 (col1 char(30)) engine='NDB' 
 
9192
partition by range(second(col1)) 
 
9193
(partition p0 values less than (15),
 
9194
partition p1 values less than maxvalue);
 
9195
create table t2 (col1 char(30)) engine='NDB' 
 
9196
partition by list(second(col1)) 
 
9197
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
9198
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
9199
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
9200
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
9201
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
9202
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
9203
);
 
9204
create table t3 (col1 char(30)) engine='NDB' 
 
9205
partition by hash(second(col1));
 
9206
create table t4 (colint int, col1 char(30)) engine='NDB' 
 
9207
partition by range(colint) 
 
9208
subpartition by hash(second(col1)) subpartitions 2 
 
9209
(partition p0 values less than (15),
 
9210
partition p1 values less than maxvalue);
 
9211
create table t5 (colint int, col1 char(30)) engine='NDB' 
 
9212
partition by list(colint)
 
9213
subpartition by hash(second(col1)) subpartitions 2 
 
9214
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
9215
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
9216
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
9217
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
9218
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
9219
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
9220
);
 
9221
create table t6 (colint int, col1 char(30)) engine='NDB' 
 
9222
partition by range(colint) 
 
9223
(partition p0 values less than (second('18:30:14')),
 
9224
partition p1 values less than maxvalue);
 
9225
-------------------------------------------------------------------------
 
9226
---  Access tables with second(col1) 
 
9227
-------------------------------------------------------------------------
 
9228
insert into t1 values ('09:09:09');
 
9229
insert into t1 values ('14:30:20');
 
9230
insert into t2 values ('09:09:09');
 
9231
insert into t2 values ('14:30:20');
 
9232
insert into t2 values ('21:59:22');
 
9233
insert into t3 values ('09:09:09');
 
9234
insert into t3 values ('14:30:20');
 
9235
insert into t3 values ('21:59:22');
 
9236
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t4;
 
9237
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t5;
 
9238
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t6;
 
9239
select second(col1) from t1 order by col1;
 
9240
second(col1)
 
9241
9
 
9242
20
 
9243
select * from t1 order by col1;
 
9244
col1
 
9245
09:09:09
 
9246
14:30:20
 
9247
select * from t2 order by col1;
 
9248
col1
 
9249
09:09:09
 
9250
14:30:20
 
9251
21:59:22
 
9252
select * from t3 order by col1;
 
9253
col1
 
9254
09:09:09
 
9255
14:30:20
 
9256
21:59:22
 
9257
select * from t4 order by colint;
 
9258
colint  col1
 
9259
1       09:09:15.000002
 
9260
2       04:30:01.000018
 
9261
3       00:59:22.000024
 
9262
4       05:30:34.000037
 
9263
select * from t5 order by colint;
 
9264
colint  col1
 
9265
1       09:09:15.000002
 
9266
2       04:30:01.000018
 
9267
3       00:59:22.000024
 
9268
4       05:30:34.000037
 
9269
select * from t6 order by colint;
 
9270
colint  col1
 
9271
1       09:09:15.000002
 
9272
2       04:30:01.000018
 
9273
3       00:59:22.000024
 
9274
4       05:30:34.000037
 
9275
update t1 set col1='10:22:33' where col1='09:09:09';
 
9276
update t2 set col1='10:22:33' where col1='09:09:09';
 
9277
update t3 set col1='10:22:33' where col1='09:09:09';
 
9278
update t4 set col1='10:22:33' where col1='09:09:09';
 
9279
update t5 set col1='10:22:33' where col1='09:09:09';
 
9280
update t6 set col1='10:22:33' where col1='09:09:09';
 
9281
select * from t1 order by col1;
 
9282
col1
 
9283
10:22:33
 
9284
14:30:20
 
9285
select * from t2 order by col1;
 
9286
col1
 
9287
10:22:33
 
9288
14:30:20
 
9289
21:59:22
 
9290
select * from t3 order by col1;
 
9291
col1
 
9292
10:22:33
 
9293
14:30:20
 
9294
21:59:22
 
9295
select * from t4 order by colint;
 
9296
colint  col1
 
9297
1       09:09:15.000002
 
9298
2       04:30:01.000018
 
9299
3       00:59:22.000024
 
9300
4       05:30:34.000037
 
9301
select * from t5 order by colint;
 
9302
colint  col1
 
9303
1       09:09:15.000002
 
9304
2       04:30:01.000018
 
9305
3       00:59:22.000024
 
9306
4       05:30:34.000037
 
9307
select * from t6 order by colint;
 
9308
colint  col1
 
9309
1       09:09:15.000002
 
9310
2       04:30:01.000018
 
9311
3       00:59:22.000024
 
9312
4       05:30:34.000037
 
9313
-------------------------------------------------------------------------
 
9314
---  Alter tables with second(col1)
 
9315
-------------------------------------------------------------------------
 
9316
drop table if exists t11 ;
 
9317
drop table if exists t22 ;
 
9318
drop table if exists t33 ;
 
9319
drop table if exists t44 ;
 
9320
drop table if exists t55 ;
 
9321
drop table if exists t66 ;
 
9322
create table t11 engine='NDB' as select * from t1;
 
9323
create table t22 engine='NDB' as select * from t2;
 
9324
create table t33 engine='NDB' as select * from t3;
 
9325
create table t44 engine='NDB' as select * from t4;
 
9326
create table t55 engine='NDB' as select * from t5;
 
9327
create table t66 engine='NDB' as select * from t6;
 
9328
alter table t11
 
9329
partition by range(second(col1)) 
 
9330
(partition p0 values less than (15),
 
9331
partition p1 values less than maxvalue);
 
9332
alter table t22
 
9333
partition by list(second(col1)) 
 
9334
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
9335
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
9336
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
9337
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
9338
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
9339
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
9340
);
 
9341
alter table t33
 
9342
partition by hash(second(col1));
 
9343
alter table t44
 
9344
partition by range(colint) 
 
9345
subpartition by hash(second(col1)) subpartitions 2 
 
9346
(partition p0 values less than (15),
 
9347
partition p1 values less than maxvalue);
 
9348
alter table t55
 
9349
partition by list(colint)
 
9350
subpartition by hash(second(col1)) subpartitions 2 
 
9351
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
9352
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
9353
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
9354
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
9355
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
9356
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
9357
);
 
9358
alter table t66
 
9359
partition by range(colint) 
 
9360
(partition p0 values less than (second('18:30:14')),
 
9361
partition p1 values less than maxvalue);
 
9362
select * from t11 order by col1;
 
9363
col1
 
9364
10:22:33
 
9365
14:30:20
 
9366
select * from t22 order by col1;
 
9367
col1
 
9368
10:22:33
 
9369
14:30:20
 
9370
21:59:22
 
9371
select * from t33 order by col1;
 
9372
col1
 
9373
10:22:33
 
9374
14:30:20
 
9375
21:59:22
 
9376
select * from t44 order by colint;
 
9377
colint  col1
 
9378
1       09:09:15.000002
 
9379
2       04:30:01.000018
 
9380
3       00:59:22.000024
 
9381
4       05:30:34.000037
 
9382
select * from t55 order by colint;
 
9383
colint  col1
 
9384
1       09:09:15.000002
 
9385
2       04:30:01.000018
 
9386
3       00:59:22.000024
 
9387
4       05:30:34.000037
 
9388
select * from t66 order by colint;
 
9389
colint  col1
 
9390
1       09:09:15.000002
 
9391
2       04:30:01.000018
 
9392
3       00:59:22.000024
 
9393
4       05:30:34.000037
 
9394
---------------------------
 
9395
---- some alter table begin
 
9396
---------------------------
 
9397
alter table t11
 
9398
reorganize partition p0,p1 into
 
9399
(partition s1 values less than maxvalue);
 
9400
select * from t11 order by col1;
 
9401
col1
 
9402
10:22:33
 
9403
14:30:20
 
9404
alter table t11
 
9405
reorganize partition s1 into
 
9406
(partition p0 values less than (15),
 
9407
partition p1 values less than maxvalue);
 
9408
select * from t11 order by col1;
 
9409
col1
 
9410
10:22:33
 
9411
14:30:20
 
9412
alter table t55
 
9413
partition by list(colint)
 
9414
subpartition by hash(second(col1)) subpartitions 5 
 
9415
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
9416
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
9417
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
9418
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
9419
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
9420
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
9421
);
 
9422
show create table t55;
 
9423
Table   Create Table
 
9424
t55     CREATE TABLE `t55` (
 
9425
  `colint` int(11) DEFAULT NULL,
 
9426
  `col1` char(30) DEFAULT NULL
 
9427
) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (second(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
 
9428
select * from t55 order by colint;
 
9429
colint  col1
 
9430
1       09:09:15.000002
 
9431
2       04:30:01.000018
 
9432
3       00:59:22.000024
 
9433
4       05:30:34.000037
 
9434
alter table t66
 
9435
reorganize partition p0,p1 into
 
9436
(partition s1 values less than maxvalue);
 
9437
select * from t66 order by colint;
 
9438
colint  col1
 
9439
1       09:09:15.000002
 
9440
2       04:30:01.000018
 
9441
3       00:59:22.000024
 
9442
4       05:30:34.000037
 
9443
alter table t66
 
9444
reorganize partition s1 into
 
9445
(partition p0 values less than (second('18:30:14')),
 
9446
partition p1 values less than maxvalue);
 
9447
select * from t66 order by colint;
 
9448
colint  col1
 
9449
1       09:09:15.000002
 
9450
2       04:30:01.000018
 
9451
3       00:59:22.000024
 
9452
4       05:30:34.000037
 
9453
alter table t66
 
9454
reorganize partition p0,p1 into
 
9455
(partition s1 values less than maxvalue);
 
9456
select * from t66 order by colint;
 
9457
colint  col1
 
9458
1       09:09:15.000002
 
9459
2       04:30:01.000018
 
9460
3       00:59:22.000024
 
9461
4       05:30:34.000037
 
9462
alter table t66
 
9463
reorganize partition s1 into
 
9464
(partition p0 values less than (second('18:30:14')),
 
9465
partition p1 values less than maxvalue);
 
9466
select * from t66 order by colint;
 
9467
colint  col1
 
9468
1       09:09:15.000002
 
9469
2       04:30:01.000018
 
9470
3       00:59:22.000024
 
9471
4       05:30:34.000037
 
9472
-------------------------------------------------------------------------
 
9473
---  Delete rows and partitions of tables with second(col1)
 
9474
-------------------------------------------------------------------------
 
9475
delete from t1 where col1='14:30:20';
 
9476
delete from t2 where col1='14:30:20';
 
9477
delete from t3 where col1='14:30:20';
 
9478
delete from t4 where col1='14:30:20';
 
9479
delete from t5 where col1='14:30:20';
 
9480
delete from t6 where col1='14:30:20';
 
9481
select * from t1 order by col1;
 
9482
col1
 
9483
10:22:33
 
9484
select * from t2 order by col1;
 
9485
col1
 
9486
10:22:33
 
9487
21:59:22
 
9488
select * from t3 order by col1;
 
9489
col1
 
9490
10:22:33
 
9491
21:59:22
 
9492
select * from t4 order by colint;
 
9493
colint  col1
 
9494
1       09:09:15.000002
 
9495
2       04:30:01.000018
 
9496
3       00:59:22.000024
 
9497
4       05:30:34.000037
 
9498
select * from t5 order by colint;
 
9499
colint  col1
 
9500
1       09:09:15.000002
 
9501
2       04:30:01.000018
 
9502
3       00:59:22.000024
 
9503
4       05:30:34.000037
 
9504
insert into t1 values ('14:30:20');
 
9505
insert into t2 values ('14:30:20');
 
9506
insert into t3 values ('14:30:20');
 
9507
insert into t4 values (60,'14:30:20');
 
9508
insert into t5 values (60,'14:30:20');
 
9509
insert into t6 values (60,'14:30:20');
 
9510
select * from t1 order by col1;
 
9511
col1
 
9512
10:22:33
 
9513
14:30:20
 
9514
select * from t2 order by col1;
 
9515
col1
 
9516
10:22:33
 
9517
14:30:20
 
9518
21:59:22
 
9519
select * from t3 order by col1;
 
9520
col1
 
9521
10:22:33
 
9522
14:30:20
 
9523
21:59:22
 
9524
select * from t4 order by colint;
 
9525
colint  col1
 
9526
1       09:09:15.000002
 
9527
2       04:30:01.000018
 
9528
3       00:59:22.000024
 
9529
4       05:30:34.000037
 
9530
60      14:30:20
 
9531
select * from t5 order by colint;
 
9532
colint  col1
 
9533
1       09:09:15.000002
 
9534
2       04:30:01.000018
 
9535
3       00:59:22.000024
 
9536
4       05:30:34.000037
 
9537
60      14:30:20
 
9538
select * from t6 order by colint;
 
9539
colint  col1
 
9540
1       09:09:15.000002
 
9541
2       04:30:01.000018
 
9542
3       00:59:22.000024
 
9543
4       05:30:34.000037
 
9544
60      14:30:20
 
9545
alter table t1 drop partition p0;
 
9546
alter table t2 drop partition p0;
 
9547
alter table t4 drop partition p0;
 
9548
alter table t5 drop partition p0;
 
9549
alter table t6 drop partition p0;
 
9550
select * from t1 order by col1;
 
9551
col1
 
9552
10:22:33
 
9553
14:30:20
 
9554
select * from t2 order by col1;
 
9555
col1
 
9556
10:22:33
 
9557
14:30:20
 
9558
21:59:22
 
9559
select * from t3 order by col1;
 
9560
col1
 
9561
10:22:33
 
9562
14:30:20
 
9563
21:59:22
 
9564
select * from t4 order by colint;
 
9565
colint  col1
 
9566
60      14:30:20
 
9567
select * from t5 order by colint;
 
9568
colint  col1
 
9569
60      14:30:20
 
9570
select * from t6 order by colint;
 
9571
colint  col1
 
9572
60      14:30:20
 
9573
-------------------------------------------------------------------------
 
9574
---  Delete rows and partitions of tables with second(col1)
 
9575
-------------------------------------------------------------------------
 
9576
delete from t11 where col1='14:30:20';
 
9577
delete from t22 where col1='14:30:20';
 
9578
delete from t33 where col1='14:30:20';
 
9579
delete from t44 where col1='14:30:20';
 
9580
delete from t55 where col1='14:30:20';
 
9581
delete from t66 where col1='14:30:20';
 
9582
select * from t11 order by col1;
 
9583
col1
 
9584
10:22:33
 
9585
select * from t22 order by col1;
 
9586
col1
 
9587
10:22:33
 
9588
21:59:22
 
9589
select * from t33 order by col1;
 
9590
col1
 
9591
10:22:33
 
9592
21:59:22
 
9593
select * from t44 order by colint;
 
9594
colint  col1
 
9595
1       09:09:15.000002
 
9596
2       04:30:01.000018
 
9597
3       00:59:22.000024
 
9598
4       05:30:34.000037
 
9599
select * from t55 order by colint;
 
9600
colint  col1
 
9601
1       09:09:15.000002
 
9602
2       04:30:01.000018
 
9603
3       00:59:22.000024
 
9604
4       05:30:34.000037
 
9605
insert into t11 values ('14:30:20');
 
9606
insert into t22 values ('14:30:20');
 
9607
insert into t33 values ('14:30:20');
 
9608
insert into t44 values (60,'14:30:20');
 
9609
insert into t55 values (60,'14:30:20');
 
9610
insert into t66 values (60,'14:30:20');
 
9611
select * from t11 order by col1;
 
9612
col1
 
9613
10:22:33
 
9614
14:30:20
 
9615
select * from t22 order by col1;
 
9616
col1
 
9617
10:22:33
 
9618
14:30:20
 
9619
21:59:22
 
9620
select * from t33 order by col1;
 
9621
col1
 
9622
10:22:33
 
9623
14:30:20
 
9624
21:59:22
 
9625
select * from t44 order by colint;
 
9626
colint  col1
 
9627
1       09:09:15.000002
 
9628
2       04:30:01.000018
 
9629
3       00:59:22.000024
 
9630
4       05:30:34.000037
 
9631
60      14:30:20
 
9632
select * from t55 order by colint;
 
9633
colint  col1
 
9634
1       09:09:15.000002
 
9635
2       04:30:01.000018
 
9636
3       00:59:22.000024
 
9637
4       05:30:34.000037
 
9638
60      14:30:20
 
9639
select * from t66 order by colint;
 
9640
colint  col1
 
9641
1       09:09:15.000002
 
9642
2       04:30:01.000018
 
9643
3       00:59:22.000024
 
9644
4       05:30:34.000037
 
9645
60      14:30:20
 
9646
alter table t11 drop partition p0;
 
9647
alter table t22 drop partition p0;
 
9648
alter table t44 drop partition p0;
 
9649
alter table t55 drop partition p0;
 
9650
alter table t66 drop partition p0;
 
9651
select * from t11 order by col1;
 
9652
col1
 
9653
10:22:33
 
9654
14:30:20
 
9655
select * from t22 order by col1;
 
9656
col1
 
9657
10:22:33
 
9658
14:30:20
 
9659
21:59:22
 
9660
select * from t33 order by col1;
 
9661
col1
 
9662
10:22:33
 
9663
14:30:20
 
9664
21:59:22
 
9665
select * from t44 order by colint;
 
9666
colint  col1
 
9667
60      14:30:20
 
9668
select * from t55 order by colint;
 
9669
colint  col1
 
9670
60      14:30:20
 
9671
select * from t66 order by colint;
 
9672
colint  col1
 
9673
60      14:30:20
 
9674
-------------------------
 
9675
---- some alter table end
 
9676
-------------------------
 
9677
drop table if exists t1 ;
 
9678
drop table if exists t2 ;
 
9679
drop table if exists t3 ;
 
9680
drop table if exists t4 ;
 
9681
drop table if exists t5 ;
 
9682
drop table if exists t6 ;
 
9683
drop table if exists t11 ;
 
9684
drop table if exists t22 ;
 
9685
drop table if exists t33 ;
 
9686
drop table if exists t44 ;
 
9687
drop table if exists t55 ;
 
9688
drop table if exists t66 ;
 
9689
-------------------------------------------------------------------------
 
9690
---  month(col1)  in partition with coltype  date
 
9691
-------------------------------------------------------------------------
 
9692
drop table if exists t1 ;
 
9693
drop table if exists t2 ;
 
9694
drop table if exists t3 ;
 
9695
drop table if exists t4 ;
 
9696
drop table if exists t5 ;
 
9697
drop table if exists t6 ;
 
9698
-------------------------------------------------------------------------
 
9699
---  Create tables with month(col1)
 
9700
-------------------------------------------------------------------------
 
9701
create table t1 (col1 date) engine='NDB' 
 
9702
partition by range(month(col1)) 
 
9703
(partition p0 values less than (15),
 
9704
partition p1 values less than maxvalue);
 
9705
create table t2 (col1 date) engine='NDB' 
 
9706
partition by list(month(col1)) 
 
9707
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
9708
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
9709
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
9710
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
9711
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
9712
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
9713
);
 
9714
create table t3 (col1 date) engine='NDB' 
 
9715
partition by hash(month(col1));
 
9716
create table t4 (colint int, col1 date) engine='NDB' 
 
9717
partition by range(colint) 
 
9718
subpartition by hash(month(col1)) subpartitions 2 
 
9719
(partition p0 values less than (15),
 
9720
partition p1 values less than maxvalue);
 
9721
create table t5 (colint int, col1 date) engine='NDB' 
 
9722
partition by list(colint)
 
9723
subpartition by hash(month(col1)) subpartitions 2 
 
9724
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
9725
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
9726
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
9727
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
9728
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
9729
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
9730
);
 
9731
create table t6 (colint int, col1 date) engine='NDB' 
 
9732
partition by range(colint) 
 
9733
(partition p0 values less than (month('2006-10-14')),
 
9734
partition p1 values less than maxvalue);
 
9735
-------------------------------------------------------------------------
 
9736
---  Access tables with month(col1) 
 
9737
-------------------------------------------------------------------------
 
9738
insert into t1 values ('2006-01-03');
 
9739
insert into t1 values ('2006-12-17');
 
9740
insert into t2 values ('2006-01-03');
 
9741
insert into t2 values ('2006-12-17');
 
9742
insert into t2 values ('2006-05-25');
 
9743
insert into t3 values ('2006-01-03');
 
9744
insert into t3 values ('2006-12-17');
 
9745
insert into t3 values ('2006-05-25');
 
9746
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
 
9747
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
 
9748
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
 
9749
select month(col1) from t1 order by col1;
 
9750
month(col1)
 
9751
1
 
9752
12
 
9753
select * from t1 order by col1;
 
9754
col1
 
9755
2006-01-03
 
9756
2006-12-17
 
9757
select * from t2 order by col1;
 
9758
col1
 
9759
2006-01-03
 
9760
2006-05-25
 
9761
2006-12-17
 
9762
select * from t3 order by col1;
 
9763
col1
 
9764
2006-01-03
 
9765
2006-05-25
 
9766
2006-12-17
 
9767
select * from t4 order by colint;
 
9768
colint  col1
 
9769
1       2006-02-03
 
9770
2       2006-01-17
 
9771
3       2006-01-25
 
9772
4       2006-02-05
 
9773
select * from t5 order by colint;
 
9774
colint  col1
 
9775
1       2006-02-03
 
9776
2       2006-01-17
 
9777
3       2006-01-25
 
9778
4       2006-02-05
 
9779
select * from t6 order by colint;
 
9780
colint  col1
 
9781
1       2006-02-03
 
9782
2       2006-01-17
 
9783
3       2006-01-25
 
9784
4       2006-02-05
 
9785
update t1 set col1='2006-11-06' where col1='2006-01-03';
 
9786
update t2 set col1='2006-11-06' where col1='2006-01-03';
 
9787
update t3 set col1='2006-11-06' where col1='2006-01-03';
 
9788
update t4 set col1='2006-11-06' where col1='2006-01-03';
 
9789
update t5 set col1='2006-11-06' where col1='2006-01-03';
 
9790
update t6 set col1='2006-11-06' where col1='2006-01-03';
 
9791
select * from t1 order by col1;
 
9792
col1
 
9793
2006-11-06
 
9794
2006-12-17
 
9795
select * from t2 order by col1;
 
9796
col1
 
9797
2006-05-25
 
9798
2006-11-06
 
9799
2006-12-17
 
9800
select * from t3 order by col1;
 
9801
col1
 
9802
2006-05-25
 
9803
2006-11-06
 
9804
2006-12-17
 
9805
select * from t4 order by colint;
 
9806
colint  col1
 
9807
1       2006-02-03
 
9808
2       2006-01-17
 
9809
3       2006-01-25
 
9810
4       2006-02-05
 
9811
select * from t5 order by colint;
 
9812
colint  col1
 
9813
1       2006-02-03
 
9814
2       2006-01-17
 
9815
3       2006-01-25
 
9816
4       2006-02-05
 
9817
select * from t6 order by colint;
 
9818
colint  col1
 
9819
1       2006-02-03
 
9820
2       2006-01-17
 
9821
3       2006-01-25
 
9822
4       2006-02-05
 
9823
-------------------------------------------------------------------------
 
9824
---  Alter tables with month(col1)
 
9825
-------------------------------------------------------------------------
 
9826
drop table if exists t11 ;
 
9827
drop table if exists t22 ;
 
9828
drop table if exists t33 ;
 
9829
drop table if exists t44 ;
 
9830
drop table if exists t55 ;
 
9831
drop table if exists t66 ;
 
9832
create table t11 engine='NDB' as select * from t1;
 
9833
create table t22 engine='NDB' as select * from t2;
 
9834
create table t33 engine='NDB' as select * from t3;
 
9835
create table t44 engine='NDB' as select * from t4;
 
9836
create table t55 engine='NDB' as select * from t5;
 
9837
create table t66 engine='NDB' as select * from t6;
 
9838
alter table t11
 
9839
partition by range(month(col1)) 
 
9840
(partition p0 values less than (15),
 
9841
partition p1 values less than maxvalue);
 
9842
alter table t22
 
9843
partition by list(month(col1)) 
 
9844
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
9845
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
9846
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
9847
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
9848
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
9849
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
9850
);
 
9851
alter table t33
 
9852
partition by hash(month(col1));
 
9853
alter table t44
 
9854
partition by range(colint) 
 
9855
subpartition by hash(month(col1)) subpartitions 2 
 
9856
(partition p0 values less than (15),
 
9857
partition p1 values less than maxvalue);
 
9858
alter table t55
 
9859
partition by list(colint)
 
9860
subpartition by hash(month(col1)) subpartitions 2 
 
9861
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
9862
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
9863
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
9864
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
9865
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
9866
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
9867
);
 
9868
alter table t66
 
9869
partition by range(colint) 
 
9870
(partition p0 values less than (month('2006-10-14')),
 
9871
partition p1 values less than maxvalue);
 
9872
select * from t11 order by col1;
 
9873
col1
 
9874
2006-11-06
 
9875
2006-12-17
 
9876
select * from t22 order by col1;
 
9877
col1
 
9878
2006-05-25
 
9879
2006-11-06
 
9880
2006-12-17
 
9881
select * from t33 order by col1;
 
9882
col1
 
9883
2006-05-25
 
9884
2006-11-06
 
9885
2006-12-17
 
9886
select * from t44 order by colint;
 
9887
colint  col1
 
9888
1       2006-02-03
 
9889
2       2006-01-17
 
9890
3       2006-01-25
 
9891
4       2006-02-05
 
9892
select * from t55 order by colint;
 
9893
colint  col1
 
9894
1       2006-02-03
 
9895
2       2006-01-17
 
9896
3       2006-01-25
 
9897
4       2006-02-05
 
9898
select * from t66 order by colint;
 
9899
colint  col1
 
9900
1       2006-02-03
 
9901
2       2006-01-17
 
9902
3       2006-01-25
 
9903
4       2006-02-05
 
9904
---------------------------
 
9905
---- some alter table begin
 
9906
---------------------------
 
9907
alter table t11
 
9908
reorganize partition p0,p1 into
 
9909
(partition s1 values less than maxvalue);
 
9910
select * from t11 order by col1;
 
9911
col1
 
9912
2006-11-06
 
9913
2006-12-17
 
9914
alter table t11
 
9915
reorganize partition s1 into
 
9916
(partition p0 values less than (15),
 
9917
partition p1 values less than maxvalue);
 
9918
select * from t11 order by col1;
 
9919
col1
 
9920
2006-11-06
 
9921
2006-12-17
 
9922
alter table t55
 
9923
partition by list(colint)
 
9924
subpartition by hash(month(col1)) subpartitions 5 
 
9925
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
9926
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
9927
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
9928
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
9929
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
9930
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
9931
);
 
9932
show create table t55;
 
9933
Table   Create Table
 
9934
t55     CREATE TABLE `t55` (
 
9935
  `colint` int(11) DEFAULT NULL,
 
9936
  `col1` date DEFAULT NULL
 
9937
) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (month(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
 
9938
select * from t55 order by colint;
 
9939
colint  col1
 
9940
1       2006-02-03
 
9941
2       2006-01-17
 
9942
3       2006-01-25
 
9943
4       2006-02-05
 
9944
alter table t66
 
9945
reorganize partition p0,p1 into
 
9946
(partition s1 values less than maxvalue);
 
9947
select * from t66 order by colint;
 
9948
colint  col1
 
9949
1       2006-02-03
 
9950
2       2006-01-17
 
9951
3       2006-01-25
 
9952
4       2006-02-05
 
9953
alter table t66
 
9954
reorganize partition s1 into
 
9955
(partition p0 values less than (month('2006-10-14')),
 
9956
partition p1 values less than maxvalue);
 
9957
select * from t66 order by colint;
 
9958
colint  col1
 
9959
1       2006-02-03
 
9960
2       2006-01-17
 
9961
3       2006-01-25
 
9962
4       2006-02-05
 
9963
alter table t66
 
9964
reorganize partition p0,p1 into
 
9965
(partition s1 values less than maxvalue);
 
9966
select * from t66 order by colint;
 
9967
colint  col1
 
9968
1       2006-02-03
 
9969
2       2006-01-17
 
9970
3       2006-01-25
 
9971
4       2006-02-05
 
9972
alter table t66
 
9973
reorganize partition s1 into
 
9974
(partition p0 values less than (month('2006-10-14')),
 
9975
partition p1 values less than maxvalue);
 
9976
select * from t66 order by colint;
 
9977
colint  col1
 
9978
1       2006-02-03
 
9979
2       2006-01-17
 
9980
3       2006-01-25
 
9981
4       2006-02-05
 
9982
-------------------------------------------------------------------------
 
9983
---  Delete rows and partitions of tables with month(col1)
 
9984
-------------------------------------------------------------------------
 
9985
delete from t1 where col1='2006-12-17';
 
9986
delete from t2 where col1='2006-12-17';
 
9987
delete from t3 where col1='2006-12-17';
 
9988
delete from t4 where col1='2006-12-17';
 
9989
delete from t5 where col1='2006-12-17';
 
9990
delete from t6 where col1='2006-12-17';
 
9991
select * from t1 order by col1;
 
9992
col1
 
9993
2006-11-06
 
9994
select * from t2 order by col1;
 
9995
col1
 
9996
2006-05-25
 
9997
2006-11-06
 
9998
select * from t3 order by col1;
 
9999
col1
 
10000
2006-05-25
 
10001
2006-11-06
 
10002
select * from t4 order by colint;
 
10003
colint  col1
 
10004
1       2006-02-03
 
10005
2       2006-01-17
 
10006
3       2006-01-25
 
10007
4       2006-02-05
 
10008
select * from t5 order by colint;
 
10009
colint  col1
 
10010
1       2006-02-03
 
10011
2       2006-01-17
 
10012
3       2006-01-25
 
10013
4       2006-02-05
 
10014
insert into t1 values ('2006-12-17');
 
10015
insert into t2 values ('2006-12-17');
 
10016
insert into t3 values ('2006-12-17');
 
10017
insert into t4 values (60,'2006-12-17');
 
10018
insert into t5 values (60,'2006-12-17');
 
10019
insert into t6 values (60,'2006-12-17');
 
10020
select * from t1 order by col1;
 
10021
col1
 
10022
2006-11-06
 
10023
2006-12-17
 
10024
select * from t2 order by col1;
 
10025
col1
 
10026
2006-05-25
 
10027
2006-11-06
 
10028
2006-12-17
 
10029
select * from t3 order by col1;
 
10030
col1
 
10031
2006-05-25
 
10032
2006-11-06
 
10033
2006-12-17
 
10034
select * from t4 order by colint;
 
10035
colint  col1
 
10036
1       2006-02-03
 
10037
2       2006-01-17
 
10038
3       2006-01-25
 
10039
4       2006-02-05
 
10040
60      2006-12-17
 
10041
select * from t5 order by colint;
 
10042
colint  col1
 
10043
1       2006-02-03
 
10044
2       2006-01-17
 
10045
3       2006-01-25
 
10046
4       2006-02-05
 
10047
60      2006-12-17
 
10048
select * from t6 order by colint;
 
10049
colint  col1
 
10050
1       2006-02-03
 
10051
2       2006-01-17
 
10052
3       2006-01-25
 
10053
4       2006-02-05
 
10054
60      2006-12-17
 
10055
alter table t1 drop partition p0;
 
10056
alter table t2 drop partition p0;
 
10057
alter table t4 drop partition p0;
 
10058
alter table t5 drop partition p0;
 
10059
alter table t6 drop partition p0;
 
10060
select * from t1 order by col1;
 
10061
col1
 
10062
select * from t2 order by col1;
 
10063
col1
 
10064
2006-11-06
 
10065
2006-12-17
 
10066
select * from t3 order by col1;
 
10067
col1
 
10068
2006-05-25
 
10069
2006-11-06
 
10070
2006-12-17
 
10071
select * from t4 order by colint;
 
10072
colint  col1
 
10073
60      2006-12-17
 
10074
select * from t5 order by colint;
 
10075
colint  col1
 
10076
60      2006-12-17
 
10077
select * from t6 order by colint;
 
10078
colint  col1
 
10079
60      2006-12-17
 
10080
-------------------------------------------------------------------------
 
10081
---  Delete rows and partitions of tables with month(col1)
 
10082
-------------------------------------------------------------------------
 
10083
delete from t11 where col1='2006-12-17';
 
10084
delete from t22 where col1='2006-12-17';
 
10085
delete from t33 where col1='2006-12-17';
 
10086
delete from t44 where col1='2006-12-17';
 
10087
delete from t55 where col1='2006-12-17';
 
10088
delete from t66 where col1='2006-12-17';
 
10089
select * from t11 order by col1;
 
10090
col1
 
10091
2006-11-06
 
10092
select * from t22 order by col1;
 
10093
col1
 
10094
2006-05-25
 
10095
2006-11-06
 
10096
select * from t33 order by col1;
 
10097
col1
 
10098
2006-05-25
 
10099
2006-11-06
 
10100
select * from t44 order by colint;
 
10101
colint  col1
 
10102
1       2006-02-03
 
10103
2       2006-01-17
 
10104
3       2006-01-25
 
10105
4       2006-02-05
 
10106
select * from t55 order by colint;
 
10107
colint  col1
 
10108
1       2006-02-03
 
10109
2       2006-01-17
 
10110
3       2006-01-25
 
10111
4       2006-02-05
 
10112
insert into t11 values ('2006-12-17');
 
10113
insert into t22 values ('2006-12-17');
 
10114
insert into t33 values ('2006-12-17');
 
10115
insert into t44 values (60,'2006-12-17');
 
10116
insert into t55 values (60,'2006-12-17');
 
10117
insert into t66 values (60,'2006-12-17');
 
10118
select * from t11 order by col1;
 
10119
col1
 
10120
2006-11-06
 
10121
2006-12-17
 
10122
select * from t22 order by col1;
 
10123
col1
 
10124
2006-05-25
 
10125
2006-11-06
 
10126
2006-12-17
 
10127
select * from t33 order by col1;
 
10128
col1
 
10129
2006-05-25
 
10130
2006-11-06
 
10131
2006-12-17
 
10132
select * from t44 order by colint;
 
10133
colint  col1
 
10134
1       2006-02-03
 
10135
2       2006-01-17
 
10136
3       2006-01-25
 
10137
4       2006-02-05
 
10138
60      2006-12-17
 
10139
select * from t55 order by colint;
 
10140
colint  col1
 
10141
1       2006-02-03
 
10142
2       2006-01-17
 
10143
3       2006-01-25
 
10144
4       2006-02-05
 
10145
60      2006-12-17
 
10146
select * from t66 order by colint;
 
10147
colint  col1
 
10148
1       2006-02-03
 
10149
2       2006-01-17
 
10150
3       2006-01-25
 
10151
4       2006-02-05
 
10152
60      2006-12-17
 
10153
alter table t11 drop partition p0;
 
10154
alter table t22 drop partition p0;
 
10155
alter table t44 drop partition p0;
 
10156
alter table t55 drop partition p0;
 
10157
alter table t66 drop partition p0;
 
10158
select * from t11 order by col1;
 
10159
col1
 
10160
select * from t22 order by col1;
 
10161
col1
 
10162
2006-11-06
 
10163
2006-12-17
 
10164
select * from t33 order by col1;
 
10165
col1
 
10166
2006-05-25
 
10167
2006-11-06
 
10168
2006-12-17
 
10169
select * from t44 order by colint;
 
10170
colint  col1
 
10171
60      2006-12-17
 
10172
select * from t55 order by colint;
 
10173
colint  col1
 
10174
60      2006-12-17
 
10175
select * from t66 order by colint;
 
10176
colint  col1
 
10177
60      2006-12-17
 
10178
-------------------------
 
10179
---- some alter table end
 
10180
-------------------------
 
10181
drop table if exists t1 ;
 
10182
drop table if exists t2 ;
 
10183
drop table if exists t3 ;
 
10184
drop table if exists t4 ;
 
10185
drop table if exists t5 ;
 
10186
drop table if exists t6 ;
 
10187
drop table if exists t11 ;
 
10188
drop table if exists t22 ;
 
10189
drop table if exists t33 ;
 
10190
drop table if exists t44 ;
 
10191
drop table if exists t55 ;
 
10192
drop table if exists t66 ;
 
10193
-------------------------------------------------------------------------
 
10194
---  quarter(col1)  in partition with coltype  date
 
10195
-------------------------------------------------------------------------
 
10196
drop table if exists t1 ;
 
10197
drop table if exists t2 ;
 
10198
drop table if exists t3 ;
 
10199
drop table if exists t4 ;
 
10200
drop table if exists t5 ;
 
10201
drop table if exists t6 ;
 
10202
-------------------------------------------------------------------------
 
10203
---  Create tables with quarter(col1)
 
10204
-------------------------------------------------------------------------
 
10205
create table t1 (col1 date) engine='NDB' 
 
10206
partition by range(quarter(col1)) 
 
10207
(partition p0 values less than (15),
 
10208
partition p1 values less than maxvalue);
 
10209
create table t2 (col1 date) engine='NDB' 
 
10210
partition by list(quarter(col1)) 
 
10211
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
10212
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
10213
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
10214
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
10215
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
10216
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
10217
);
 
10218
create table t3 (col1 date) engine='NDB' 
 
10219
partition by hash(quarter(col1));
 
10220
create table t4 (colint int, col1 date) engine='NDB' 
 
10221
partition by range(colint) 
 
10222
subpartition by hash(quarter(col1)) subpartitions 2 
 
10223
(partition p0 values less than (15),
 
10224
partition p1 values less than maxvalue);
 
10225
create table t5 (colint int, col1 date) engine='NDB' 
 
10226
partition by list(colint)
 
10227
subpartition by hash(quarter(col1)) subpartitions 2 
 
10228
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
10229
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
10230
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
10231
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
10232
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
10233
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
10234
);
 
10235
create table t6 (colint int, col1 date) engine='NDB' 
 
10236
partition by range(colint) 
 
10237
(partition p0 values less than (quarter('2006-10-14')),
 
10238
partition p1 values less than maxvalue);
 
10239
-------------------------------------------------------------------------
 
10240
---  Access tables with quarter(col1) 
 
10241
-------------------------------------------------------------------------
 
10242
insert into t1 values ('2006-01-03');
 
10243
insert into t1 values ('2006-12-17');
 
10244
insert into t2 values ('2006-01-03');
 
10245
insert into t2 values ('2006-12-17');
 
10246
insert into t2 values ('2006-09-25');
 
10247
insert into t3 values ('2006-01-03');
 
10248
insert into t3 values ('2006-12-17');
 
10249
insert into t3 values ('2006-09-25');
 
10250
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
 
10251
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
 
10252
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
 
10253
select quarter(col1) from t1 order by col1;
 
10254
quarter(col1)
 
10255
1
 
10256
4
 
10257
select * from t1 order by col1;
 
10258
col1
 
10259
2006-01-03
 
10260
2006-12-17
 
10261
select * from t2 order by col1;
 
10262
col1
 
10263
2006-01-03
 
10264
2006-09-25
 
10265
2006-12-17
 
10266
select * from t3 order by col1;
 
10267
col1
 
10268
2006-01-03
 
10269
2006-09-25
 
10270
2006-12-17
 
10271
select * from t4 order by colint;
 
10272
colint  col1
 
10273
1       2006-02-03
 
10274
2       2006-01-17
 
10275
3       2006-01-25
 
10276
4       2006-02-05
 
10277
select * from t5 order by colint;
 
10278
colint  col1
 
10279
1       2006-02-03
 
10280
2       2006-01-17
 
10281
3       2006-01-25
 
10282
4       2006-02-05
 
10283
select * from t6 order by colint;
 
10284
colint  col1
 
10285
1       2006-02-03
 
10286
2       2006-01-17
 
10287
3       2006-01-25
 
10288
4       2006-02-05
 
10289
update t1 set col1='2006-07-30' where col1='2006-01-03';
 
10290
update t2 set col1='2006-07-30' where col1='2006-01-03';
 
10291
update t3 set col1='2006-07-30' where col1='2006-01-03';
 
10292
update t4 set col1='2006-07-30' where col1='2006-01-03';
 
10293
update t5 set col1='2006-07-30' where col1='2006-01-03';
 
10294
update t6 set col1='2006-07-30' where col1='2006-01-03';
 
10295
select * from t1 order by col1;
 
10296
col1
 
10297
2006-07-30
 
10298
2006-12-17
 
10299
select * from t2 order by col1;
 
10300
col1
 
10301
2006-07-30
 
10302
2006-09-25
 
10303
2006-12-17
 
10304
select * from t3 order by col1;
 
10305
col1
 
10306
2006-07-30
 
10307
2006-09-25
 
10308
2006-12-17
 
10309
select * from t4 order by colint;
 
10310
colint  col1
 
10311
1       2006-02-03
 
10312
2       2006-01-17
 
10313
3       2006-01-25
 
10314
4       2006-02-05
 
10315
select * from t5 order by colint;
 
10316
colint  col1
 
10317
1       2006-02-03
 
10318
2       2006-01-17
 
10319
3       2006-01-25
 
10320
4       2006-02-05
 
10321
select * from t6 order by colint;
 
10322
colint  col1
 
10323
1       2006-02-03
 
10324
2       2006-01-17
 
10325
3       2006-01-25
 
10326
4       2006-02-05
 
10327
-------------------------------------------------------------------------
 
10328
---  Alter tables with quarter(col1)
 
10329
-------------------------------------------------------------------------
 
10330
drop table if exists t11 ;
 
10331
drop table if exists t22 ;
 
10332
drop table if exists t33 ;
 
10333
drop table if exists t44 ;
 
10334
drop table if exists t55 ;
 
10335
drop table if exists t66 ;
 
10336
create table t11 engine='NDB' as select * from t1;
 
10337
create table t22 engine='NDB' as select * from t2;
 
10338
create table t33 engine='NDB' as select * from t3;
 
10339
create table t44 engine='NDB' as select * from t4;
 
10340
create table t55 engine='NDB' as select * from t5;
 
10341
create table t66 engine='NDB' as select * from t6;
 
10342
alter table t11
 
10343
partition by range(quarter(col1)) 
 
10344
(partition p0 values less than (15),
 
10345
partition p1 values less than maxvalue);
 
10346
alter table t22
 
10347
partition by list(quarter(col1)) 
 
10348
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
10349
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
10350
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
10351
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
10352
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
10353
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
10354
);
 
10355
alter table t33
 
10356
partition by hash(quarter(col1));
 
10357
alter table t44
 
10358
partition by range(colint) 
 
10359
subpartition by hash(quarter(col1)) subpartitions 2 
 
10360
(partition p0 values less than (15),
 
10361
partition p1 values less than maxvalue);
 
10362
alter table t55
 
10363
partition by list(colint)
 
10364
subpartition by hash(quarter(col1)) subpartitions 2 
 
10365
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
10366
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
10367
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
10368
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
10369
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
10370
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
10371
);
 
10372
alter table t66
 
10373
partition by range(colint) 
 
10374
(partition p0 values less than (quarter('2006-10-14')),
 
10375
partition p1 values less than maxvalue);
 
10376
select * from t11 order by col1;
 
10377
col1
 
10378
2006-07-30
 
10379
2006-12-17
 
10380
select * from t22 order by col1;
 
10381
col1
 
10382
2006-07-30
 
10383
2006-09-25
 
10384
2006-12-17
 
10385
select * from t33 order by col1;
 
10386
col1
 
10387
2006-07-30
 
10388
2006-09-25
 
10389
2006-12-17
 
10390
select * from t44 order by colint;
 
10391
colint  col1
 
10392
1       2006-02-03
 
10393
2       2006-01-17
 
10394
3       2006-01-25
 
10395
4       2006-02-05
 
10396
select * from t55 order by colint;
 
10397
colint  col1
 
10398
1       2006-02-03
 
10399
2       2006-01-17
 
10400
3       2006-01-25
 
10401
4       2006-02-05
 
10402
select * from t66 order by colint;
 
10403
colint  col1
 
10404
1       2006-02-03
 
10405
2       2006-01-17
 
10406
3       2006-01-25
 
10407
4       2006-02-05
 
10408
---------------------------
 
10409
---- some alter table begin
 
10410
---------------------------
 
10411
alter table t11
 
10412
reorganize partition p0,p1 into
 
10413
(partition s1 values less than maxvalue);
 
10414
select * from t11 order by col1;
 
10415
col1
 
10416
2006-07-30
 
10417
2006-12-17
 
10418
alter table t11
 
10419
reorganize partition s1 into
 
10420
(partition p0 values less than (15),
 
10421
partition p1 values less than maxvalue);
 
10422
select * from t11 order by col1;
 
10423
col1
 
10424
2006-07-30
 
10425
2006-12-17
 
10426
alter table t55
 
10427
partition by list(colint)
 
10428
subpartition by hash(quarter(col1)) subpartitions 5 
 
10429
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
10430
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
10431
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
10432
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
10433
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
10434
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
10435
);
 
10436
show create table t55;
 
10437
Table   Create Table
 
10438
t55     CREATE TABLE `t55` (
 
10439
  `colint` int(11) DEFAULT NULL,
 
10440
  `col1` date DEFAULT NULL
 
10441
) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (quarter(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
 
10442
select * from t55 order by colint;
 
10443
colint  col1
 
10444
1       2006-02-03
 
10445
2       2006-01-17
 
10446
3       2006-01-25
 
10447
4       2006-02-05
 
10448
alter table t66
 
10449
reorganize partition p0,p1 into
 
10450
(partition s1 values less than maxvalue);
 
10451
select * from t66 order by colint;
 
10452
colint  col1
 
10453
1       2006-02-03
 
10454
2       2006-01-17
 
10455
3       2006-01-25
 
10456
4       2006-02-05
 
10457
alter table t66
 
10458
reorganize partition s1 into
 
10459
(partition p0 values less than (quarter('2006-10-14')),
 
10460
partition p1 values less than maxvalue);
 
10461
select * from t66 order by colint;
 
10462
colint  col1
 
10463
1       2006-02-03
 
10464
2       2006-01-17
 
10465
3       2006-01-25
 
10466
4       2006-02-05
 
10467
alter table t66
 
10468
reorganize partition p0,p1 into
 
10469
(partition s1 values less than maxvalue);
 
10470
select * from t66 order by colint;
 
10471
colint  col1
 
10472
1       2006-02-03
 
10473
2       2006-01-17
 
10474
3       2006-01-25
 
10475
4       2006-02-05
 
10476
alter table t66
 
10477
reorganize partition s1 into
 
10478
(partition p0 values less than (quarter('2006-10-14')),
 
10479
partition p1 values less than maxvalue);
 
10480
select * from t66 order by colint;
 
10481
colint  col1
 
10482
1       2006-02-03
 
10483
2       2006-01-17
 
10484
3       2006-01-25
 
10485
4       2006-02-05
 
10486
-------------------------------------------------------------------------
 
10487
---  Delete rows and partitions of tables with quarter(col1)
 
10488
-------------------------------------------------------------------------
 
10489
delete from t1 where col1='2006-12-17';
 
10490
delete from t2 where col1='2006-12-17';
 
10491
delete from t3 where col1='2006-12-17';
 
10492
delete from t4 where col1='2006-12-17';
 
10493
delete from t5 where col1='2006-12-17';
 
10494
delete from t6 where col1='2006-12-17';
 
10495
select * from t1 order by col1;
 
10496
col1
 
10497
2006-07-30
 
10498
select * from t2 order by col1;
 
10499
col1
 
10500
2006-07-30
 
10501
2006-09-25
 
10502
select * from t3 order by col1;
 
10503
col1
 
10504
2006-07-30
 
10505
2006-09-25
 
10506
select * from t4 order by colint;
 
10507
colint  col1
 
10508
1       2006-02-03
 
10509
2       2006-01-17
 
10510
3       2006-01-25
 
10511
4       2006-02-05
 
10512
select * from t5 order by colint;
 
10513
colint  col1
 
10514
1       2006-02-03
 
10515
2       2006-01-17
 
10516
3       2006-01-25
 
10517
4       2006-02-05
 
10518
insert into t1 values ('2006-12-17');
 
10519
insert into t2 values ('2006-12-17');
 
10520
insert into t3 values ('2006-12-17');
 
10521
insert into t4 values (60,'2006-12-17');
 
10522
insert into t5 values (60,'2006-12-17');
 
10523
insert into t6 values (60,'2006-12-17');
 
10524
select * from t1 order by col1;
 
10525
col1
 
10526
2006-07-30
 
10527
2006-12-17
 
10528
select * from t2 order by col1;
 
10529
col1
 
10530
2006-07-30
 
10531
2006-09-25
 
10532
2006-12-17
 
10533
select * from t3 order by col1;
 
10534
col1
 
10535
2006-07-30
 
10536
2006-09-25
 
10537
2006-12-17
 
10538
select * from t4 order by colint;
 
10539
colint  col1
 
10540
1       2006-02-03
 
10541
2       2006-01-17
 
10542
3       2006-01-25
 
10543
4       2006-02-05
 
10544
60      2006-12-17
 
10545
select * from t5 order by colint;
 
10546
colint  col1
 
10547
1       2006-02-03
 
10548
2       2006-01-17
 
10549
3       2006-01-25
 
10550
4       2006-02-05
 
10551
60      2006-12-17
 
10552
select * from t6 order by colint;
 
10553
colint  col1
 
10554
1       2006-02-03
 
10555
2       2006-01-17
 
10556
3       2006-01-25
 
10557
4       2006-02-05
 
10558
60      2006-12-17
 
10559
alter table t1 drop partition p0;
 
10560
alter table t2 drop partition p0;
 
10561
alter table t4 drop partition p0;
 
10562
alter table t5 drop partition p0;
 
10563
alter table t6 drop partition p0;
 
10564
select * from t1 order by col1;
 
10565
col1
 
10566
select * from t2 order by col1;
 
10567
col1
 
10568
select * from t3 order by col1;
 
10569
col1
 
10570
2006-07-30
 
10571
2006-09-25
 
10572
2006-12-17
 
10573
select * from t4 order by colint;
 
10574
colint  col1
 
10575
60      2006-12-17
 
10576
select * from t5 order by colint;
 
10577
colint  col1
 
10578
60      2006-12-17
 
10579
select * from t6 order by colint;
 
10580
colint  col1
 
10581
4       2006-02-05
 
10582
60      2006-12-17
 
10583
-------------------------------------------------------------------------
 
10584
---  Delete rows and partitions of tables with quarter(col1)
 
10585
-------------------------------------------------------------------------
 
10586
delete from t11 where col1='2006-12-17';
 
10587
delete from t22 where col1='2006-12-17';
 
10588
delete from t33 where col1='2006-12-17';
 
10589
delete from t44 where col1='2006-12-17';
 
10590
delete from t55 where col1='2006-12-17';
 
10591
delete from t66 where col1='2006-12-17';
 
10592
select * from t11 order by col1;
 
10593
col1
 
10594
2006-07-30
 
10595
select * from t22 order by col1;
 
10596
col1
 
10597
2006-07-30
 
10598
2006-09-25
 
10599
select * from t33 order by col1;
 
10600
col1
 
10601
2006-07-30
 
10602
2006-09-25
 
10603
select * from t44 order by colint;
 
10604
colint  col1
 
10605
1       2006-02-03
 
10606
2       2006-01-17
 
10607
3       2006-01-25
 
10608
4       2006-02-05
 
10609
select * from t55 order by colint;
 
10610
colint  col1
 
10611
1       2006-02-03
 
10612
2       2006-01-17
 
10613
3       2006-01-25
 
10614
4       2006-02-05
 
10615
insert into t11 values ('2006-12-17');
 
10616
insert into t22 values ('2006-12-17');
 
10617
insert into t33 values ('2006-12-17');
 
10618
insert into t44 values (60,'2006-12-17');
 
10619
insert into t55 values (60,'2006-12-17');
 
10620
insert into t66 values (60,'2006-12-17');
 
10621
select * from t11 order by col1;
 
10622
col1
 
10623
2006-07-30
 
10624
2006-12-17
 
10625
select * from t22 order by col1;
 
10626
col1
 
10627
2006-07-30
 
10628
2006-09-25
 
10629
2006-12-17
 
10630
select * from t33 order by col1;
 
10631
col1
 
10632
2006-07-30
 
10633
2006-09-25
 
10634
2006-12-17
 
10635
select * from t44 order by colint;
 
10636
colint  col1
 
10637
1       2006-02-03
 
10638
2       2006-01-17
 
10639
3       2006-01-25
 
10640
4       2006-02-05
 
10641
60      2006-12-17
 
10642
select * from t55 order by colint;
 
10643
colint  col1
 
10644
1       2006-02-03
 
10645
2       2006-01-17
 
10646
3       2006-01-25
 
10647
4       2006-02-05
 
10648
60      2006-12-17
 
10649
select * from t66 order by colint;
 
10650
colint  col1
 
10651
1       2006-02-03
 
10652
2       2006-01-17
 
10653
3       2006-01-25
 
10654
4       2006-02-05
 
10655
60      2006-12-17
 
10656
alter table t11 drop partition p0;
 
10657
alter table t22 drop partition p0;
 
10658
alter table t44 drop partition p0;
 
10659
alter table t55 drop partition p0;
 
10660
alter table t66 drop partition p0;
 
10661
select * from t11 order by col1;
 
10662
col1
 
10663
select * from t22 order by col1;
 
10664
col1
 
10665
select * from t33 order by col1;
 
10666
col1
 
10667
2006-07-30
 
10668
2006-09-25
 
10669
2006-12-17
 
10670
select * from t44 order by colint;
 
10671
colint  col1
 
10672
60      2006-12-17
 
10673
select * from t55 order by colint;
 
10674
colint  col1
 
10675
60      2006-12-17
 
10676
select * from t66 order by colint;
 
10677
colint  col1
 
10678
4       2006-02-05
 
10679
60      2006-12-17
 
10680
-------------------------
 
10681
---- some alter table end
 
10682
-------------------------
 
10683
drop table if exists t1 ;
 
10684
drop table if exists t2 ;
 
10685
drop table if exists t3 ;
 
10686
drop table if exists t4 ;
 
10687
drop table if exists t5 ;
 
10688
drop table if exists t6 ;
 
10689
drop table if exists t11 ;
 
10690
drop table if exists t22 ;
 
10691
drop table if exists t33 ;
 
10692
drop table if exists t44 ;
 
10693
drop table if exists t55 ;
 
10694
drop table if exists t66 ;
 
10695
-------------------------------------------------------------------------
 
10696
---  time_to_sec(col1)-(time_to_sec(col1)-20)  in partition with coltype  time
 
10697
-------------------------------------------------------------------------
 
10698
drop table if exists t1 ;
 
10699
drop table if exists t2 ;
 
10700
drop table if exists t3 ;
 
10701
drop table if exists t4 ;
 
10702
drop table if exists t5 ;
 
10703
drop table if exists t6 ;
 
10704
-------------------------------------------------------------------------
 
10705
---  Create tables with time_to_sec(col1)-(time_to_sec(col1)-20)
 
10706
-------------------------------------------------------------------------
 
10707
create table t1 (col1 time) engine='NDB' 
 
10708
partition by range(time_to_sec(col1)-(time_to_sec(col1)-20)) 
 
10709
(partition p0 values less than (15),
 
10710
partition p1 values less than maxvalue);
 
10711
create table t2 (col1 time) engine='NDB' 
 
10712
partition by list(time_to_sec(col1)-(time_to_sec(col1)-20)) 
 
10713
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
10714
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
10715
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
10716
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
10717
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
10718
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
10719
);
 
10720
create table t3 (col1 time) engine='NDB' 
 
10721
partition by hash(time_to_sec(col1)-(time_to_sec(col1)-20));
 
10722
create table t4 (colint int, col1 time) engine='NDB' 
 
10723
partition by range(colint) 
 
10724
subpartition by hash(time_to_sec(col1)-(time_to_sec(col1)-20)) subpartitions 2 
 
10725
(partition p0 values less than (15),
 
10726
partition p1 values less than maxvalue);
 
10727
create table t5 (colint int, col1 time) engine='NDB' 
 
10728
partition by list(colint)
 
10729
subpartition by hash(time_to_sec(col1)-(time_to_sec(col1)-20)) subpartitions 2 
 
10730
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
10731
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
10732
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
10733
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
10734
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
10735
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
10736
);
 
10737
create table t6 (colint int, col1 time) engine='NDB' 
 
10738
partition by range(colint) 
 
10739
(partition p0 values less than (time_to_sec('18:30:14')-(time_to_sec('17:59:59'))),
 
10740
partition p1 values less than maxvalue);
 
10741
-------------------------------------------------------------------------
 
10742
---  Access tables with time_to_sec(col1)-(time_to_sec(col1)-20) 
 
10743
-------------------------------------------------------------------------
 
10744
insert into t1 values ('09:09:15');
 
10745
insert into t1 values ('14:30:45');
 
10746
insert into t2 values ('09:09:15');
 
10747
insert into t2 values ('14:30:45');
 
10748
insert into t2 values ('21:59:22');
 
10749
insert into t3 values ('09:09:15');
 
10750
insert into t3 values ('14:30:45');
 
10751
insert into t3 values ('21:59:22');
 
10752
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t4;
 
10753
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t5;
 
10754
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t6;
 
10755
select time_to_sec(col1)-(time_to_sec(col1)-20) from t1 order by col1;
 
10756
time_to_sec(col1)-(time_to_sec(col1)-20)
 
10757
20
 
10758
20
 
10759
select * from t1 order by col1;
 
10760
col1
 
10761
09:09:15
 
10762
14:30:45
 
10763
select * from t2 order by col1;
 
10764
col1
 
10765
09:09:15
 
10766
14:30:45
 
10767
21:59:22
 
10768
select * from t3 order by col1;
 
10769
col1
 
10770
09:09:15
 
10771
14:30:45
 
10772
21:59:22
 
10773
select * from t4 order by colint;
 
10774
colint  col1
 
10775
1       09:09:15
 
10776
2       04:30:01
 
10777
3       00:59:22
 
10778
4       05:30:34
 
10779
select * from t5 order by colint;
 
10780
colint  col1
 
10781
1       09:09:15
 
10782
2       04:30:01
 
10783
3       00:59:22
 
10784
4       05:30:34
 
10785
select * from t6 order by colint;
 
10786
colint  col1
 
10787
1       09:09:15
 
10788
2       04:30:01
 
10789
3       00:59:22
 
10790
4       05:30:34
 
10791
update t1 set col1='10:33:11' where col1='09:09:15';
 
10792
update t2 set col1='10:33:11' where col1='09:09:15';
 
10793
update t3 set col1='10:33:11' where col1='09:09:15';
 
10794
update t4 set col1='10:33:11' where col1='09:09:15';
 
10795
update t5 set col1='10:33:11' where col1='09:09:15';
 
10796
update t6 set col1='10:33:11' where col1='09:09:15';
 
10797
select * from t1 order by col1;
 
10798
col1
 
10799
10:33:11
 
10800
14:30:45
 
10801
select * from t2 order by col1;
 
10802
col1
 
10803
10:33:11
 
10804
14:30:45
 
10805
21:59:22
 
10806
select * from t3 order by col1;
 
10807
col1
 
10808
10:33:11
 
10809
14:30:45
 
10810
21:59:22
 
10811
select * from t4 order by colint;
 
10812
colint  col1
 
10813
1       10:33:11
 
10814
2       04:30:01
 
10815
3       00:59:22
 
10816
4       05:30:34
 
10817
select * from t5 order by colint;
 
10818
colint  col1
 
10819
1       10:33:11
 
10820
2       04:30:01
 
10821
3       00:59:22
 
10822
4       05:30:34
 
10823
select * from t6 order by colint;
 
10824
colint  col1
 
10825
1       10:33:11
 
10826
2       04:30:01
 
10827
3       00:59:22
 
10828
4       05:30:34
 
10829
-------------------------------------------------------------------------
 
10830
---  Alter tables with time_to_sec(col1)-(time_to_sec(col1)-20)
 
10831
-------------------------------------------------------------------------
 
10832
drop table if exists t11 ;
 
10833
drop table if exists t22 ;
 
10834
drop table if exists t33 ;
 
10835
drop table if exists t44 ;
 
10836
drop table if exists t55 ;
 
10837
drop table if exists t66 ;
 
10838
create table t11 engine='NDB' as select * from t1;
 
10839
create table t22 engine='NDB' as select * from t2;
 
10840
create table t33 engine='NDB' as select * from t3;
 
10841
create table t44 engine='NDB' as select * from t4;
 
10842
create table t55 engine='NDB' as select * from t5;
 
10843
create table t66 engine='NDB' as select * from t6;
 
10844
alter table t11
 
10845
partition by range(time_to_sec(col1)-(time_to_sec(col1)-20)) 
 
10846
(partition p0 values less than (15),
 
10847
partition p1 values less than maxvalue);
 
10848
alter table t22
 
10849
partition by list(time_to_sec(col1)-(time_to_sec(col1)-20)) 
 
10850
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
10851
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
10852
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
10853
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
10854
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
10855
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
10856
);
 
10857
alter table t33
 
10858
partition by hash(time_to_sec(col1)-(time_to_sec(col1)-20));
 
10859
alter table t44
 
10860
partition by range(colint) 
 
10861
subpartition by hash(time_to_sec(col1)-(time_to_sec(col1)-20)) subpartitions 2 
 
10862
(partition p0 values less than (15),
 
10863
partition p1 values less than maxvalue);
 
10864
alter table t55
 
10865
partition by list(colint)
 
10866
subpartition by hash(time_to_sec(col1)-(time_to_sec(col1)-20)) subpartitions 2 
 
10867
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
10868
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
10869
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
10870
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
10871
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
10872
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
10873
);
 
10874
alter table t66
 
10875
partition by range(colint) 
 
10876
(partition p0 values less than (time_to_sec('18:30:14')-(time_to_sec('17:59:59'))),
 
10877
partition p1 values less than maxvalue);
 
10878
select * from t11 order by col1;
 
10879
col1
 
10880
10:33:11
 
10881
14:30:45
 
10882
select * from t22 order by col1;
 
10883
col1
 
10884
10:33:11
 
10885
14:30:45
 
10886
21:59:22
 
10887
select * from t33 order by col1;
 
10888
col1
 
10889
10:33:11
 
10890
14:30:45
 
10891
21:59:22
 
10892
select * from t44 order by colint;
 
10893
colint  col1
 
10894
1       10:33:11
 
10895
2       04:30:01
 
10896
3       00:59:22
 
10897
4       05:30:34
 
10898
select * from t55 order by colint;
 
10899
colint  col1
 
10900
1       10:33:11
 
10901
2       04:30:01
 
10902
3       00:59:22
 
10903
4       05:30:34
 
10904
select * from t66 order by colint;
 
10905
colint  col1
 
10906
1       10:33:11
 
10907
2       04:30:01
 
10908
3       00:59:22
 
10909
4       05:30:34
 
10910
---------------------------
 
10911
---- some alter table begin
 
10912
---------------------------
 
10913
alter table t11
 
10914
reorganize partition p0,p1 into
 
10915
(partition s1 values less than maxvalue);
 
10916
select * from t11 order by col1;
 
10917
col1
 
10918
10:33:11
 
10919
14:30:45
 
10920
alter table t11
 
10921
reorganize partition s1 into
 
10922
(partition p0 values less than (15),
 
10923
partition p1 values less than maxvalue);
 
10924
select * from t11 order by col1;
 
10925
col1
 
10926
10:33:11
 
10927
14:30:45
 
10928
alter table t55
 
10929
partition by list(colint)
 
10930
subpartition by hash(time_to_sec(col1)-(time_to_sec(col1)-20)) subpartitions 5 
 
10931
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
10932
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
10933
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
10934
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
10935
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
10936
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
10937
);
 
10938
show create table t55;
 
10939
Table   Create Table
 
10940
t55     CREATE TABLE `t55` (
 
10941
  `colint` int(11) DEFAULT NULL,
 
10942
  `col1` time DEFAULT NULL
 
10943
) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (time_to_sec(col1)-(time_to_sec(col1)-20)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
 
10944
select * from t55 order by colint;
 
10945
colint  col1
 
10946
1       10:33:11
 
10947
2       04:30:01
 
10948
3       00:59:22
 
10949
4       05:30:34
 
10950
alter table t66
 
10951
reorganize partition p0,p1 into
 
10952
(partition s1 values less than maxvalue);
 
10953
select * from t66 order by colint;
 
10954
colint  col1
 
10955
1       10:33:11
 
10956
2       04:30:01
 
10957
3       00:59:22
 
10958
4       05:30:34
 
10959
alter table t66
 
10960
reorganize partition s1 into
 
10961
(partition p0 values less than (time_to_sec('18:30:14')-(time_to_sec('17:59:59'))),
 
10962
partition p1 values less than maxvalue);
 
10963
select * from t66 order by colint;
 
10964
colint  col1
 
10965
1       10:33:11
 
10966
2       04:30:01
 
10967
3       00:59:22
 
10968
4       05:30:34
 
10969
alter table t66
 
10970
reorganize partition p0,p1 into
 
10971
(partition s1 values less than maxvalue);
 
10972
select * from t66 order by colint;
 
10973
colint  col1
 
10974
1       10:33:11
 
10975
2       04:30:01
 
10976
3       00:59:22
 
10977
4       05:30:34
 
10978
alter table t66
 
10979
reorganize partition s1 into
 
10980
(partition p0 values less than (time_to_sec('18:30:14')-(time_to_sec('17:59:59'))),
 
10981
partition p1 values less than maxvalue);
 
10982
select * from t66 order by colint;
 
10983
colint  col1
 
10984
1       10:33:11
 
10985
2       04:30:01
 
10986
3       00:59:22
 
10987
4       05:30:34
 
10988
-------------------------------------------------------------------------
 
10989
---  Delete rows and partitions of tables with time_to_sec(col1)-(time_to_sec(col1)-20)
 
10990
-------------------------------------------------------------------------
 
10991
delete from t1 where col1='14:30:45';
 
10992
delete from t2 where col1='14:30:45';
 
10993
delete from t3 where col1='14:30:45';
 
10994
delete from t4 where col1='14:30:45';
 
10995
delete from t5 where col1='14:30:45';
 
10996
delete from t6 where col1='14:30:45';
 
10997
select * from t1 order by col1;
 
10998
col1
 
10999
10:33:11
 
11000
select * from t2 order by col1;
 
11001
col1
 
11002
10:33:11
 
11003
21:59:22
 
11004
select * from t3 order by col1;
 
11005
col1
 
11006
10:33:11
 
11007
21:59:22
 
11008
select * from t4 order by colint;
 
11009
colint  col1
 
11010
1       10:33:11
 
11011
2       04:30:01
 
11012
3       00:59:22
 
11013
4       05:30:34
 
11014
select * from t5 order by colint;
 
11015
colint  col1
 
11016
1       10:33:11
 
11017
2       04:30:01
 
11018
3       00:59:22
 
11019
4       05:30:34
 
11020
insert into t1 values ('14:30:45');
 
11021
insert into t2 values ('14:30:45');
 
11022
insert into t3 values ('14:30:45');
 
11023
insert into t4 values (60,'14:30:45');
 
11024
insert into t5 values (60,'14:30:45');
 
11025
insert into t6 values (60,'14:30:45');
 
11026
select * from t1 order by col1;
 
11027
col1
 
11028
10:33:11
 
11029
14:30:45
 
11030
select * from t2 order by col1;
 
11031
col1
 
11032
10:33:11
 
11033
14:30:45
 
11034
21:59:22
 
11035
select * from t3 order by col1;
 
11036
col1
 
11037
10:33:11
 
11038
14:30:45
 
11039
21:59:22
 
11040
select * from t4 order by colint;
 
11041
colint  col1
 
11042
1       10:33:11
 
11043
2       04:30:01
 
11044
3       00:59:22
 
11045
4       05:30:34
 
11046
60      14:30:45
 
11047
select * from t5 order by colint;
 
11048
colint  col1
 
11049
1       10:33:11
 
11050
2       04:30:01
 
11051
3       00:59:22
 
11052
4       05:30:34
 
11053
60      14:30:45
 
11054
select * from t6 order by colint;
 
11055
colint  col1
 
11056
1       10:33:11
 
11057
2       04:30:01
 
11058
3       00:59:22
 
11059
4       05:30:34
 
11060
60      14:30:45
 
11061
alter table t1 drop partition p0;
 
11062
alter table t2 drop partition p0;
 
11063
alter table t4 drop partition p0;
 
11064
alter table t5 drop partition p0;
 
11065
alter table t6 drop partition p0;
 
11066
select * from t1 order by col1;
 
11067
col1
 
11068
10:33:11
 
11069
14:30:45
 
11070
select * from t2 order by col1;
 
11071
col1
 
11072
10:33:11
 
11073
14:30:45
 
11074
21:59:22
 
11075
select * from t3 order by col1;
 
11076
col1
 
11077
10:33:11
 
11078
14:30:45
 
11079
21:59:22
 
11080
select * from t4 order by colint;
 
11081
colint  col1
 
11082
60      14:30:45
 
11083
select * from t5 order by colint;
 
11084
colint  col1
 
11085
60      14:30:45
 
11086
select * from t6 order by colint;
 
11087
colint  col1
 
11088
-------------------------------------------------------------------------
 
11089
---  Delete rows and partitions of tables with time_to_sec(col1)-(time_to_sec(col1)-20)
 
11090
-------------------------------------------------------------------------
 
11091
delete from t11 where col1='14:30:45';
 
11092
delete from t22 where col1='14:30:45';
 
11093
delete from t33 where col1='14:30:45';
 
11094
delete from t44 where col1='14:30:45';
 
11095
delete from t55 where col1='14:30:45';
 
11096
delete from t66 where col1='14:30:45';
 
11097
select * from t11 order by col1;
 
11098
col1
 
11099
10:33:11
 
11100
select * from t22 order by col1;
 
11101
col1
 
11102
10:33:11
 
11103
21:59:22
 
11104
select * from t33 order by col1;
 
11105
col1
 
11106
10:33:11
 
11107
21:59:22
 
11108
select * from t44 order by colint;
 
11109
colint  col1
 
11110
1       10:33:11
 
11111
2       04:30:01
 
11112
3       00:59:22
 
11113
4       05:30:34
 
11114
select * from t55 order by colint;
 
11115
colint  col1
 
11116
1       10:33:11
 
11117
2       04:30:01
 
11118
3       00:59:22
 
11119
4       05:30:34
 
11120
insert into t11 values ('14:30:45');
 
11121
insert into t22 values ('14:30:45');
 
11122
insert into t33 values ('14:30:45');
 
11123
insert into t44 values (60,'14:30:45');
 
11124
insert into t55 values (60,'14:30:45');
 
11125
insert into t66 values (60,'14:30:45');
 
11126
select * from t11 order by col1;
 
11127
col1
 
11128
10:33:11
 
11129
14:30:45
 
11130
select * from t22 order by col1;
 
11131
col1
 
11132
10:33:11
 
11133
14:30:45
 
11134
21:59:22
 
11135
select * from t33 order by col1;
 
11136
col1
 
11137
10:33:11
 
11138
14:30:45
 
11139
21:59:22
 
11140
select * from t44 order by colint;
 
11141
colint  col1
 
11142
1       10:33:11
 
11143
2       04:30:01
 
11144
3       00:59:22
 
11145
4       05:30:34
 
11146
60      14:30:45
 
11147
select * from t55 order by colint;
 
11148
colint  col1
 
11149
1       10:33:11
 
11150
2       04:30:01
 
11151
3       00:59:22
 
11152
4       05:30:34
 
11153
60      14:30:45
 
11154
select * from t66 order by colint;
 
11155
colint  col1
 
11156
1       10:33:11
 
11157
2       04:30:01
 
11158
3       00:59:22
 
11159
4       05:30:34
 
11160
60      14:30:45
 
11161
alter table t11 drop partition p0;
 
11162
alter table t22 drop partition p0;
 
11163
alter table t44 drop partition p0;
 
11164
alter table t55 drop partition p0;
 
11165
alter table t66 drop partition p0;
 
11166
select * from t11 order by col1;
 
11167
col1
 
11168
10:33:11
 
11169
14:30:45
 
11170
select * from t22 order by col1;
 
11171
col1
 
11172
10:33:11
 
11173
14:30:45
 
11174
21:59:22
 
11175
select * from t33 order by col1;
 
11176
col1
 
11177
10:33:11
 
11178
14:30:45
 
11179
21:59:22
 
11180
select * from t44 order by colint;
 
11181
colint  col1
 
11182
60      14:30:45
 
11183
select * from t55 order by colint;
 
11184
colint  col1
 
11185
60      14:30:45
 
11186
select * from t66 order by colint;
 
11187
colint  col1
 
11188
-------------------------
 
11189
---- some alter table end
 
11190
-------------------------
 
11191
drop table if exists t1 ;
 
11192
drop table if exists t2 ;
 
11193
drop table if exists t3 ;
 
11194
drop table if exists t4 ;
 
11195
drop table if exists t5 ;
 
11196
drop table if exists t6 ;
 
11197
drop table if exists t11 ;
 
11198
drop table if exists t22 ;
 
11199
drop table if exists t33 ;
 
11200
drop table if exists t44 ;
 
11201
drop table if exists t55 ;
 
11202
drop table if exists t66 ;
 
11203
-------------------------------------------------------------------------
 
11204
---  to_days(col1)-to_days('2006-01-01')  in partition with coltype  date
 
11205
-------------------------------------------------------------------------
 
11206
drop table if exists t1 ;
 
11207
drop table if exists t2 ;
 
11208
drop table if exists t3 ;
 
11209
drop table if exists t4 ;
 
11210
drop table if exists t5 ;
 
11211
drop table if exists t6 ;
 
11212
-------------------------------------------------------------------------
 
11213
---  Create tables with to_days(col1)-to_days('2006-01-01')
 
11214
-------------------------------------------------------------------------
 
11215
create table t1 (col1 date) engine='NDB' 
 
11216
partition by range(to_days(col1)-to_days('2006-01-01')) 
 
11217
(partition p0 values less than (15),
 
11218
partition p1 values less than maxvalue);
 
11219
create table t2 (col1 date) engine='NDB' 
 
11220
partition by list(to_days(col1)-to_days('2006-01-01')) 
 
11221
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
11222
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
11223
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
11224
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
11225
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
11226
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
11227
);
 
11228
create table t3 (col1 date) engine='NDB' 
 
11229
partition by hash(to_days(col1)-to_days('2006-01-01'));
 
11230
create table t4 (colint int, col1 date) engine='NDB' 
 
11231
partition by range(colint) 
 
11232
subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 2 
 
11233
(partition p0 values less than (15),
 
11234
partition p1 values less than maxvalue);
 
11235
create table t5 (colint int, col1 date) engine='NDB' 
 
11236
partition by list(colint)
 
11237
subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 2 
 
11238
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
11239
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
11240
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
11241
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
11242
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
11243
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
11244
);
 
11245
create table t6 (colint int, col1 date) engine='NDB' 
 
11246
partition by range(colint) 
 
11247
(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')),
 
11248
partition p1 values less than maxvalue);
 
11249
-------------------------------------------------------------------------
 
11250
---  Access tables with to_days(col1)-to_days('2006-01-01') 
 
11251
-------------------------------------------------------------------------
 
11252
insert into t1 values ('2006-02-03');
 
11253
insert into t1 values ('2006-01-17');
 
11254
insert into t2 values ('2006-02-03');
 
11255
insert into t2 values ('2006-01-17');
 
11256
insert into t2 values ('2006-01-25');
 
11257
insert into t3 values ('2006-02-03');
 
11258
insert into t3 values ('2006-01-17');
 
11259
insert into t3 values ('2006-01-25');
 
11260
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
 
11261
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
 
11262
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
 
11263
select to_days(col1)-to_days('2006-01-01') from t1 order by col1;
 
11264
to_days(col1)-to_days('2006-01-01')
 
11265
16
 
11266
33
 
11267
select * from t1 order by col1;
 
11268
col1
 
11269
2006-01-17
 
11270
2006-02-03
 
11271
select * from t2 order by col1;
 
11272
col1
 
11273
2006-01-17
 
11274
2006-01-25
 
11275
2006-02-03
 
11276
select * from t3 order by col1;
 
11277
col1
 
11278
2006-01-17
 
11279
2006-01-25
 
11280
2006-02-03
 
11281
select * from t4 order by colint;
 
11282
colint  col1
 
11283
1       2006-02-03
 
11284
2       2006-01-17
 
11285
3       2006-01-25
 
11286
4       2006-02-05
 
11287
select * from t5 order by colint;
 
11288
colint  col1
 
11289
1       2006-02-03
 
11290
2       2006-01-17
 
11291
3       2006-01-25
 
11292
4       2006-02-05
 
11293
select * from t6 order by colint;
 
11294
colint  col1
 
11295
1       2006-02-03
 
11296
2       2006-01-17
 
11297
3       2006-01-25
 
11298
4       2006-02-05
 
11299
update t1 set col1='2006-02-06' where col1='2006-02-03';
 
11300
update t2 set col1='2006-02-06' where col1='2006-02-03';
 
11301
update t3 set col1='2006-02-06' where col1='2006-02-03';
 
11302
update t4 set col1='2006-02-06' where col1='2006-02-03';
 
11303
update t5 set col1='2006-02-06' where col1='2006-02-03';
 
11304
update t6 set col1='2006-02-06' where col1='2006-02-03';
 
11305
select * from t1 order by col1;
 
11306
col1
 
11307
2006-01-17
 
11308
2006-02-06
 
11309
select * from t2 order by col1;
 
11310
col1
 
11311
2006-01-17
 
11312
2006-01-25
 
11313
2006-02-06
 
11314
select * from t3 order by col1;
 
11315
col1
 
11316
2006-01-17
 
11317
2006-01-25
 
11318
2006-02-06
 
11319
select * from t4 order by colint;
 
11320
colint  col1
 
11321
1       2006-02-06
 
11322
2       2006-01-17
 
11323
3       2006-01-25
 
11324
4       2006-02-05
 
11325
select * from t5 order by colint;
 
11326
colint  col1
 
11327
1       2006-02-06
 
11328
2       2006-01-17
 
11329
3       2006-01-25
 
11330
4       2006-02-05
 
11331
select * from t6 order by colint;
 
11332
colint  col1
 
11333
1       2006-02-06
 
11334
2       2006-01-17
 
11335
3       2006-01-25
 
11336
4       2006-02-05
 
11337
-------------------------------------------------------------------------
 
11338
---  Alter tables with to_days(col1)-to_days('2006-01-01')
 
11339
-------------------------------------------------------------------------
 
11340
drop table if exists t11 ;
 
11341
drop table if exists t22 ;
 
11342
drop table if exists t33 ;
 
11343
drop table if exists t44 ;
 
11344
drop table if exists t55 ;
 
11345
drop table if exists t66 ;
 
11346
create table t11 engine='NDB' as select * from t1;
 
11347
create table t22 engine='NDB' as select * from t2;
 
11348
create table t33 engine='NDB' as select * from t3;
 
11349
create table t44 engine='NDB' as select * from t4;
 
11350
create table t55 engine='NDB' as select * from t5;
 
11351
create table t66 engine='NDB' as select * from t6;
 
11352
alter table t11
 
11353
partition by range(to_days(col1)-to_days('2006-01-01')) 
 
11354
(partition p0 values less than (15),
 
11355
partition p1 values less than maxvalue);
 
11356
alter table t22
 
11357
partition by list(to_days(col1)-to_days('2006-01-01')) 
 
11358
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
11359
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
11360
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
11361
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
11362
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
11363
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
11364
);
 
11365
alter table t33
 
11366
partition by hash(to_days(col1)-to_days('2006-01-01'));
 
11367
alter table t44
 
11368
partition by range(colint) 
 
11369
subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 2 
 
11370
(partition p0 values less than (15),
 
11371
partition p1 values less than maxvalue);
 
11372
alter table t55
 
11373
partition by list(colint)
 
11374
subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 2 
 
11375
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
11376
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
11377
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
11378
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
11379
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
11380
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
11381
);
 
11382
alter table t66
 
11383
partition by range(colint) 
 
11384
(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')),
 
11385
partition p1 values less than maxvalue);
 
11386
select * from t11 order by col1;
 
11387
col1
 
11388
2006-01-17
 
11389
2006-02-06
 
11390
select * from t22 order by col1;
 
11391
col1
 
11392
2006-01-17
 
11393
2006-01-25
 
11394
2006-02-06
 
11395
select * from t33 order by col1;
 
11396
col1
 
11397
2006-01-17
 
11398
2006-01-25
 
11399
2006-02-06
 
11400
select * from t44 order by colint;
 
11401
colint  col1
 
11402
1       2006-02-06
 
11403
2       2006-01-17
 
11404
3       2006-01-25
 
11405
4       2006-02-05
 
11406
select * from t55 order by colint;
 
11407
colint  col1
 
11408
1       2006-02-06
 
11409
2       2006-01-17
 
11410
3       2006-01-25
 
11411
4       2006-02-05
 
11412
select * from t66 order by colint;
 
11413
colint  col1
 
11414
1       2006-02-06
 
11415
2       2006-01-17
 
11416
3       2006-01-25
 
11417
4       2006-02-05
 
11418
---------------------------
 
11419
---- some alter table begin
 
11420
---------------------------
 
11421
alter table t11
 
11422
reorganize partition p0,p1 into
 
11423
(partition s1 values less than maxvalue);
 
11424
select * from t11 order by col1;
 
11425
col1
 
11426
2006-01-17
 
11427
2006-02-06
 
11428
alter table t11
 
11429
reorganize partition s1 into
 
11430
(partition p0 values less than (15),
 
11431
partition p1 values less than maxvalue);
 
11432
select * from t11 order by col1;
 
11433
col1
 
11434
2006-01-17
 
11435
2006-02-06
 
11436
alter table t55
 
11437
partition by list(colint)
 
11438
subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 5 
 
11439
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
11440
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
11441
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
11442
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
11443
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
11444
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
11445
);
 
11446
show create table t55;
 
11447
Table   Create Table
 
11448
t55     CREATE TABLE `t55` (
 
11449
  `colint` int(11) DEFAULT NULL,
 
11450
  `col1` date DEFAULT NULL
 
11451
) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (to_days(col1)-to_days('2006-01-01')) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
 
11452
select * from t55 order by colint;
 
11453
colint  col1
 
11454
1       2006-02-06
 
11455
2       2006-01-17
 
11456
3       2006-01-25
 
11457
4       2006-02-05
 
11458
alter table t66
 
11459
reorganize partition p0,p1 into
 
11460
(partition s1 values less than maxvalue);
 
11461
select * from t66 order by colint;
 
11462
colint  col1
 
11463
1       2006-02-06
 
11464
2       2006-01-17
 
11465
3       2006-01-25
 
11466
4       2006-02-05
 
11467
alter table t66
 
11468
reorganize partition s1 into
 
11469
(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')),
 
11470
partition p1 values less than maxvalue);
 
11471
select * from t66 order by colint;
 
11472
colint  col1
 
11473
1       2006-02-06
 
11474
2       2006-01-17
 
11475
3       2006-01-25
 
11476
4       2006-02-05
 
11477
alter table t66
 
11478
reorganize partition p0,p1 into
 
11479
(partition s1 values less than maxvalue);
 
11480
select * from t66 order by colint;
 
11481
colint  col1
 
11482
1       2006-02-06
 
11483
2       2006-01-17
 
11484
3       2006-01-25
 
11485
4       2006-02-05
 
11486
alter table t66
 
11487
reorganize partition s1 into
 
11488
(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')),
 
11489
partition p1 values less than maxvalue);
 
11490
select * from t66 order by colint;
 
11491
colint  col1
 
11492
1       2006-02-06
 
11493
2       2006-01-17
 
11494
3       2006-01-25
 
11495
4       2006-02-05
 
11496
-------------------------------------------------------------------------
 
11497
---  Delete rows and partitions of tables with to_days(col1)-to_days('2006-01-01')
 
11498
-------------------------------------------------------------------------
 
11499
delete from t1 where col1='2006-01-17';
 
11500
delete from t2 where col1='2006-01-17';
 
11501
delete from t3 where col1='2006-01-17';
 
11502
delete from t4 where col1='2006-01-17';
 
11503
delete from t5 where col1='2006-01-17';
 
11504
delete from t6 where col1='2006-01-17';
 
11505
select * from t1 order by col1;
 
11506
col1
 
11507
2006-02-06
 
11508
select * from t2 order by col1;
 
11509
col1
 
11510
2006-01-25
 
11511
2006-02-06
 
11512
select * from t3 order by col1;
 
11513
col1
 
11514
2006-01-25
 
11515
2006-02-06
 
11516
select * from t4 order by colint;
 
11517
colint  col1
 
11518
1       2006-02-06
 
11519
3       2006-01-25
 
11520
4       2006-02-05
 
11521
select * from t5 order by colint;
 
11522
colint  col1
 
11523
1       2006-02-06
 
11524
3       2006-01-25
 
11525
4       2006-02-05
 
11526
insert into t1 values ('2006-01-17');
 
11527
insert into t2 values ('2006-01-17');
 
11528
insert into t3 values ('2006-01-17');
 
11529
insert into t4 values (60,'2006-01-17');
 
11530
insert into t5 values (60,'2006-01-17');
 
11531
insert into t6 values (60,'2006-01-17');
 
11532
select * from t1 order by col1;
 
11533
col1
 
11534
2006-01-17
 
11535
2006-02-06
 
11536
select * from t2 order by col1;
 
11537
col1
 
11538
2006-01-17
 
11539
2006-01-25
 
11540
2006-02-06
 
11541
select * from t3 order by col1;
 
11542
col1
 
11543
2006-01-17
 
11544
2006-01-25
 
11545
2006-02-06
 
11546
select * from t4 order by colint;
 
11547
colint  col1
 
11548
1       2006-02-06
 
11549
3       2006-01-25
 
11550
4       2006-02-05
 
11551
60      2006-01-17
 
11552
select * from t5 order by colint;
 
11553
colint  col1
 
11554
1       2006-02-06
 
11555
3       2006-01-25
 
11556
4       2006-02-05
 
11557
60      2006-01-17
 
11558
select * from t6 order by colint;
 
11559
colint  col1
 
11560
1       2006-02-06
 
11561
3       2006-01-25
 
11562
4       2006-02-05
 
11563
60      2006-01-17
 
11564
alter table t1 drop partition p0;
 
11565
alter table t2 drop partition p0;
 
11566
alter table t4 drop partition p0;
 
11567
alter table t5 drop partition p0;
 
11568
alter table t6 drop partition p0;
 
11569
select * from t1 order by col1;
 
11570
col1
 
11571
2006-01-17
 
11572
2006-02-06
 
11573
select * from t2 order by col1;
 
11574
col1
 
11575
2006-01-17
 
11576
2006-01-25
 
11577
2006-02-06
 
11578
select * from t3 order by col1;
 
11579
col1
 
11580
2006-01-17
 
11581
2006-01-25
 
11582
2006-02-06
 
11583
select * from t4 order by colint;
 
11584
colint  col1
 
11585
60      2006-01-17
 
11586
select * from t5 order by colint;
 
11587
colint  col1
 
11588
60      2006-01-17
 
11589
select * from t6 order by colint;
 
11590
colint  col1
 
11591
60      2006-01-17
 
11592
-------------------------------------------------------------------------
 
11593
---  Delete rows and partitions of tables with to_days(col1)-to_days('2006-01-01')
 
11594
-------------------------------------------------------------------------
 
11595
delete from t11 where col1='2006-01-17';
 
11596
delete from t22 where col1='2006-01-17';
 
11597
delete from t33 where col1='2006-01-17';
 
11598
delete from t44 where col1='2006-01-17';
 
11599
delete from t55 where col1='2006-01-17';
 
11600
delete from t66 where col1='2006-01-17';
 
11601
select * from t11 order by col1;
 
11602
col1
 
11603
2006-02-06
 
11604
select * from t22 order by col1;
 
11605
col1
 
11606
2006-01-25
 
11607
2006-02-06
 
11608
select * from t33 order by col1;
 
11609
col1
 
11610
2006-01-25
 
11611
2006-02-06
 
11612
select * from t44 order by colint;
 
11613
colint  col1
 
11614
1       2006-02-06
 
11615
3       2006-01-25
 
11616
4       2006-02-05
 
11617
select * from t55 order by colint;
 
11618
colint  col1
 
11619
1       2006-02-06
 
11620
3       2006-01-25
 
11621
4       2006-02-05
 
11622
insert into t11 values ('2006-01-17');
 
11623
insert into t22 values ('2006-01-17');
 
11624
insert into t33 values ('2006-01-17');
 
11625
insert into t44 values (60,'2006-01-17');
 
11626
insert into t55 values (60,'2006-01-17');
 
11627
insert into t66 values (60,'2006-01-17');
 
11628
select * from t11 order by col1;
 
11629
col1
 
11630
2006-01-17
 
11631
2006-02-06
 
11632
select * from t22 order by col1;
 
11633
col1
 
11634
2006-01-17
 
11635
2006-01-25
 
11636
2006-02-06
 
11637
select * from t33 order by col1;
 
11638
col1
 
11639
2006-01-17
 
11640
2006-01-25
 
11641
2006-02-06
 
11642
select * from t44 order by colint;
 
11643
colint  col1
 
11644
1       2006-02-06
 
11645
3       2006-01-25
 
11646
4       2006-02-05
 
11647
60      2006-01-17
 
11648
select * from t55 order by colint;
 
11649
colint  col1
 
11650
1       2006-02-06
 
11651
3       2006-01-25
 
11652
4       2006-02-05
 
11653
60      2006-01-17
 
11654
select * from t66 order by colint;
 
11655
colint  col1
 
11656
1       2006-02-06
 
11657
3       2006-01-25
 
11658
4       2006-02-05
 
11659
60      2006-01-17
 
11660
alter table t11 drop partition p0;
 
11661
alter table t22 drop partition p0;
 
11662
alter table t44 drop partition p0;
 
11663
alter table t55 drop partition p0;
 
11664
alter table t66 drop partition p0;
 
11665
select * from t11 order by col1;
 
11666
col1
 
11667
2006-01-17
 
11668
2006-02-06
 
11669
select * from t22 order by col1;
 
11670
col1
 
11671
2006-01-17
 
11672
2006-01-25
 
11673
2006-02-06
 
11674
select * from t33 order by col1;
 
11675
col1
 
11676
2006-01-17
 
11677
2006-01-25
 
11678
2006-02-06
 
11679
select * from t44 order by colint;
 
11680
colint  col1
 
11681
60      2006-01-17
 
11682
select * from t55 order by colint;
 
11683
colint  col1
 
11684
60      2006-01-17
 
11685
select * from t66 order by colint;
 
11686
colint  col1
 
11687
60      2006-01-17
 
11688
-------------------------
 
11689
---- some alter table end
 
11690
-------------------------
 
11691
drop table if exists t1 ;
 
11692
drop table if exists t2 ;
 
11693
drop table if exists t3 ;
 
11694
drop table if exists t4 ;
 
11695
drop table if exists t5 ;
 
11696
drop table if exists t6 ;
 
11697
drop table if exists t11 ;
 
11698
drop table if exists t22 ;
 
11699
drop table if exists t33 ;
 
11700
drop table if exists t44 ;
 
11701
drop table if exists t55 ;
 
11702
drop table if exists t66 ;
 
11703
-------------------------------------------------------------------------
 
11704
---  weekday(col1)  in partition with coltype  date
 
11705
-------------------------------------------------------------------------
 
11706
drop table if exists t1 ;
 
11707
drop table if exists t2 ;
 
11708
drop table if exists t3 ;
 
11709
drop table if exists t4 ;
 
11710
drop table if exists t5 ;
 
11711
drop table if exists t6 ;
 
11712
-------------------------------------------------------------------------
 
11713
---  Create tables with weekday(col1)
 
11714
-------------------------------------------------------------------------
 
11715
create table t1 (col1 date) engine='NDB' 
 
11716
partition by range(weekday(col1)) 
 
11717
(partition p0 values less than (15),
 
11718
partition p1 values less than maxvalue);
 
11719
create table t2 (col1 date) engine='NDB' 
 
11720
partition by list(weekday(col1)) 
 
11721
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
11722
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
11723
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
11724
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
11725
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
11726
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
11727
);
 
11728
create table t3 (col1 date) engine='NDB' 
 
11729
partition by hash(weekday(col1));
 
11730
create table t4 (colint int, col1 date) engine='NDB' 
 
11731
partition by range(colint) 
 
11732
subpartition by hash(weekday(col1)) subpartitions 2 
 
11733
(partition p0 values less than (15),
 
11734
partition p1 values less than maxvalue);
 
11735
create table t5 (colint int, col1 date) engine='NDB' 
 
11736
partition by list(colint)
 
11737
subpartition by hash(weekday(col1)) subpartitions 2 
 
11738
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
11739
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
11740
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
11741
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
11742
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
11743
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
11744
);
 
11745
create table t6 (colint int, col1 date) engine='NDB' 
 
11746
partition by range(colint) 
 
11747
(partition p0 values less than (weekday('2006-10-14')),
 
11748
partition p1 values less than maxvalue);
 
11749
-------------------------------------------------------------------------
 
11750
---  Access tables with weekday(col1) 
 
11751
-------------------------------------------------------------------------
 
11752
insert into t1 values ('2006-12-03');
 
11753
insert into t1 values ('2006-11-17');
 
11754
insert into t2 values ('2006-12-03');
 
11755
insert into t2 values ('2006-11-17');
 
11756
insert into t2 values ('2006-05-25');
 
11757
insert into t3 values ('2006-12-03');
 
11758
insert into t3 values ('2006-11-17');
 
11759
insert into t3 values ('2006-05-25');
 
11760
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
 
11761
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
 
11762
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
 
11763
select weekday(col1) from t1 order by col1;
 
11764
weekday(col1)
 
11765
4
 
11766
6
 
11767
select * from t1 order by col1;
 
11768
col1
 
11769
2006-11-17
 
11770
2006-12-03
 
11771
select * from t2 order by col1;
 
11772
col1
 
11773
2006-05-25
 
11774
2006-11-17
 
11775
2006-12-03
 
11776
select * from t3 order by col1;
 
11777
col1
 
11778
2006-05-25
 
11779
2006-11-17
 
11780
2006-12-03
 
11781
select * from t4 order by colint;
 
11782
colint  col1
 
11783
1       2006-02-03
 
11784
2       2006-01-17
 
11785
3       2006-01-25
 
11786
4       2006-02-05
 
11787
select * from t5 order by colint;
 
11788
colint  col1
 
11789
1       2006-02-03
 
11790
2       2006-01-17
 
11791
3       2006-01-25
 
11792
4       2006-02-05
 
11793
select * from t6 order by colint;
 
11794
colint  col1
 
11795
1       2006-02-03
 
11796
2       2006-01-17
 
11797
3       2006-01-25
 
11798
4       2006-02-05
 
11799
update t1 set col1='2006-02-06' where col1='2006-12-03';
 
11800
update t2 set col1='2006-02-06' where col1='2006-12-03';
 
11801
update t3 set col1='2006-02-06' where col1='2006-12-03';
 
11802
update t4 set col1='2006-02-06' where col1='2006-12-03';
 
11803
update t5 set col1='2006-02-06' where col1='2006-12-03';
 
11804
update t6 set col1='2006-02-06' where col1='2006-12-03';
 
11805
select * from t1 order by col1;
 
11806
col1
 
11807
2006-02-06
 
11808
2006-11-17
 
11809
select * from t2 order by col1;
 
11810
col1
 
11811
2006-02-06
 
11812
2006-05-25
 
11813
2006-11-17
 
11814
select * from t3 order by col1;
 
11815
col1
 
11816
2006-02-06
 
11817
2006-05-25
 
11818
2006-11-17
 
11819
select * from t4 order by colint;
 
11820
colint  col1
 
11821
1       2006-02-03
 
11822
2       2006-01-17
 
11823
3       2006-01-25
 
11824
4       2006-02-05
 
11825
select * from t5 order by colint;
 
11826
colint  col1
 
11827
1       2006-02-03
 
11828
2       2006-01-17
 
11829
3       2006-01-25
 
11830
4       2006-02-05
 
11831
select * from t6 order by colint;
 
11832
colint  col1
 
11833
1       2006-02-03
 
11834
2       2006-01-17
 
11835
3       2006-01-25
 
11836
4       2006-02-05
 
11837
-------------------------------------------------------------------------
 
11838
---  Alter tables with weekday(col1)
 
11839
-------------------------------------------------------------------------
 
11840
drop table if exists t11 ;
 
11841
drop table if exists t22 ;
 
11842
drop table if exists t33 ;
 
11843
drop table if exists t44 ;
 
11844
drop table if exists t55 ;
 
11845
drop table if exists t66 ;
 
11846
create table t11 engine='NDB' as select * from t1;
 
11847
create table t22 engine='NDB' as select * from t2;
 
11848
create table t33 engine='NDB' as select * from t3;
 
11849
create table t44 engine='NDB' as select * from t4;
 
11850
create table t55 engine='NDB' as select * from t5;
 
11851
create table t66 engine='NDB' as select * from t6;
 
11852
alter table t11
 
11853
partition by range(weekday(col1)) 
 
11854
(partition p0 values less than (15),
 
11855
partition p1 values less than maxvalue);
 
11856
alter table t22
 
11857
partition by list(weekday(col1)) 
 
11858
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
11859
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
11860
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
11861
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
11862
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
11863
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
11864
);
 
11865
alter table t33
 
11866
partition by hash(weekday(col1));
 
11867
alter table t44
 
11868
partition by range(colint) 
 
11869
subpartition by hash(weekday(col1)) subpartitions 2 
 
11870
(partition p0 values less than (15),
 
11871
partition p1 values less than maxvalue);
 
11872
alter table t55
 
11873
partition by list(colint)
 
11874
subpartition by hash(weekday(col1)) subpartitions 2 
 
11875
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
11876
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
11877
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
11878
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
11879
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
11880
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
11881
);
 
11882
alter table t66
 
11883
partition by range(colint) 
 
11884
(partition p0 values less than (weekday('2006-10-14')),
 
11885
partition p1 values less than maxvalue);
 
11886
select * from t11 order by col1;
 
11887
col1
 
11888
2006-02-06
 
11889
2006-11-17
 
11890
select * from t22 order by col1;
 
11891
col1
 
11892
2006-02-06
 
11893
2006-05-25
 
11894
2006-11-17
 
11895
select * from t33 order by col1;
 
11896
col1
 
11897
2006-02-06
 
11898
2006-05-25
 
11899
2006-11-17
 
11900
select * from t44 order by colint;
 
11901
colint  col1
 
11902
1       2006-02-03
 
11903
2       2006-01-17
 
11904
3       2006-01-25
 
11905
4       2006-02-05
 
11906
select * from t55 order by colint;
 
11907
colint  col1
 
11908
1       2006-02-03
 
11909
2       2006-01-17
 
11910
3       2006-01-25
 
11911
4       2006-02-05
 
11912
select * from t66 order by colint;
 
11913
colint  col1
 
11914
1       2006-02-03
 
11915
2       2006-01-17
 
11916
3       2006-01-25
 
11917
4       2006-02-05
 
11918
---------------------------
 
11919
---- some alter table begin
 
11920
---------------------------
 
11921
alter table t11
 
11922
reorganize partition p0,p1 into
 
11923
(partition s1 values less than maxvalue);
 
11924
select * from t11 order by col1;
 
11925
col1
 
11926
2006-02-06
 
11927
2006-11-17
 
11928
alter table t11
 
11929
reorganize partition s1 into
 
11930
(partition p0 values less than (15),
 
11931
partition p1 values less than maxvalue);
 
11932
select * from t11 order by col1;
 
11933
col1
 
11934
2006-02-06
 
11935
2006-11-17
 
11936
alter table t55
 
11937
partition by list(colint)
 
11938
subpartition by hash(weekday(col1)) subpartitions 5 
 
11939
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
11940
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
11941
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
11942
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
11943
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
11944
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
11945
);
 
11946
show create table t55;
 
11947
Table   Create Table
 
11948
t55     CREATE TABLE `t55` (
 
11949
  `colint` int(11) DEFAULT NULL,
 
11950
  `col1` date DEFAULT NULL
 
11951
) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (weekday(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
 
11952
select * from t55 order by colint;
 
11953
colint  col1
 
11954
1       2006-02-03
 
11955
2       2006-01-17
 
11956
3       2006-01-25
 
11957
4       2006-02-05
 
11958
alter table t66
 
11959
reorganize partition p0,p1 into
 
11960
(partition s1 values less than maxvalue);
 
11961
select * from t66 order by colint;
 
11962
colint  col1
 
11963
1       2006-02-03
 
11964
2       2006-01-17
 
11965
3       2006-01-25
 
11966
4       2006-02-05
 
11967
alter table t66
 
11968
reorganize partition s1 into
 
11969
(partition p0 values less than (weekday('2006-10-14')),
 
11970
partition p1 values less than maxvalue);
 
11971
select * from t66 order by colint;
 
11972
colint  col1
 
11973
1       2006-02-03
 
11974
2       2006-01-17
 
11975
3       2006-01-25
 
11976
4       2006-02-05
 
11977
alter table t66
 
11978
reorganize partition p0,p1 into
 
11979
(partition s1 values less than maxvalue);
 
11980
select * from t66 order by colint;
 
11981
colint  col1
 
11982
1       2006-02-03
 
11983
2       2006-01-17
 
11984
3       2006-01-25
 
11985
4       2006-02-05
 
11986
alter table t66
 
11987
reorganize partition s1 into
 
11988
(partition p0 values less than (weekday('2006-10-14')),
 
11989
partition p1 values less than maxvalue);
 
11990
select * from t66 order by colint;
 
11991
colint  col1
 
11992
1       2006-02-03
 
11993
2       2006-01-17
 
11994
3       2006-01-25
 
11995
4       2006-02-05
 
11996
-------------------------------------------------------------------------
 
11997
---  Delete rows and partitions of tables with weekday(col1)
 
11998
-------------------------------------------------------------------------
 
11999
delete from t1 where col1='2006-11-17';
 
12000
delete from t2 where col1='2006-11-17';
 
12001
delete from t3 where col1='2006-11-17';
 
12002
delete from t4 where col1='2006-11-17';
 
12003
delete from t5 where col1='2006-11-17';
 
12004
delete from t6 where col1='2006-11-17';
 
12005
select * from t1 order by col1;
 
12006
col1
 
12007
2006-02-06
 
12008
select * from t2 order by col1;
 
12009
col1
 
12010
2006-02-06
 
12011
2006-05-25
 
12012
select * from t3 order by col1;
 
12013
col1
 
12014
2006-02-06
 
12015
2006-05-25
 
12016
select * from t4 order by colint;
 
12017
colint  col1
 
12018
1       2006-02-03
 
12019
2       2006-01-17
 
12020
3       2006-01-25
 
12021
4       2006-02-05
 
12022
select * from t5 order by colint;
 
12023
colint  col1
 
12024
1       2006-02-03
 
12025
2       2006-01-17
 
12026
3       2006-01-25
 
12027
4       2006-02-05
 
12028
insert into t1 values ('2006-11-17');
 
12029
insert into t2 values ('2006-11-17');
 
12030
insert into t3 values ('2006-11-17');
 
12031
insert into t4 values (60,'2006-11-17');
 
12032
insert into t5 values (60,'2006-11-17');
 
12033
insert into t6 values (60,'2006-11-17');
 
12034
select * from t1 order by col1;
 
12035
col1
 
12036
2006-02-06
 
12037
2006-11-17
 
12038
select * from t2 order by col1;
 
12039
col1
 
12040
2006-02-06
 
12041
2006-05-25
 
12042
2006-11-17
 
12043
select * from t3 order by col1;
 
12044
col1
 
12045
2006-02-06
 
12046
2006-05-25
 
12047
2006-11-17
 
12048
select * from t4 order by colint;
 
12049
colint  col1
 
12050
1       2006-02-03
 
12051
2       2006-01-17
 
12052
3       2006-01-25
 
12053
4       2006-02-05
 
12054
60      2006-11-17
 
12055
select * from t5 order by colint;
 
12056
colint  col1
 
12057
1       2006-02-03
 
12058
2       2006-01-17
 
12059
3       2006-01-25
 
12060
4       2006-02-05
 
12061
60      2006-11-17
 
12062
select * from t6 order by colint;
 
12063
colint  col1
 
12064
1       2006-02-03
 
12065
2       2006-01-17
 
12066
3       2006-01-25
 
12067
4       2006-02-05
 
12068
60      2006-11-17
 
12069
alter table t1 drop partition p0;
 
12070
alter table t2 drop partition p0;
 
12071
alter table t4 drop partition p0;
 
12072
alter table t5 drop partition p0;
 
12073
alter table t6 drop partition p0;
 
12074
select * from t1 order by col1;
 
12075
col1
 
12076
select * from t2 order by col1;
 
12077
col1
 
12078
select * from t3 order by col1;
 
12079
col1
 
12080
2006-02-06
 
12081
2006-05-25
 
12082
2006-11-17
 
12083
select * from t4 order by colint;
 
12084
colint  col1
 
12085
60      2006-11-17
 
12086
select * from t5 order by colint;
 
12087
colint  col1
 
12088
60      2006-11-17
 
12089
select * from t6 order by colint;
 
12090
colint  col1
 
12091
60      2006-11-17
 
12092
-------------------------------------------------------------------------
 
12093
---  Delete rows and partitions of tables with weekday(col1)
 
12094
-------------------------------------------------------------------------
 
12095
delete from t11 where col1='2006-11-17';
 
12096
delete from t22 where col1='2006-11-17';
 
12097
delete from t33 where col1='2006-11-17';
 
12098
delete from t44 where col1='2006-11-17';
 
12099
delete from t55 where col1='2006-11-17';
 
12100
delete from t66 where col1='2006-11-17';
 
12101
select * from t11 order by col1;
 
12102
col1
 
12103
2006-02-06
 
12104
select * from t22 order by col1;
 
12105
col1
 
12106
2006-02-06
 
12107
2006-05-25
 
12108
select * from t33 order by col1;
 
12109
col1
 
12110
2006-02-06
 
12111
2006-05-25
 
12112
select * from t44 order by colint;
 
12113
colint  col1
 
12114
1       2006-02-03
 
12115
2       2006-01-17
 
12116
3       2006-01-25
 
12117
4       2006-02-05
 
12118
select * from t55 order by colint;
 
12119
colint  col1
 
12120
1       2006-02-03
 
12121
2       2006-01-17
 
12122
3       2006-01-25
 
12123
4       2006-02-05
 
12124
insert into t11 values ('2006-11-17');
 
12125
insert into t22 values ('2006-11-17');
 
12126
insert into t33 values ('2006-11-17');
 
12127
insert into t44 values (60,'2006-11-17');
 
12128
insert into t55 values (60,'2006-11-17');
 
12129
insert into t66 values (60,'2006-11-17');
 
12130
select * from t11 order by col1;
 
12131
col1
 
12132
2006-02-06
 
12133
2006-11-17
 
12134
select * from t22 order by col1;
 
12135
col1
 
12136
2006-02-06
 
12137
2006-05-25
 
12138
2006-11-17
 
12139
select * from t33 order by col1;
 
12140
col1
 
12141
2006-02-06
 
12142
2006-05-25
 
12143
2006-11-17
 
12144
select * from t44 order by colint;
 
12145
colint  col1
 
12146
1       2006-02-03
 
12147
2       2006-01-17
 
12148
3       2006-01-25
 
12149
4       2006-02-05
 
12150
60      2006-11-17
 
12151
select * from t55 order by colint;
 
12152
colint  col1
 
12153
1       2006-02-03
 
12154
2       2006-01-17
 
12155
3       2006-01-25
 
12156
4       2006-02-05
 
12157
60      2006-11-17
 
12158
select * from t66 order by colint;
 
12159
colint  col1
 
12160
1       2006-02-03
 
12161
2       2006-01-17
 
12162
3       2006-01-25
 
12163
4       2006-02-05
 
12164
60      2006-11-17
 
12165
alter table t11 drop partition p0;
 
12166
alter table t22 drop partition p0;
 
12167
alter table t44 drop partition p0;
 
12168
alter table t55 drop partition p0;
 
12169
alter table t66 drop partition p0;
 
12170
select * from t11 order by col1;
 
12171
col1
 
12172
select * from t22 order by col1;
 
12173
col1
 
12174
select * from t33 order by col1;
 
12175
col1
 
12176
2006-02-06
 
12177
2006-05-25
 
12178
2006-11-17
 
12179
select * from t44 order by colint;
 
12180
colint  col1
 
12181
60      2006-11-17
 
12182
select * from t55 order by colint;
 
12183
colint  col1
 
12184
60      2006-11-17
 
12185
select * from t66 order by colint;
 
12186
colint  col1
 
12187
60      2006-11-17
 
12188
-------------------------
 
12189
---- some alter table end
 
12190
-------------------------
 
12191
drop table if exists t1 ;
 
12192
drop table if exists t2 ;
 
12193
drop table if exists t3 ;
 
12194
drop table if exists t4 ;
 
12195
drop table if exists t5 ;
 
12196
drop table if exists t6 ;
 
12197
drop table if exists t11 ;
 
12198
drop table if exists t22 ;
 
12199
drop table if exists t33 ;
 
12200
drop table if exists t44 ;
 
12201
drop table if exists t55 ;
 
12202
drop table if exists t66 ;
 
12203
-------------------------------------------------------------------------
 
12204
---  weekofyear(col1)  in partition with coltype  date
 
12205
-------------------------------------------------------------------------
 
12206
drop table if exists t1 ;
 
12207
drop table if exists t2 ;
 
12208
drop table if exists t3 ;
 
12209
drop table if exists t4 ;
 
12210
drop table if exists t5 ;
 
12211
drop table if exists t6 ;
 
12212
-------------------------------------------------------------------------
 
12213
---  Create tables with weekofyear(col1)
 
12214
-------------------------------------------------------------------------
 
12215
create table t1 (col1 date) engine='NDB' 
 
12216
partition by range(weekofyear(col1)) 
 
12217
(partition p0 values less than (15),
 
12218
partition p1 values less than maxvalue);
 
12219
create table t2 (col1 date) engine='NDB' 
 
12220
partition by list(weekofyear(col1)) 
 
12221
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
12222
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
12223
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
12224
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
12225
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
12226
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
12227
);
 
12228
create table t3 (col1 date) engine='NDB' 
 
12229
partition by hash(weekofyear(col1));
 
12230
create table t4 (colint int, col1 date) engine='NDB' 
 
12231
partition by range(colint) 
 
12232
subpartition by hash(weekofyear(col1)) subpartitions 2 
 
12233
(partition p0 values less than (15),
 
12234
partition p1 values less than maxvalue);
 
12235
create table t5 (colint int, col1 date) engine='NDB' 
 
12236
partition by list(colint)
 
12237
subpartition by hash(weekofyear(col1)) subpartitions 2 
 
12238
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
12239
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
12240
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
12241
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
12242
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
12243
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
12244
);
 
12245
create table t6 (colint int, col1 date) engine='NDB' 
 
12246
partition by range(colint) 
 
12247
(partition p0 values less than (weekofyear('2006-02-14')),
 
12248
partition p1 values less than maxvalue);
 
12249
-------------------------------------------------------------------------
 
12250
---  Access tables with weekofyear(col1) 
 
12251
-------------------------------------------------------------------------
 
12252
insert into t1 values ('2006-01-03');
 
12253
insert into t1 values ('2006-03-17');
 
12254
insert into t2 values ('2006-01-03');
 
12255
insert into t2 values ('2006-03-17');
 
12256
insert into t2 values ('2006-05-25');
 
12257
insert into t3 values ('2006-01-03');
 
12258
insert into t3 values ('2006-03-17');
 
12259
insert into t3 values ('2006-05-25');
 
12260
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
 
12261
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
 
12262
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
 
12263
select weekofyear(col1) from t1 order by col1;
 
12264
weekofyear(col1)
 
12265
1
 
12266
11
 
12267
select * from t1 order by col1;
 
12268
col1
 
12269
2006-01-03
 
12270
2006-03-17
 
12271
select * from t2 order by col1;
 
12272
col1
 
12273
2006-01-03
 
12274
2006-03-17
 
12275
2006-05-25
 
12276
select * from t3 order by col1;
 
12277
col1
 
12278
2006-01-03
 
12279
2006-03-17
 
12280
2006-05-25
 
12281
select * from t4 order by colint;
 
12282
colint  col1
 
12283
1       2006-02-03
 
12284
2       2006-01-17
 
12285
3       2006-01-25
 
12286
4       2006-02-05
 
12287
select * from t5 order by colint;
 
12288
colint  col1
 
12289
1       2006-02-03
 
12290
2       2006-01-17
 
12291
3       2006-01-25
 
12292
4       2006-02-05
 
12293
select * from t6 order by colint;
 
12294
colint  col1
 
12295
1       2006-02-03
 
12296
2       2006-01-17
 
12297
3       2006-01-25
 
12298
4       2006-02-05
 
12299
update t1 set col1='2006-09-06' where col1='2006-01-03';
 
12300
update t2 set col1='2006-09-06' where col1='2006-01-03';
 
12301
update t3 set col1='2006-09-06' where col1='2006-01-03';
 
12302
update t4 set col1='2006-09-06' where col1='2006-01-03';
 
12303
update t5 set col1='2006-09-06' where col1='2006-01-03';
 
12304
update t6 set col1='2006-09-06' where col1='2006-01-03';
 
12305
select * from t1 order by col1;
 
12306
col1
 
12307
2006-03-17
 
12308
2006-09-06
 
12309
select * from t2 order by col1;
 
12310
col1
 
12311
2006-03-17
 
12312
2006-05-25
 
12313
2006-09-06
 
12314
select * from t3 order by col1;
 
12315
col1
 
12316
2006-03-17
 
12317
2006-05-25
 
12318
2006-09-06
 
12319
select * from t4 order by colint;
 
12320
colint  col1
 
12321
1       2006-02-03
 
12322
2       2006-01-17
 
12323
3       2006-01-25
 
12324
4       2006-02-05
 
12325
select * from t5 order by colint;
 
12326
colint  col1
 
12327
1       2006-02-03
 
12328
2       2006-01-17
 
12329
3       2006-01-25
 
12330
4       2006-02-05
 
12331
select * from t6 order by colint;
 
12332
colint  col1
 
12333
1       2006-02-03
 
12334
2       2006-01-17
 
12335
3       2006-01-25
 
12336
4       2006-02-05
 
12337
-------------------------------------------------------------------------
 
12338
---  Alter tables with weekofyear(col1)
 
12339
-------------------------------------------------------------------------
 
12340
drop table if exists t11 ;
 
12341
drop table if exists t22 ;
 
12342
drop table if exists t33 ;
 
12343
drop table if exists t44 ;
 
12344
drop table if exists t55 ;
 
12345
drop table if exists t66 ;
 
12346
create table t11 engine='NDB' as select * from t1;
 
12347
create table t22 engine='NDB' as select * from t2;
 
12348
create table t33 engine='NDB' as select * from t3;
 
12349
create table t44 engine='NDB' as select * from t4;
 
12350
create table t55 engine='NDB' as select * from t5;
 
12351
create table t66 engine='NDB' as select * from t6;
 
12352
alter table t11
 
12353
partition by range(weekofyear(col1)) 
 
12354
(partition p0 values less than (15),
 
12355
partition p1 values less than maxvalue);
 
12356
alter table t22
 
12357
partition by list(weekofyear(col1)) 
 
12358
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
12359
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
12360
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
12361
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
12362
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
12363
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
12364
);
 
12365
alter table t33
 
12366
partition by hash(weekofyear(col1));
 
12367
alter table t44
 
12368
partition by range(colint) 
 
12369
subpartition by hash(weekofyear(col1)) subpartitions 2 
 
12370
(partition p0 values less than (15),
 
12371
partition p1 values less than maxvalue);
 
12372
alter table t55
 
12373
partition by list(colint)
 
12374
subpartition by hash(weekofyear(col1)) subpartitions 2 
 
12375
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
12376
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
12377
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
12378
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
12379
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
12380
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
12381
);
 
12382
alter table t66
 
12383
partition by range(colint) 
 
12384
(partition p0 values less than (weekofyear('2006-02-14')),
 
12385
partition p1 values less than maxvalue);
 
12386
select * from t11 order by col1;
 
12387
col1
 
12388
2006-03-17
 
12389
2006-09-06
 
12390
select * from t22 order by col1;
 
12391
col1
 
12392
2006-03-17
 
12393
2006-05-25
 
12394
2006-09-06
 
12395
select * from t33 order by col1;
 
12396
col1
 
12397
2006-03-17
 
12398
2006-05-25
 
12399
2006-09-06
 
12400
select * from t44 order by colint;
 
12401
colint  col1
 
12402
1       2006-02-03
 
12403
2       2006-01-17
 
12404
3       2006-01-25
 
12405
4       2006-02-05
 
12406
select * from t55 order by colint;
 
12407
colint  col1
 
12408
1       2006-02-03
 
12409
2       2006-01-17
 
12410
3       2006-01-25
 
12411
4       2006-02-05
 
12412
select * from t66 order by colint;
 
12413
colint  col1
 
12414
1       2006-02-03
 
12415
2       2006-01-17
 
12416
3       2006-01-25
 
12417
4       2006-02-05
 
12418
---------------------------
 
12419
---- some alter table begin
 
12420
---------------------------
 
12421
alter table t11
 
12422
reorganize partition p0,p1 into
 
12423
(partition s1 values less than maxvalue);
 
12424
select * from t11 order by col1;
 
12425
col1
 
12426
2006-03-17
 
12427
2006-09-06
 
12428
alter table t11
 
12429
reorganize partition s1 into
 
12430
(partition p0 values less than (15),
 
12431
partition p1 values less than maxvalue);
 
12432
select * from t11 order by col1;
 
12433
col1
 
12434
2006-03-17
 
12435
2006-09-06
 
12436
alter table t55
 
12437
partition by list(colint)
 
12438
subpartition by hash(weekofyear(col1)) subpartitions 5 
 
12439
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
12440
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
12441
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
12442
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
12443
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
12444
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
12445
);
 
12446
show create table t55;
 
12447
Table   Create Table
 
12448
t55     CREATE TABLE `t55` (
 
12449
  `colint` int(11) DEFAULT NULL,
 
12450
  `col1` date DEFAULT NULL
 
12451
) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (weekofyear(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
 
12452
select * from t55 order by colint;
 
12453
colint  col1
 
12454
1       2006-02-03
 
12455
2       2006-01-17
 
12456
3       2006-01-25
 
12457
4       2006-02-05
 
12458
alter table t66
 
12459
reorganize partition p0,p1 into
 
12460
(partition s1 values less than maxvalue);
 
12461
select * from t66 order by colint;
 
12462
colint  col1
 
12463
1       2006-02-03
 
12464
2       2006-01-17
 
12465
3       2006-01-25
 
12466
4       2006-02-05
 
12467
alter table t66
 
12468
reorganize partition s1 into
 
12469
(partition p0 values less than (weekofyear('2006-02-14')),
 
12470
partition p1 values less than maxvalue);
 
12471
select * from t66 order by colint;
 
12472
colint  col1
 
12473
1       2006-02-03
 
12474
2       2006-01-17
 
12475
3       2006-01-25
 
12476
4       2006-02-05
 
12477
alter table t66
 
12478
reorganize partition p0,p1 into
 
12479
(partition s1 values less than maxvalue);
 
12480
select * from t66 order by colint;
 
12481
colint  col1
 
12482
1       2006-02-03
 
12483
2       2006-01-17
 
12484
3       2006-01-25
 
12485
4       2006-02-05
 
12486
alter table t66
 
12487
reorganize partition s1 into
 
12488
(partition p0 values less than (weekofyear('2006-02-14')),
 
12489
partition p1 values less than maxvalue);
 
12490
select * from t66 order by colint;
 
12491
colint  col1
 
12492
1       2006-02-03
 
12493
2       2006-01-17
 
12494
3       2006-01-25
 
12495
4       2006-02-05
 
12496
-------------------------------------------------------------------------
 
12497
---  Delete rows and partitions of tables with weekofyear(col1)
 
12498
-------------------------------------------------------------------------
 
12499
delete from t1 where col1='2006-03-17';
 
12500
delete from t2 where col1='2006-03-17';
 
12501
delete from t3 where col1='2006-03-17';
 
12502
delete from t4 where col1='2006-03-17';
 
12503
delete from t5 where col1='2006-03-17';
 
12504
delete from t6 where col1='2006-03-17';
 
12505
select * from t1 order by col1;
 
12506
col1
 
12507
2006-09-06
 
12508
select * from t2 order by col1;
 
12509
col1
 
12510
2006-05-25
 
12511
2006-09-06
 
12512
select * from t3 order by col1;
 
12513
col1
 
12514
2006-05-25
 
12515
2006-09-06
 
12516
select * from t4 order by colint;
 
12517
colint  col1
 
12518
1       2006-02-03
 
12519
2       2006-01-17
 
12520
3       2006-01-25
 
12521
4       2006-02-05
 
12522
select * from t5 order by colint;
 
12523
colint  col1
 
12524
1       2006-02-03
 
12525
2       2006-01-17
 
12526
3       2006-01-25
 
12527
4       2006-02-05
 
12528
insert into t1 values ('2006-03-17');
 
12529
insert into t2 values ('2006-03-17');
 
12530
insert into t3 values ('2006-03-17');
 
12531
insert into t4 values (60,'2006-03-17');
 
12532
insert into t5 values (60,'2006-03-17');
 
12533
insert into t6 values (60,'2006-03-17');
 
12534
select * from t1 order by col1;
 
12535
col1
 
12536
2006-03-17
 
12537
2006-09-06
 
12538
select * from t2 order by col1;
 
12539
col1
 
12540
2006-03-17
 
12541
2006-05-25
 
12542
2006-09-06
 
12543
select * from t3 order by col1;
 
12544
col1
 
12545
2006-03-17
 
12546
2006-05-25
 
12547
2006-09-06
 
12548
select * from t4 order by colint;
 
12549
colint  col1
 
12550
1       2006-02-03
 
12551
2       2006-01-17
 
12552
3       2006-01-25
 
12553
4       2006-02-05
 
12554
60      2006-03-17
 
12555
select * from t5 order by colint;
 
12556
colint  col1
 
12557
1       2006-02-03
 
12558
2       2006-01-17
 
12559
3       2006-01-25
 
12560
4       2006-02-05
 
12561
60      2006-03-17
 
12562
select * from t6 order by colint;
 
12563
colint  col1
 
12564
1       2006-02-03
 
12565
2       2006-01-17
 
12566
3       2006-01-25
 
12567
4       2006-02-05
 
12568
60      2006-03-17
 
12569
alter table t1 drop partition p0;
 
12570
alter table t2 drop partition p0;
 
12571
alter table t4 drop partition p0;
 
12572
alter table t5 drop partition p0;
 
12573
alter table t6 drop partition p0;
 
12574
select * from t1 order by col1;
 
12575
col1
 
12576
2006-09-06
 
12577
select * from t2 order by col1;
 
12578
col1
 
12579
2006-03-17
 
12580
2006-05-25
 
12581
2006-09-06
 
12582
select * from t3 order by col1;
 
12583
col1
 
12584
2006-03-17
 
12585
2006-05-25
 
12586
2006-09-06
 
12587
select * from t4 order by colint;
 
12588
colint  col1
 
12589
60      2006-03-17
 
12590
select * from t5 order by colint;
 
12591
colint  col1
 
12592
60      2006-03-17
 
12593
select * from t6 order by colint;
 
12594
colint  col1
 
12595
60      2006-03-17
 
12596
-------------------------------------------------------------------------
 
12597
---  Delete rows and partitions of tables with weekofyear(col1)
 
12598
-------------------------------------------------------------------------
 
12599
delete from t11 where col1='2006-03-17';
 
12600
delete from t22 where col1='2006-03-17';
 
12601
delete from t33 where col1='2006-03-17';
 
12602
delete from t44 where col1='2006-03-17';
 
12603
delete from t55 where col1='2006-03-17';
 
12604
delete from t66 where col1='2006-03-17';
 
12605
select * from t11 order by col1;
 
12606
col1
 
12607
2006-09-06
 
12608
select * from t22 order by col1;
 
12609
col1
 
12610
2006-05-25
 
12611
2006-09-06
 
12612
select * from t33 order by col1;
 
12613
col1
 
12614
2006-05-25
 
12615
2006-09-06
 
12616
select * from t44 order by colint;
 
12617
colint  col1
 
12618
1       2006-02-03
 
12619
2       2006-01-17
 
12620
3       2006-01-25
 
12621
4       2006-02-05
 
12622
select * from t55 order by colint;
 
12623
colint  col1
 
12624
1       2006-02-03
 
12625
2       2006-01-17
 
12626
3       2006-01-25
 
12627
4       2006-02-05
 
12628
insert into t11 values ('2006-03-17');
 
12629
insert into t22 values ('2006-03-17');
 
12630
insert into t33 values ('2006-03-17');
 
12631
insert into t44 values (60,'2006-03-17');
 
12632
insert into t55 values (60,'2006-03-17');
 
12633
insert into t66 values (60,'2006-03-17');
 
12634
select * from t11 order by col1;
 
12635
col1
 
12636
2006-03-17
 
12637
2006-09-06
 
12638
select * from t22 order by col1;
 
12639
col1
 
12640
2006-03-17
 
12641
2006-05-25
 
12642
2006-09-06
 
12643
select * from t33 order by col1;
 
12644
col1
 
12645
2006-03-17
 
12646
2006-05-25
 
12647
2006-09-06
 
12648
select * from t44 order by colint;
 
12649
colint  col1
 
12650
1       2006-02-03
 
12651
2       2006-01-17
 
12652
3       2006-01-25
 
12653
4       2006-02-05
 
12654
60      2006-03-17
 
12655
select * from t55 order by colint;
 
12656
colint  col1
 
12657
1       2006-02-03
 
12658
2       2006-01-17
 
12659
3       2006-01-25
 
12660
4       2006-02-05
 
12661
60      2006-03-17
 
12662
select * from t66 order by colint;
 
12663
colint  col1
 
12664
1       2006-02-03
 
12665
2       2006-01-17
 
12666
3       2006-01-25
 
12667
4       2006-02-05
 
12668
60      2006-03-17
 
12669
alter table t11 drop partition p0;
 
12670
alter table t22 drop partition p0;
 
12671
alter table t44 drop partition p0;
 
12672
alter table t55 drop partition p0;
 
12673
alter table t66 drop partition p0;
 
12674
select * from t11 order by col1;
 
12675
col1
 
12676
2006-09-06
 
12677
select * from t22 order by col1;
 
12678
col1
 
12679
2006-03-17
 
12680
2006-05-25
 
12681
2006-09-06
 
12682
select * from t33 order by col1;
 
12683
col1
 
12684
2006-03-17
 
12685
2006-05-25
 
12686
2006-09-06
 
12687
select * from t44 order by colint;
 
12688
colint  col1
 
12689
60      2006-03-17
 
12690
select * from t55 order by colint;
 
12691
colint  col1
 
12692
60      2006-03-17
 
12693
select * from t66 order by colint;
 
12694
colint  col1
 
12695
60      2006-03-17
 
12696
-------------------------
 
12697
---- some alter table end
 
12698
-------------------------
 
12699
drop table if exists t1 ;
 
12700
drop table if exists t2 ;
 
12701
drop table if exists t3 ;
 
12702
drop table if exists t4 ;
 
12703
drop table if exists t5 ;
 
12704
drop table if exists t6 ;
 
12705
drop table if exists t11 ;
 
12706
drop table if exists t22 ;
 
12707
drop table if exists t33 ;
 
12708
drop table if exists t44 ;
 
12709
drop table if exists t55 ;
 
12710
drop table if exists t66 ;
 
12711
-------------------------------------------------------------------------
 
12712
---  year(col1)-1990  in partition with coltype  date
 
12713
-------------------------------------------------------------------------
 
12714
drop table if exists t1 ;
 
12715
drop table if exists t2 ;
 
12716
drop table if exists t3 ;
 
12717
drop table if exists t4 ;
 
12718
drop table if exists t5 ;
 
12719
drop table if exists t6 ;
 
12720
-------------------------------------------------------------------------
 
12721
---  Create tables with year(col1)-1990
 
12722
-------------------------------------------------------------------------
 
12723
create table t1 (col1 date) engine='NDB' 
 
12724
partition by range(year(col1)-1990) 
 
12725
(partition p0 values less than (15),
 
12726
partition p1 values less than maxvalue);
 
12727
create table t2 (col1 date) engine='NDB' 
 
12728
partition by list(year(col1)-1990) 
 
12729
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
12730
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
12731
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
12732
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
12733
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
12734
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
12735
);
 
12736
create table t3 (col1 date) engine='NDB' 
 
12737
partition by hash(year(col1)-1990);
 
12738
create table t4 (colint int, col1 date) engine='NDB' 
 
12739
partition by range(colint) 
 
12740
subpartition by hash(year(col1)-1990) subpartitions 2 
 
12741
(partition p0 values less than (15),
 
12742
partition p1 values less than maxvalue);
 
12743
create table t5 (colint int, col1 date) engine='NDB' 
 
12744
partition by list(colint)
 
12745
subpartition by hash(year(col1)-1990) subpartitions 2 
 
12746
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
12747
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
12748
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
12749
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
12750
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
12751
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
12752
);
 
12753
create table t6 (colint int, col1 date) engine='NDB' 
 
12754
partition by range(colint) 
 
12755
(partition p0 values less than (year('2005-10-14')-1990),
 
12756
partition p1 values less than maxvalue);
 
12757
-------------------------------------------------------------------------
 
12758
---  Access tables with year(col1)-1990 
 
12759
-------------------------------------------------------------------------
 
12760
insert into t1 values ('1996-01-03');
 
12761
insert into t1 values ('2000-02-17');
 
12762
insert into t2 values ('1996-01-03');
 
12763
insert into t2 values ('2000-02-17');
 
12764
insert into t2 values ('2004-05-25');
 
12765
insert into t3 values ('1996-01-03');
 
12766
insert into t3 values ('2000-02-17');
 
12767
insert into t3 values ('2004-05-25');
 
12768
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
 
12769
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
 
12770
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
 
12771
select year(col1)-1990 from t1 order by col1;
 
12772
year(col1)-1990
 
12773
6
 
12774
10
 
12775
select * from t1 order by col1;
 
12776
col1
 
12777
1996-01-03
 
12778
2000-02-17
 
12779
select * from t2 order by col1;
 
12780
col1
 
12781
1996-01-03
 
12782
2000-02-17
 
12783
2004-05-25
 
12784
select * from t3 order by col1;
 
12785
col1
 
12786
1996-01-03
 
12787
2000-02-17
 
12788
2004-05-25
 
12789
select * from t4 order by colint;
 
12790
colint  col1
 
12791
1       2006-02-03
 
12792
2       2006-01-17
 
12793
3       2006-01-25
 
12794
4       2006-02-05
 
12795
select * from t5 order by colint;
 
12796
colint  col1
 
12797
1       2006-02-03
 
12798
2       2006-01-17
 
12799
3       2006-01-25
 
12800
4       2006-02-05
 
12801
select * from t6 order by colint;
 
12802
colint  col1
 
12803
1       2006-02-03
 
12804
2       2006-01-17
 
12805
3       2006-01-25
 
12806
4       2006-02-05
 
12807
update t1 set col1='2002-02-15' where col1='1996-01-03';
 
12808
update t2 set col1='2002-02-15' where col1='1996-01-03';
 
12809
update t3 set col1='2002-02-15' where col1='1996-01-03';
 
12810
update t4 set col1='2002-02-15' where col1='1996-01-03';
 
12811
update t5 set col1='2002-02-15' where col1='1996-01-03';
 
12812
update t6 set col1='2002-02-15' where col1='1996-01-03';
 
12813
select * from t1 order by col1;
 
12814
col1
 
12815
2000-02-17
 
12816
2002-02-15
 
12817
select * from t2 order by col1;
 
12818
col1
 
12819
2000-02-17
 
12820
2002-02-15
 
12821
2004-05-25
 
12822
select * from t3 order by col1;
 
12823
col1
 
12824
2000-02-17
 
12825
2002-02-15
 
12826
2004-05-25
 
12827
select * from t4 order by colint;
 
12828
colint  col1
 
12829
1       2006-02-03
 
12830
2       2006-01-17
 
12831
3       2006-01-25
 
12832
4       2006-02-05
 
12833
select * from t5 order by colint;
 
12834
colint  col1
 
12835
1       2006-02-03
 
12836
2       2006-01-17
 
12837
3       2006-01-25
 
12838
4       2006-02-05
 
12839
select * from t6 order by colint;
 
12840
colint  col1
 
12841
1       2006-02-03
 
12842
2       2006-01-17
 
12843
3       2006-01-25
 
12844
4       2006-02-05
 
12845
-------------------------------------------------------------------------
 
12846
---  Alter tables with year(col1)-1990
 
12847
-------------------------------------------------------------------------
 
12848
drop table if exists t11 ;
 
12849
drop table if exists t22 ;
 
12850
drop table if exists t33 ;
 
12851
drop table if exists t44 ;
 
12852
drop table if exists t55 ;
 
12853
drop table if exists t66 ;
 
12854
create table t11 engine='NDB' as select * from t1;
 
12855
create table t22 engine='NDB' as select * from t2;
 
12856
create table t33 engine='NDB' as select * from t3;
 
12857
create table t44 engine='NDB' as select * from t4;
 
12858
create table t55 engine='NDB' as select * from t5;
 
12859
create table t66 engine='NDB' as select * from t6;
 
12860
alter table t11
 
12861
partition by range(year(col1)-1990) 
 
12862
(partition p0 values less than (15),
 
12863
partition p1 values less than maxvalue);
 
12864
alter table t22
 
12865
partition by list(year(col1)-1990) 
 
12866
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
12867
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
12868
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
12869
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
12870
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
12871
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
12872
);
 
12873
alter table t33
 
12874
partition by hash(year(col1)-1990);
 
12875
alter table t44
 
12876
partition by range(colint) 
 
12877
subpartition by hash(year(col1)-1990) subpartitions 2 
 
12878
(partition p0 values less than (15),
 
12879
partition p1 values less than maxvalue);
 
12880
alter table t55
 
12881
partition by list(colint)
 
12882
subpartition by hash(year(col1)-1990) subpartitions 2 
 
12883
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
12884
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
12885
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
12886
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
12887
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
12888
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
12889
);
 
12890
alter table t66
 
12891
partition by range(colint) 
 
12892
(partition p0 values less than (year('2005-10-14')-1990),
 
12893
partition p1 values less than maxvalue);
 
12894
select * from t11 order by col1;
 
12895
col1
 
12896
2000-02-17
 
12897
2002-02-15
 
12898
select * from t22 order by col1;
 
12899
col1
 
12900
2000-02-17
 
12901
2002-02-15
 
12902
2004-05-25
 
12903
select * from t33 order by col1;
 
12904
col1
 
12905
2000-02-17
 
12906
2002-02-15
 
12907
2004-05-25
 
12908
select * from t44 order by colint;
 
12909
colint  col1
 
12910
1       2006-02-03
 
12911
2       2006-01-17
 
12912
3       2006-01-25
 
12913
4       2006-02-05
 
12914
select * from t55 order by colint;
 
12915
colint  col1
 
12916
1       2006-02-03
 
12917
2       2006-01-17
 
12918
3       2006-01-25
 
12919
4       2006-02-05
 
12920
select * from t66 order by colint;
 
12921
colint  col1
 
12922
1       2006-02-03
 
12923
2       2006-01-17
 
12924
3       2006-01-25
 
12925
4       2006-02-05
 
12926
---------------------------
 
12927
---- some alter table begin
 
12928
---------------------------
 
12929
alter table t11
 
12930
reorganize partition p0,p1 into
 
12931
(partition s1 values less than maxvalue);
 
12932
select * from t11 order by col1;
 
12933
col1
 
12934
2000-02-17
 
12935
2002-02-15
 
12936
alter table t11
 
12937
reorganize partition s1 into
 
12938
(partition p0 values less than (15),
 
12939
partition p1 values less than maxvalue);
 
12940
select * from t11 order by col1;
 
12941
col1
 
12942
2000-02-17
 
12943
2002-02-15
 
12944
alter table t55
 
12945
partition by list(colint)
 
12946
subpartition by hash(year(col1)-1990) subpartitions 5 
 
12947
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
12948
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
12949
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
12950
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
12951
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
12952
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
12953
);
 
12954
show create table t55;
 
12955
Table   Create Table
 
12956
t55     CREATE TABLE `t55` (
 
12957
  `colint` int(11) DEFAULT NULL,
 
12958
  `col1` date DEFAULT NULL
 
12959
) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (year(col1)-1990) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
 
12960
select * from t55 order by colint;
 
12961
colint  col1
 
12962
1       2006-02-03
 
12963
2       2006-01-17
 
12964
3       2006-01-25
 
12965
4       2006-02-05
 
12966
alter table t66
 
12967
reorganize partition p0,p1 into
 
12968
(partition s1 values less than maxvalue);
 
12969
select * from t66 order by colint;
 
12970
colint  col1
 
12971
1       2006-02-03
 
12972
2       2006-01-17
 
12973
3       2006-01-25
 
12974
4       2006-02-05
 
12975
alter table t66
 
12976
reorganize partition s1 into
 
12977
(partition p0 values less than (year('2005-10-14')-1990),
 
12978
partition p1 values less than maxvalue);
 
12979
select * from t66 order by colint;
 
12980
colint  col1
 
12981
1       2006-02-03
 
12982
2       2006-01-17
 
12983
3       2006-01-25
 
12984
4       2006-02-05
 
12985
alter table t66
 
12986
reorganize partition p0,p1 into
 
12987
(partition s1 values less than maxvalue);
 
12988
select * from t66 order by colint;
 
12989
colint  col1
 
12990
1       2006-02-03
 
12991
2       2006-01-17
 
12992
3       2006-01-25
 
12993
4       2006-02-05
 
12994
alter table t66
 
12995
reorganize partition s1 into
 
12996
(partition p0 values less than (year('2005-10-14')-1990),
 
12997
partition p1 values less than maxvalue);
 
12998
select * from t66 order by colint;
 
12999
colint  col1
 
13000
1       2006-02-03
 
13001
2       2006-01-17
 
13002
3       2006-01-25
 
13003
4       2006-02-05
 
13004
-------------------------------------------------------------------------
 
13005
---  Delete rows and partitions of tables with year(col1)-1990
 
13006
-------------------------------------------------------------------------
 
13007
delete from t1 where col1='2000-02-17';
 
13008
delete from t2 where col1='2000-02-17';
 
13009
delete from t3 where col1='2000-02-17';
 
13010
delete from t4 where col1='2000-02-17';
 
13011
delete from t5 where col1='2000-02-17';
 
13012
delete from t6 where col1='2000-02-17';
 
13013
select * from t1 order by col1;
 
13014
col1
 
13015
2002-02-15
 
13016
select * from t2 order by col1;
 
13017
col1
 
13018
2002-02-15
 
13019
2004-05-25
 
13020
select * from t3 order by col1;
 
13021
col1
 
13022
2002-02-15
 
13023
2004-05-25
 
13024
select * from t4 order by colint;
 
13025
colint  col1
 
13026
1       2006-02-03
 
13027
2       2006-01-17
 
13028
3       2006-01-25
 
13029
4       2006-02-05
 
13030
select * from t5 order by colint;
 
13031
colint  col1
 
13032
1       2006-02-03
 
13033
2       2006-01-17
 
13034
3       2006-01-25
 
13035
4       2006-02-05
 
13036
insert into t1 values ('2000-02-17');
 
13037
insert into t2 values ('2000-02-17');
 
13038
insert into t3 values ('2000-02-17');
 
13039
insert into t4 values (60,'2000-02-17');
 
13040
insert into t5 values (60,'2000-02-17');
 
13041
insert into t6 values (60,'2000-02-17');
 
13042
select * from t1 order by col1;
 
13043
col1
 
13044
2000-02-17
 
13045
2002-02-15
 
13046
select * from t2 order by col1;
 
13047
col1
 
13048
2000-02-17
 
13049
2002-02-15
 
13050
2004-05-25
 
13051
select * from t3 order by col1;
 
13052
col1
 
13053
2000-02-17
 
13054
2002-02-15
 
13055
2004-05-25
 
13056
select * from t4 order by colint;
 
13057
colint  col1
 
13058
1       2006-02-03
 
13059
2       2006-01-17
 
13060
3       2006-01-25
 
13061
4       2006-02-05
 
13062
60      2000-02-17
 
13063
select * from t5 order by colint;
 
13064
colint  col1
 
13065
1       2006-02-03
 
13066
2       2006-01-17
 
13067
3       2006-01-25
 
13068
4       2006-02-05
 
13069
60      2000-02-17
 
13070
select * from t6 order by colint;
 
13071
colint  col1
 
13072
1       2006-02-03
 
13073
2       2006-01-17
 
13074
3       2006-01-25
 
13075
4       2006-02-05
 
13076
60      2000-02-17
 
13077
alter table t1 drop partition p0;
 
13078
alter table t2 drop partition p0;
 
13079
alter table t4 drop partition p0;
 
13080
alter table t5 drop partition p0;
 
13081
alter table t6 drop partition p0;
 
13082
select * from t1 order by col1;
 
13083
col1
 
13084
select * from t2 order by col1;
 
13085
col1
 
13086
2002-02-15
 
13087
2004-05-25
 
13088
select * from t3 order by col1;
 
13089
col1
 
13090
2000-02-17
 
13091
2002-02-15
 
13092
2004-05-25
 
13093
select * from t4 order by colint;
 
13094
colint  col1
 
13095
60      2000-02-17
 
13096
select * from t5 order by colint;
 
13097
colint  col1
 
13098
60      2000-02-17
 
13099
select * from t6 order by colint;
 
13100
colint  col1
 
13101
60      2000-02-17
 
13102
-------------------------------------------------------------------------
 
13103
---  Delete rows and partitions of tables with year(col1)-1990
 
13104
-------------------------------------------------------------------------
 
13105
delete from t11 where col1='2000-02-17';
 
13106
delete from t22 where col1='2000-02-17';
 
13107
delete from t33 where col1='2000-02-17';
 
13108
delete from t44 where col1='2000-02-17';
 
13109
delete from t55 where col1='2000-02-17';
 
13110
delete from t66 where col1='2000-02-17';
 
13111
select * from t11 order by col1;
 
13112
col1
 
13113
2002-02-15
 
13114
select * from t22 order by col1;
 
13115
col1
 
13116
2002-02-15
 
13117
2004-05-25
 
13118
select * from t33 order by col1;
 
13119
col1
 
13120
2002-02-15
 
13121
2004-05-25
 
13122
select * from t44 order by colint;
 
13123
colint  col1
 
13124
1       2006-02-03
 
13125
2       2006-01-17
 
13126
3       2006-01-25
 
13127
4       2006-02-05
 
13128
select * from t55 order by colint;
 
13129
colint  col1
 
13130
1       2006-02-03
 
13131
2       2006-01-17
 
13132
3       2006-01-25
 
13133
4       2006-02-05
 
13134
insert into t11 values ('2000-02-17');
 
13135
insert into t22 values ('2000-02-17');
 
13136
insert into t33 values ('2000-02-17');
 
13137
insert into t44 values (60,'2000-02-17');
 
13138
insert into t55 values (60,'2000-02-17');
 
13139
insert into t66 values (60,'2000-02-17');
 
13140
select * from t11 order by col1;
 
13141
col1
 
13142
2000-02-17
 
13143
2002-02-15
 
13144
select * from t22 order by col1;
 
13145
col1
 
13146
2000-02-17
 
13147
2002-02-15
 
13148
2004-05-25
 
13149
select * from t33 order by col1;
 
13150
col1
 
13151
2000-02-17
 
13152
2002-02-15
 
13153
2004-05-25
 
13154
select * from t44 order by colint;
 
13155
colint  col1
 
13156
1       2006-02-03
 
13157
2       2006-01-17
 
13158
3       2006-01-25
 
13159
4       2006-02-05
 
13160
60      2000-02-17
 
13161
select * from t55 order by colint;
 
13162
colint  col1
 
13163
1       2006-02-03
 
13164
2       2006-01-17
 
13165
3       2006-01-25
 
13166
4       2006-02-05
 
13167
60      2000-02-17
 
13168
select * from t66 order by colint;
 
13169
colint  col1
 
13170
1       2006-02-03
 
13171
2       2006-01-17
 
13172
3       2006-01-25
 
13173
4       2006-02-05
 
13174
60      2000-02-17
 
13175
alter table t11 drop partition p0;
 
13176
alter table t22 drop partition p0;
 
13177
alter table t44 drop partition p0;
 
13178
alter table t55 drop partition p0;
 
13179
alter table t66 drop partition p0;
 
13180
select * from t11 order by col1;
 
13181
col1
 
13182
select * from t22 order by col1;
 
13183
col1
 
13184
2002-02-15
 
13185
2004-05-25
 
13186
select * from t33 order by col1;
 
13187
col1
 
13188
2000-02-17
 
13189
2002-02-15
 
13190
2004-05-25
 
13191
select * from t44 order by colint;
 
13192
colint  col1
 
13193
60      2000-02-17
 
13194
select * from t55 order by colint;
 
13195
colint  col1
 
13196
60      2000-02-17
 
13197
select * from t66 order by colint;
 
13198
colint  col1
 
13199
60      2000-02-17
 
13200
-------------------------
 
13201
---- some alter table end
 
13202
-------------------------
 
13203
drop table if exists t1 ;
 
13204
drop table if exists t2 ;
 
13205
drop table if exists t3 ;
 
13206
drop table if exists t4 ;
 
13207
drop table if exists t5 ;
 
13208
drop table if exists t6 ;
 
13209
drop table if exists t11 ;
 
13210
drop table if exists t22 ;
 
13211
drop table if exists t33 ;
 
13212
drop table if exists t44 ;
 
13213
drop table if exists t55 ;
 
13214
drop table if exists t66 ;
 
13215
-------------------------------------------------------------------------
 
13216
---  yearweek(col1)-200600  in partition with coltype  date
 
13217
-------------------------------------------------------------------------
 
13218
drop table if exists t1 ;
 
13219
drop table if exists t2 ;
 
13220
drop table if exists t3 ;
 
13221
drop table if exists t4 ;
 
13222
drop table if exists t5 ;
 
13223
drop table if exists t6 ;
 
13224
-------------------------------------------------------------------------
 
13225
---  Create tables with yearweek(col1)-200600
 
13226
-------------------------------------------------------------------------
 
13227
create table t1 (col1 date) engine='NDB' 
 
13228
partition by range(yearweek(col1)-200600) 
 
13229
(partition p0 values less than (15),
 
13230
partition p1 values less than maxvalue);
 
13231
create table t2 (col1 date) engine='NDB' 
 
13232
partition by list(yearweek(col1)-200600) 
 
13233
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
13234
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
13235
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
13236
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
13237
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
13238
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
13239
);
 
13240
create table t3 (col1 date) engine='NDB' 
 
13241
partition by hash(yearweek(col1)-200600);
 
13242
create table t4 (colint int, col1 date) engine='NDB' 
 
13243
partition by range(colint) 
 
13244
subpartition by hash(yearweek(col1)-200600) subpartitions 2 
 
13245
(partition p0 values less than (15),
 
13246
partition p1 values less than maxvalue);
 
13247
create table t5 (colint int, col1 date) engine='NDB' 
 
13248
partition by list(colint)
 
13249
subpartition by hash(yearweek(col1)-200600) subpartitions 2 
 
13250
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
13251
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
13252
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
13253
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
13254
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
13255
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
13256
);
 
13257
create table t6 (colint int, col1 date) engine='NDB' 
 
13258
partition by range(colint) 
 
13259
(partition p0 values less than (yearweek('2006-10-14')-200600),
 
13260
partition p1 values less than maxvalue);
 
13261
-------------------------------------------------------------------------
 
13262
---  Access tables with yearweek(col1)-200600 
 
13263
-------------------------------------------------------------------------
 
13264
insert into t1 values ('2006-01-03');
 
13265
insert into t1 values ('2006-08-17');
 
13266
insert into t2 values ('2006-01-03');
 
13267
insert into t2 values ('2006-08-17');
 
13268
insert into t2 values ('2006-03-25');
 
13269
insert into t3 values ('2006-01-03');
 
13270
insert into t3 values ('2006-08-17');
 
13271
insert into t3 values ('2006-03-25');
 
13272
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
 
13273
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
 
13274
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
 
13275
select yearweek(col1)-200600 from t1 order by col1;
 
13276
yearweek(col1)-200600
 
13277
1
 
13278
33
 
13279
select * from t1 order by col1;
 
13280
col1
 
13281
2006-01-03
 
13282
2006-08-17
 
13283
select * from t2 order by col1;
 
13284
col1
 
13285
2006-01-03
 
13286
2006-03-25
 
13287
2006-08-17
 
13288
select * from t3 order by col1;
 
13289
col1
 
13290
2006-01-03
 
13291
2006-03-25
 
13292
2006-08-17
 
13293
select * from t4 order by colint;
 
13294
colint  col1
 
13295
1       2006-02-03
 
13296
2       2006-01-17
 
13297
3       2006-01-25
 
13298
4       2006-02-05
 
13299
select * from t5 order by colint;
 
13300
colint  col1
 
13301
1       2006-02-03
 
13302
2       2006-01-17
 
13303
3       2006-01-25
 
13304
4       2006-02-05
 
13305
select * from t6 order by colint;
 
13306
colint  col1
 
13307
1       2006-02-03
 
13308
2       2006-01-17
 
13309
3       2006-01-25
 
13310
4       2006-02-05
 
13311
update t1 set col1='2006-11-15' where col1='2006-01-03';
 
13312
update t2 set col1='2006-11-15' where col1='2006-01-03';
 
13313
update t3 set col1='2006-11-15' where col1='2006-01-03';
 
13314
update t4 set col1='2006-11-15' where col1='2006-01-03';
 
13315
update t5 set col1='2006-11-15' where col1='2006-01-03';
 
13316
update t6 set col1='2006-11-15' where col1='2006-01-03';
 
13317
select * from t1 order by col1;
 
13318
col1
 
13319
2006-08-17
 
13320
2006-11-15
 
13321
select * from t2 order by col1;
 
13322
col1
 
13323
2006-03-25
 
13324
2006-08-17
 
13325
2006-11-15
 
13326
select * from t3 order by col1;
 
13327
col1
 
13328
2006-03-25
 
13329
2006-08-17
 
13330
2006-11-15
 
13331
select * from t4 order by colint;
 
13332
colint  col1
 
13333
1       2006-02-03
 
13334
2       2006-01-17
 
13335
3       2006-01-25
 
13336
4       2006-02-05
 
13337
select * from t5 order by colint;
 
13338
colint  col1
 
13339
1       2006-02-03
 
13340
2       2006-01-17
 
13341
3       2006-01-25
 
13342
4       2006-02-05
 
13343
select * from t6 order by colint;
 
13344
colint  col1
 
13345
1       2006-02-03
 
13346
2       2006-01-17
 
13347
3       2006-01-25
 
13348
4       2006-02-05
 
13349
-------------------------------------------------------------------------
 
13350
---  Alter tables with yearweek(col1)-200600
 
13351
-------------------------------------------------------------------------
 
13352
drop table if exists t11 ;
 
13353
drop table if exists t22 ;
 
13354
drop table if exists t33 ;
 
13355
drop table if exists t44 ;
 
13356
drop table if exists t55 ;
 
13357
drop table if exists t66 ;
 
13358
create table t11 engine='NDB' as select * from t1;
 
13359
create table t22 engine='NDB' as select * from t2;
 
13360
create table t33 engine='NDB' as select * from t3;
 
13361
create table t44 engine='NDB' as select * from t4;
 
13362
create table t55 engine='NDB' as select * from t5;
 
13363
create table t66 engine='NDB' as select * from t6;
 
13364
alter table t11
 
13365
partition by range(yearweek(col1)-200600) 
 
13366
(partition p0 values less than (15),
 
13367
partition p1 values less than maxvalue);
 
13368
alter table t22
 
13369
partition by list(yearweek(col1)-200600) 
 
13370
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
 
13371
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
13372
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
13373
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
13374
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
13375
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
13376
);
 
13377
alter table t33
 
13378
partition by hash(yearweek(col1)-200600);
 
13379
alter table t44
 
13380
partition by range(colint) 
 
13381
subpartition by hash(yearweek(col1)-200600) subpartitions 2 
 
13382
(partition p0 values less than (15),
 
13383
partition p1 values less than maxvalue);
 
13384
alter table t55
 
13385
partition by list(colint)
 
13386
subpartition by hash(yearweek(col1)-200600) subpartitions 2 
 
13387
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
13388
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
13389
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
13390
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
13391
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
13392
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
13393
);
 
13394
alter table t66
 
13395
partition by range(colint) 
 
13396
(partition p0 values less than (yearweek('2006-10-14')-200600),
 
13397
partition p1 values less than maxvalue);
 
13398
select * from t11 order by col1;
 
13399
col1
 
13400
2006-08-17
 
13401
2006-11-15
 
13402
select * from t22 order by col1;
 
13403
col1
 
13404
2006-03-25
 
13405
2006-08-17
 
13406
2006-11-15
 
13407
select * from t33 order by col1;
 
13408
col1
 
13409
2006-03-25
 
13410
2006-08-17
 
13411
2006-11-15
 
13412
select * from t44 order by colint;
 
13413
colint  col1
 
13414
1       2006-02-03
 
13415
2       2006-01-17
 
13416
3       2006-01-25
 
13417
4       2006-02-05
 
13418
select * from t55 order by colint;
 
13419
colint  col1
 
13420
1       2006-02-03
 
13421
2       2006-01-17
 
13422
3       2006-01-25
 
13423
4       2006-02-05
 
13424
select * from t66 order by colint;
 
13425
colint  col1
 
13426
1       2006-02-03
 
13427
2       2006-01-17
 
13428
3       2006-01-25
 
13429
4       2006-02-05
 
13430
---------------------------
 
13431
---- some alter table begin
 
13432
---------------------------
 
13433
alter table t11
 
13434
reorganize partition p0,p1 into
 
13435
(partition s1 values less than maxvalue);
 
13436
select * from t11 order by col1;
 
13437
col1
 
13438
2006-08-17
 
13439
2006-11-15
 
13440
alter table t11
 
13441
reorganize partition s1 into
 
13442
(partition p0 values less than (15),
 
13443
partition p1 values less than maxvalue);
 
13444
select * from t11 order by col1;
 
13445
col1
 
13446
2006-08-17
 
13447
2006-11-15
 
13448
alter table t55
 
13449
partition by list(colint)
 
13450
subpartition by hash(yearweek(col1)-200600) subpartitions 5 
 
13451
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
 
13452
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
 
13453
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
 
13454
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
 
13455
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
 
13456
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
 
13457
);
 
13458
show create table t55;
 
13459
Table   Create Table
 
13460
t55     CREATE TABLE `t55` (
 
13461
  `colint` int(11) DEFAULT NULL,
 
13462
  `col1` date DEFAULT NULL
 
13463
) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (yearweek(col1)-200600) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
 
13464
select * from t55 order by colint;
 
13465
colint  col1
 
13466
1       2006-02-03
 
13467
2       2006-01-17
 
13468
3       2006-01-25
 
13469
4       2006-02-05
 
13470
alter table t66
 
13471
reorganize partition p0,p1 into
 
13472
(partition s1 values less than maxvalue);
 
13473
select * from t66 order by colint;
 
13474
colint  col1
 
13475
1       2006-02-03
 
13476
2       2006-01-17
 
13477
3       2006-01-25
 
13478
4       2006-02-05
 
13479
alter table t66
 
13480
reorganize partition s1 into
 
13481
(partition p0 values less than (yearweek('2006-10-14')-200600),
 
13482
partition p1 values less than maxvalue);
 
13483
select * from t66 order by colint;
 
13484
colint  col1
 
13485
1       2006-02-03
 
13486
2       2006-01-17
 
13487
3       2006-01-25
 
13488
4       2006-02-05
 
13489
alter table t66
 
13490
reorganize partition p0,p1 into
 
13491
(partition s1 values less than maxvalue);
 
13492
select * from t66 order by colint;
 
13493
colint  col1
 
13494
1       2006-02-03
 
13495
2       2006-01-17
 
13496
3       2006-01-25
 
13497
4       2006-02-05
 
13498
alter table t66
 
13499
reorganize partition s1 into
 
13500
(partition p0 values less than (yearweek('2006-10-14')-200600),
 
13501
partition p1 values less than maxvalue);
 
13502
select * from t66 order by colint;
 
13503
colint  col1
 
13504
1       2006-02-03
 
13505
2       2006-01-17
 
13506
3       2006-01-25
 
13507
4       2006-02-05
 
13508
-------------------------------------------------------------------------
 
13509
---  Delete rows and partitions of tables with yearweek(col1)-200600
 
13510
-------------------------------------------------------------------------
 
13511
delete from t1 where col1='2006-08-17';
 
13512
delete from t2 where col1='2006-08-17';
 
13513
delete from t3 where col1='2006-08-17';
 
13514
delete from t4 where col1='2006-08-17';
 
13515
delete from t5 where col1='2006-08-17';
 
13516
delete from t6 where col1='2006-08-17';
 
13517
select * from t1 order by col1;
 
13518
col1
 
13519
2006-11-15
 
13520
select * from t2 order by col1;
 
13521
col1
 
13522
2006-03-25
 
13523
2006-11-15
 
13524
select * from t3 order by col1;
 
13525
col1
 
13526
2006-03-25
 
13527
2006-11-15
 
13528
select * from t4 order by colint;
 
13529
colint  col1
 
13530
1       2006-02-03
 
13531
2       2006-01-17
 
13532
3       2006-01-25
 
13533
4       2006-02-05
 
13534
select * from t5 order by colint;
 
13535
colint  col1
 
13536
1       2006-02-03
 
13537
2       2006-01-17
 
13538
3       2006-01-25
 
13539
4       2006-02-05
 
13540
insert into t1 values ('2006-08-17');
 
13541
insert into t2 values ('2006-08-17');
 
13542
insert into t3 values ('2006-08-17');
 
13543
insert into t4 values (60,'2006-08-17');
 
13544
insert into t5 values (60,'2006-08-17');
 
13545
insert into t6 values (60,'2006-08-17');
 
13546
select * from t1 order by col1;
 
13547
col1
 
13548
2006-08-17
 
13549
2006-11-15
 
13550
select * from t2 order by col1;
 
13551
col1
 
13552
2006-03-25
 
13553
2006-08-17
 
13554
2006-11-15
 
13555
select * from t3 order by col1;
 
13556
col1
 
13557
2006-03-25
 
13558
2006-08-17
 
13559
2006-11-15
 
13560
select * from t4 order by colint;
 
13561
colint  col1
 
13562
1       2006-02-03
 
13563
2       2006-01-17
 
13564
3       2006-01-25
 
13565
4       2006-02-05
 
13566
60      2006-08-17
 
13567
select * from t5 order by colint;
 
13568
colint  col1
 
13569
1       2006-02-03
 
13570
2       2006-01-17
 
13571
3       2006-01-25
 
13572
4       2006-02-05
 
13573
60      2006-08-17
 
13574
select * from t6 order by colint;
 
13575
colint  col1
 
13576
1       2006-02-03
 
13577
2       2006-01-17
 
13578
3       2006-01-25
 
13579
4       2006-02-05
 
13580
60      2006-08-17
 
13581
alter table t1 drop partition p0;
 
13582
alter table t2 drop partition p0;
 
13583
alter table t4 drop partition p0;
 
13584
alter table t5 drop partition p0;
 
13585
alter table t6 drop partition p0;
 
13586
select * from t1 order by col1;
 
13587
col1
 
13588
2006-08-17
 
13589
2006-11-15
 
13590
select * from t2 order by col1;
 
13591
col1
 
13592
2006-03-25
 
13593
2006-08-17
 
13594
2006-11-15
 
13595
select * from t3 order by col1;
 
13596
col1
 
13597
2006-03-25
 
13598
2006-08-17
 
13599
2006-11-15
 
13600
select * from t4 order by colint;
 
13601
colint  col1
 
13602
60      2006-08-17
 
13603
select * from t5 order by colint;
 
13604
colint  col1
 
13605
60      2006-08-17
 
13606
select * from t6 order by colint;
 
13607
colint  col1
 
13608
60      2006-08-17
 
13609
-------------------------------------------------------------------------
 
13610
---  Delete rows and partitions of tables with yearweek(col1)-200600
 
13611
-------------------------------------------------------------------------
 
13612
delete from t11 where col1='2006-08-17';
 
13613
delete from t22 where col1='2006-08-17';
 
13614
delete from t33 where col1='2006-08-17';
 
13615
delete from t44 where col1='2006-08-17';
 
13616
delete from t55 where col1='2006-08-17';
 
13617
delete from t66 where col1='2006-08-17';
 
13618
select * from t11 order by col1;
 
13619
col1
 
13620
2006-11-15
 
13621
select * from t22 order by col1;
 
13622
col1
 
13623
2006-03-25
 
13624
2006-11-15
 
13625
select * from t33 order by col1;
 
13626
col1
 
13627
2006-03-25
 
13628
2006-11-15
 
13629
select * from t44 order by colint;
 
13630
colint  col1
 
13631
1       2006-02-03
 
13632
2       2006-01-17
 
13633
3       2006-01-25
 
13634
4       2006-02-05
 
13635
select * from t55 order by colint;
 
13636
colint  col1
 
13637
1       2006-02-03
 
13638
2       2006-01-17
 
13639
3       2006-01-25
 
13640
4       2006-02-05
 
13641
insert into t11 values ('2006-08-17');
 
13642
insert into t22 values ('2006-08-17');
 
13643
insert into t33 values ('2006-08-17');
 
13644
insert into t44 values (60,'2006-08-17');
 
13645
insert into t55 values (60,'2006-08-17');
 
13646
insert into t66 values (60,'2006-08-17');
 
13647
select * from t11 order by col1;
 
13648
col1
 
13649
2006-08-17
 
13650
2006-11-15
 
13651
select * from t22 order by col1;
 
13652
col1
 
13653
2006-03-25
 
13654
2006-08-17
 
13655
2006-11-15
 
13656
select * from t33 order by col1;
 
13657
col1
 
13658
2006-03-25
 
13659
2006-08-17
 
13660
2006-11-15
 
13661
select * from t44 order by colint;
 
13662
colint  col1
 
13663
1       2006-02-03
 
13664
2       2006-01-17
 
13665
3       2006-01-25
 
13666
4       2006-02-05
 
13667
60      2006-08-17
 
13668
select * from t55 order by colint;
 
13669
colint  col1
 
13670
1       2006-02-03
 
13671
2       2006-01-17
 
13672
3       2006-01-25
 
13673
4       2006-02-05
 
13674
60      2006-08-17
 
13675
select * from t66 order by colint;
 
13676
colint  col1
 
13677
1       2006-02-03
 
13678
2       2006-01-17
 
13679
3       2006-01-25
 
13680
4       2006-02-05
 
13681
60      2006-08-17
 
13682
alter table t11 drop partition p0;
 
13683
alter table t22 drop partition p0;
 
13684
alter table t44 drop partition p0;
 
13685
alter table t55 drop partition p0;
 
13686
alter table t66 drop partition p0;
 
13687
select * from t11 order by col1;
 
13688
col1
 
13689
2006-08-17
 
13690
2006-11-15
 
13691
select * from t22 order by col1;
 
13692
col1
 
13693
2006-03-25
 
13694
2006-08-17
 
13695
2006-11-15
 
13696
select * from t33 order by col1;
 
13697
col1
 
13698
2006-03-25
 
13699
2006-08-17
 
13700
2006-11-15
 
13701
select * from t44 order by colint;
 
13702
colint  col1
 
13703
60      2006-08-17
 
13704
select * from t55 order by colint;
 
13705
colint  col1
 
13706
60      2006-08-17
 
13707
select * from t66 order by colint;
 
13708
colint  col1
 
13709
60      2006-08-17
 
13710
-------------------------
 
13711
---- some alter table end
 
13712
-------------------------
 
13713
drop table if exists t1 ;
 
13714
drop table if exists t2 ;
 
13715
drop table if exists t3 ;
 
13716
drop table if exists t4 ;
 
13717
drop table if exists t5 ;
 
13718
drop table if exists t6 ;
 
13719
drop table if exists t11 ;
 
13720
drop table if exists t22 ;
 
13721
drop table if exists t33 ;
 
13722
drop table if exists t44 ;
 
13723
drop table if exists t55 ;
 
13724
drop table if exists t66 ;