mySQL 5.0.11 sources for tomato
[tomato.git] / release / src / router / mysql / mysql-test / suite / parts / r / part_supported_sql_func_ndb.result
bloba1e10ee4a9caca4e70c0dca009420c8802f9dc3c
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)
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 (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15),
37 partition p1 values in (16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
38 partition p2 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45),
39 partition p3 values in (46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
41 create table t6 (colint int, col1 int) engine='NDB' 
42 partition by range(colint) 
43 (partition p0 values less than (abs(15)),
44 partition p1 values less than maxvalue);
45 -------------------------------------------------------------------------
46 ---  Access tables with abs(col1) 
47 -------------------------------------------------------------------------
48 insert into t1 values (5 );
49 insert into t1 values (13 );
50 insert into t2 values (5 );
51 insert into t2 values (13 );
52 insert into t2 values (17 );
53 insert into t3 values (5 );
54 insert into t3 values (13 );
55 insert into t3 values (17 );
56 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_int.inc' into table t4;
57 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_int.inc' into table t5;
58 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_int.inc' into table t6;
59 select abs(col1) from t1 order by col1;
60 abs(col1)
63 select * from t1 order by col1;
64 col1
67 select * from t2 order by col1;
68 col1
72 select * from t3 order by col1;
73 col1
77 select * from t4 order by colint;
78 colint  col1
79 1       5
80 2       13
81 3       15
82 4       17
83 5       23
84 6       34
85 7       56
86 8       56
87 9       45
88 10      34
89 11      78
90 12      89
91 13      67
92 14      46
93 15      34
94 16      324
95 17      345
96 18      34
97 19      78
98 20      567
99 21      4
100 22      435
101 23      34
102 24      45
103 25      4565
104 26      4
105 27      3
106 28      2
107 29      3
108 30      5
109 31      6
110 32      8
111 33      9
112 34      745
113 35      34
114 36      34
115 37      324
116 38      67
117 39      78
118 40      89
119 41      90
120 42      78967
121 50      56
122 51      34
123 55      123
124 select * from t5 order by colint;
125 colint  col1
126 1       5
127 2       13
128 3       15
129 4       17
130 5       23
131 6       34
132 7       56
133 8       56
134 9       45
135 10      34
136 11      78
137 12      89
138 13      67
139 14      46
140 15      34
141 16      324
142 17      345
143 18      34
144 19      78
145 20      567
146 21      4
147 22      435
148 23      34
149 24      45
150 25      4565
151 26      4
152 27      3
153 28      2
154 29      3
155 30      5
156 31      6
157 32      8
158 33      9
159 34      745
160 35      34
161 36      34
162 37      324
163 38      67
164 39      78
165 40      89
166 41      90
167 42      78967
168 50      56
169 51      34
170 55      123
171 select * from t6 order by colint;
172 colint  col1
173 1       5
174 2       13
175 3       15
176 4       17
177 5       23
178 6       34
179 7       56
180 8       56
181 9       45
182 10      34
183 11      78
184 12      89
185 13      67
186 14      46
187 15      34
188 16      324
189 17      345
190 18      34
191 19      78
192 20      567
193 21      4
194 22      435
195 23      34
196 24      45
197 25      4565
198 26      4
199 27      3
200 28      2
201 29      3
202 30      5
203 31      6
204 32      8
205 33      9
206 34      745
207 35      34
208 36      34
209 37      324
210 38      67
211 39      78
212 40      89
213 41      90
214 42      78967
215 50      56
216 51      34
217 55      123
218 update t1 set col1=15  where col1=5 ;
219 update t2 set col1=15  where col1=5 ;
220 update t3 set col1=15  where col1=5 ;
221 update t4 set col1=15  where col1=5 ;
222 update t5 set col1=15  where col1=5 ;
223 update t6 set col1=15  where col1=5 ;
224 select * from t1 order by col1;
225 col1
228 select * from t2 order by col1;
229 col1
233 select * from t3 order by col1;
234 col1
238 select * from t4 order by colint;
239 colint  col1
240 1       15
241 2       13
242 3       15
243 4       17
244 5       23
245 6       34
246 7       56
247 8       56
248 9       45
249 10      34
250 11      78
251 12      89
252 13      67
253 14      46
254 15      34
255 16      324
256 17      345
257 18      34
258 19      78
259 20      567
260 21      4
261 22      435
262 23      34
263 24      45
264 25      4565
265 26      4
266 27      3
267 28      2
268 29      3
269 30      15
270 31      6
271 32      8
272 33      9
273 34      745
274 35      34
275 36      34
276 37      324
277 38      67
278 39      78
279 40      89
280 41      90
281 42      78967
282 50      56
283 51      34
284 55      123
285 select * from t5 order by colint;
286 colint  col1
287 1       15
288 2       13
289 3       15
290 4       17
291 5       23
292 6       34
293 7       56
294 8       56
295 9       45
296 10      34
297 11      78
298 12      89
299 13      67
300 14      46
301 15      34
302 16      324
303 17      345
304 18      34
305 19      78
306 20      567
307 21      4
308 22      435
309 23      34
310 24      45
311 25      4565
312 26      4
313 27      3
314 28      2
315 29      3
316 30      15
317 31      6
318 32      8
319 33      9
320 34      745
321 35      34
322 36      34
323 37      324
324 38      67
325 39      78
326 40      89
327 41      90
328 42      78967
329 50      56
330 51      34
331 55      123
332 select * from t6 order by colint;
333 colint  col1
334 1       15
335 2       13
336 3       15
337 4       17
338 5       23
339 6       34
340 7       56
341 8       56
342 9       45
343 10      34
344 11      78
345 12      89
346 13      67
347 14      46
348 15      34
349 16      324
350 17      345
351 18      34
352 19      78
353 20      567
354 21      4
355 22      435
356 23      34
357 24      45
358 25      4565
359 26      4
360 27      3
361 28      2
362 29      3
363 30      15
364 31      6
365 32      8
366 33      9
367 34      745
368 35      34
369 36      34
370 37      324
371 38      67
372 39      78
373 40      89
374 41      90
375 42      78967
376 50      56
377 51      34
378 55      123
379 -------------------------------------------------------------------------
380 ---  Alter tables with abs(col1)
381 -------------------------------------------------------------------------
382 drop table if exists t11 ;
383 drop table if exists t22 ;
384 drop table if exists t33 ;
385 drop table if exists t44 ;
386 drop table if exists t55 ;
387 drop table if exists t66 ;
388 create table t11 engine='NDB' as select * from t1;
389 create table t22 engine='NDB' as select * from t2;
390 create table t33 engine='NDB' as select * from t3;
391 create table t44 engine='NDB' as select * from t4;
392 create table t55 engine='NDB' as select * from t5;
393 create table t66 engine='NDB' as select * from t6;
394 alter table t11
395 partition by range(abs(col1)) 
396 (partition p0 values less than (15),
397 partition p1 values less than maxvalue);
398 alter table t22
399 partition by list(abs(col1)) 
400 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
401 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
402 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
403 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
404 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
405 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
407 alter table t33
408 partition by hash(abs(col1));
409 alter table t44
410 partition by range(colint) 
411 subpartition by hash(abs(col1)) subpartitions 2 
412 (partition p0 values less than (15),
413 partition p1 values less than maxvalue);
414 alter table t55
415 partition by list(colint) 
416 subpartition by hash(abs(col1)) subpartitions 2 
417 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15),
418 partition p1 values in (16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
419 partition p2 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45),
420 partition p3 values in (46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
422 alter table t66
423 partition by range(colint) 
424 (partition p0 values less than (abs(15)),
425 partition p1 values less than maxvalue);
426 select * from t11 order by col1;
427 col1
430 select * from t22 order by col1;
431 col1
435 select * from t33 order by col1;
436 col1
440 select * from t44 order by colint;
441 colint  col1
442 1       15
443 2       13
444 3       15
445 4       17
446 5       23
447 6       34
448 7       56
449 8       56
450 9       45
451 10      34
452 11      78
453 12      89
454 13      67
455 14      46
456 15      34
457 16      324
458 17      345
459 18      34
460 19      78
461 20      567
462 21      4
463 22      435
464 23      34
465 24      45
466 25      4565
467 26      4
468 27      3
469 28      2
470 29      3
471 30      15
472 31      6
473 32      8
474 33      9
475 34      745
476 35      34
477 36      34
478 37      324
479 38      67
480 39      78
481 40      89
482 41      90
483 42      78967
484 50      56
485 51      34
486 55      123
487 select * from t55 order by colint;
488 colint  col1
489 1       15
490 2       13
491 3       15
492 4       17
493 5       23
494 6       34
495 7       56
496 8       56
497 9       45
498 10      34
499 11      78
500 12      89
501 13      67
502 14      46
503 15      34
504 16      324
505 17      345
506 18      34
507 19      78
508 20      567
509 21      4
510 22      435
511 23      34
512 24      45
513 25      4565
514 26      4
515 27      3
516 28      2
517 29      3
518 30      15
519 31      6
520 32      8
521 33      9
522 34      745
523 35      34
524 36      34
525 37      324
526 38      67
527 39      78
528 40      89
529 41      90
530 42      78967
531 50      56
532 51      34
533 55      123
534 select * from t66 order by colint;
535 colint  col1
536 1       15
537 2       13
538 3       15
539 4       17
540 5       23
541 6       34
542 7       56
543 8       56
544 9       45
545 10      34
546 11      78
547 12      89
548 13      67
549 14      46
550 15      34
551 16      324
552 17      345
553 18      34
554 19      78
555 20      567
556 21      4
557 22      435
558 23      34
559 24      45
560 25      4565
561 26      4
562 27      3
563 28      2
564 29      3
565 30      15
566 31      6
567 32      8
568 33      9
569 34      745
570 35      34
571 36      34
572 37      324
573 38      67
574 39      78
575 40      89
576 41      90
577 42      78967
578 50      56
579 51      34
580 55      123
581 ---------------------------
582 ---- some alter table begin
583 ---------------------------
584 alter table t55
585 partition by list(colint) 
586 subpartition by hash(abs(col1)) subpartitions 4 
587 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
588 partition p1 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
590 show create table t55;
591 Table   Create Table
592 t55     CREATE TABLE `t55` (
593   `colint` int(11) DEFAULT NULL,
594   `col1` int(11) DEFAULT NULL
595 ) ENGINE=ndbcluster DEFAULT CHARSET=latin1
596 /*!50100 PARTITION BY LIST (colint)
597 SUBPARTITION BY HASH (abs(col1))
598 SUBPARTITIONS 4
599 (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30) ENGINE = ndbcluster,
600  PARTITION p1 VALUES IN (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60) ENGINE = ndbcluster) */
601 select * from t55 order by colint;
602 colint  col1
603 1       15
604 2       13
605 3       15
606 4       17
607 5       23
608 6       34
609 7       56
610 8       56
611 9       45
612 10      34
613 11      78
614 12      89
615 13      67
616 14      46
617 15      34
618 16      324
619 17      345
620 18      34
621 19      78
622 20      567
623 21      4
624 22      435
625 23      34
626 24      45
627 25      4565
628 26      4
629 27      3
630 28      2
631 29      3
632 30      15
633 31      6
634 32      8
635 33      9
636 34      745
637 35      34
638 36      34
639 37      324
640 38      67
641 39      78
642 40      89
643 41      90
644 42      78967
645 50      56
646 51      34
647 55      123
648 -------------------------------------------------------------------------
649 ---  Delete rows and partitions of tables with abs(col1)
650 -------------------------------------------------------------------------
651 delete from t1 where col1=13 ;
652 delete from t2 where col1=13 ;
653 delete from t3 where col1=13 ;
654 delete from t4 where col1=13 ;
655 delete from t5 where col1=13 ;
656 delete from t6 where col1=13 ;
657 select * from t1 order by col1;
658 col1
660 select * from t2 order by col1;
661 col1
664 select * from t3 order by col1;
665 col1
668 select * from t4 order by colint;
669 colint  col1
670 1       15
671 3       15
672 4       17
673 5       23
674 6       34
675 7       56
676 8       56
677 9       45
678 10      34
679 11      78
680 12      89
681 13      67
682 14      46
683 15      34
684 16      324
685 17      345
686 18      34
687 19      78
688 20      567
689 21      4
690 22      435
691 23      34
692 24      45
693 25      4565
694 26      4
695 27      3
696 28      2
697 29      3
698 30      15
699 31      6
700 32      8
701 33      9
702 34      745
703 35      34
704 36      34
705 37      324
706 38      67
707 39      78
708 40      89
709 41      90
710 42      78967
711 50      56
712 51      34
713 55      123
714 select * from t5 order by colint;
715 colint  col1
716 1       15
717 3       15
718 4       17
719 5       23
720 6       34
721 7       56
722 8       56
723 9       45
724 10      34
725 11      78
726 12      89
727 13      67
728 14      46
729 15      34
730 16      324
731 17      345
732 18      34
733 19      78
734 20      567
735 21      4
736 22      435
737 23      34
738 24      45
739 25      4565
740 26      4
741 27      3
742 28      2
743 29      3
744 30      15
745 31      6
746 32      8
747 33      9
748 34      745
749 35      34
750 36      34
751 37      324
752 38      67
753 39      78
754 40      89
755 41      90
756 42      78967
757 50      56
758 51      34
759 55      123
760 insert into t1 values (13 );
761 insert into t2 values (13 );
762 insert into t3 values (13 );
763 insert into t4 values (60,13 );
764 insert into t5 values (60,13 );
765 insert into t6 values (60,13 );
766 select * from t1 order by col1;
767 col1
770 select * from t2 order by col1;
771 col1
775 select * from t3 order by col1;
776 col1
780 select * from t4 order by colint;
781 colint  col1
782 1       15
783 3       15
784 4       17
785 5       23
786 6       34
787 7       56
788 8       56
789 9       45
790 10      34
791 11      78
792 12      89
793 13      67
794 14      46
795 15      34
796 16      324
797 17      345
798 18      34
799 19      78
800 20      567
801 21      4
802 22      435
803 23      34
804 24      45
805 25      4565
806 26      4
807 27      3
808 28      2
809 29      3
810 30      15
811 31      6
812 32      8
813 33      9
814 34      745
815 35      34
816 36      34
817 37      324
818 38      67
819 39      78
820 40      89
821 41      90
822 42      78967
823 50      56
824 51      34
825 55      123
826 60      13
827 select * from t5 order by colint;
828 colint  col1
829 1       15
830 3       15
831 4       17
832 5       23
833 6       34
834 7       56
835 8       56
836 9       45
837 10      34
838 11      78
839 12      89
840 13      67
841 14      46
842 15      34
843 16      324
844 17      345
845 18      34
846 19      78
847 20      567
848 21      4
849 22      435
850 23      34
851 24      45
852 25      4565
853 26      4
854 27      3
855 28      2
856 29      3
857 30      15
858 31      6
859 32      8
860 33      9
861 34      745
862 35      34
863 36      34
864 37      324
865 38      67
866 39      78
867 40      89
868 41      90
869 42      78967
870 50      56
871 51      34
872 55      123
873 60      13
874 select * from t6 order by colint;
875 colint  col1
876 1       15
877 3       15
878 4       17
879 5       23
880 6       34
881 7       56
882 8       56
883 9       45
884 10      34
885 11      78
886 12      89
887 13      67
888 14      46
889 15      34
890 16      324
891 17      345
892 18      34
893 19      78
894 20      567
895 21      4
896 22      435
897 23      34
898 24      45
899 25      4565
900 26      4
901 27      3
902 28      2
903 29      3
904 30      15
905 31      6
906 32      8
907 33      9
908 34      745
909 35      34
910 36      34
911 37      324
912 38      67
913 39      78
914 40      89
915 41      90
916 42      78967
917 50      56
918 51      34
919 55      123
920 60      13
921 -------------------------------------------------------------------------
922 ---  Delete rows and partitions of tables with abs(col1)
923 -------------------------------------------------------------------------
924 delete from t11 where col1=13 ;
925 delete from t22 where col1=13 ;
926 delete from t33 where col1=13 ;
927 delete from t44 where col1=13 ;
928 delete from t55 where col1=13 ;
929 delete from t66 where col1=13 ;
930 select * from t11 order by col1;
931 col1
933 select * from t22 order by col1;
934 col1
937 select * from t33 order by col1;
938 col1
941 select * from t44 order by colint;
942 colint  col1
943 1       15
944 3       15
945 4       17
946 5       23
947 6       34
948 7       56
949 8       56
950 9       45
951 10      34
952 11      78
953 12      89
954 13      67
955 14      46
956 15      34
957 16      324
958 17      345
959 18      34
960 19      78
961 20      567
962 21      4
963 22      435
964 23      34
965 24      45
966 25      4565
967 26      4
968 27      3
969 28      2
970 29      3
971 30      15
972 31      6
973 32      8
974 33      9
975 34      745
976 35      34
977 36      34
978 37      324
979 38      67
980 39      78
981 40      89
982 41      90
983 42      78967
984 50      56
985 51      34
986 55      123
987 select * from t55 order by colint;
988 colint  col1
989 1       15
990 3       15
991 4       17
992 5       23
993 6       34
994 7       56
995 8       56
996 9       45
997 10      34
998 11      78
999 12      89
1000 13      67
1001 14      46
1002 15      34
1003 16      324
1004 17      345
1005 18      34
1006 19      78
1007 20      567
1008 21      4
1009 22      435
1010 23      34
1011 24      45
1012 25      4565
1013 26      4
1014 27      3
1015 28      2
1016 29      3
1017 30      15
1018 31      6
1019 32      8
1020 33      9
1021 34      745
1022 35      34
1023 36      34
1024 37      324
1025 38      67
1026 39      78
1027 40      89
1028 41      90
1029 42      78967
1030 50      56
1031 51      34
1032 55      123
1033 insert into t11 values (13 );
1034 insert into t22 values (13 );
1035 insert into t33 values (13 );
1036 insert into t44 values (60,13 );
1037 insert into t55 values (60,13 );
1038 insert into t66 values (60,13 );
1039 select * from t11 order by col1;
1040 col1
1043 select * from t22 order by col1;
1044 col1
1048 select * from t33 order by col1;
1049 col1
1053 select * from t44 order by colint;
1054 colint  col1
1055 1       15
1056 3       15
1057 4       17
1058 5       23
1059 6       34
1060 7       56
1061 8       56
1062 9       45
1063 10      34
1064 11      78
1065 12      89
1066 13      67
1067 14      46
1068 15      34
1069 16      324
1070 17      345
1071 18      34
1072 19      78
1073 20      567
1074 21      4
1075 22      435
1076 23      34
1077 24      45
1078 25      4565
1079 26      4
1080 27      3
1081 28      2
1082 29      3
1083 30      15
1084 31      6
1085 32      8
1086 33      9
1087 34      745
1088 35      34
1089 36      34
1090 37      324
1091 38      67
1092 39      78
1093 40      89
1094 41      90
1095 42      78967
1096 50      56
1097 51      34
1098 55      123
1099 60      13
1100 select * from t55 order by colint;
1101 colint  col1
1102 1       15
1103 3       15
1104 4       17
1105 5       23
1106 6       34
1107 7       56
1108 8       56
1109 9       45
1110 10      34
1111 11      78
1112 12      89
1113 13      67
1114 14      46
1115 15      34
1116 16      324
1117 17      345
1118 18      34
1119 19      78
1120 20      567
1121 21      4
1122 22      435
1123 23      34
1124 24      45
1125 25      4565
1126 26      4
1127 27      3
1128 28      2
1129 29      3
1130 30      15
1131 31      6
1132 32      8
1133 33      9
1134 34      745
1135 35      34
1136 36      34
1137 37      324
1138 38      67
1139 39      78
1140 40      89
1141 41      90
1142 42      78967
1143 50      56
1144 51      34
1145 55      123
1146 60      13
1147 select * from t66 order by colint;
1148 colint  col1
1149 1       15
1150 3       15
1151 4       17
1152 5       23
1153 6       34
1154 7       56
1155 8       56
1156 9       45
1157 10      34
1158 11      78
1159 12      89
1160 13      67
1161 14      46
1162 15      34
1163 16      324
1164 17      345
1165 18      34
1166 19      78
1167 20      567
1168 21      4
1169 22      435
1170 23      34
1171 24      45
1172 25      4565
1173 26      4
1174 27      3
1175 28      2
1176 29      3
1177 30      15
1178 31      6
1179 32      8
1180 33      9
1181 34      745
1182 35      34
1183 36      34
1184 37      324
1185 38      67
1186 39      78
1187 40      89
1188 41      90
1189 42      78967
1190 50      56
1191 51      34
1192 55      123
1193 60      13
1194 -------------------------
1195 ---- some alter table end
1196 -------------------------
1197 drop table if exists t1 ;
1198 drop table if exists t2 ;
1199 drop table if exists t3 ;
1200 drop table if exists t4 ;
1201 drop table if exists t5 ;
1202 drop table if exists t6 ;
1203 drop table if exists t11 ;
1204 drop table if exists t22 ;
1205 drop table if exists t33 ;
1206 drop table if exists t44 ;
1207 drop table if exists t55 ;
1208 drop table if exists t66 ;
1209 -------------------------------------------------------------------------
1210 ---  mod(col1,10)  in partition with coltype  int
1211 -------------------------------------------------------------------------
1212 drop table if exists t1 ;
1213 drop table if exists t2 ;
1214 drop table if exists t3 ;
1215 drop table if exists t4 ;
1216 drop table if exists t5 ;
1217 drop table if exists t6 ;
1218 -------------------------------------------------------------------------
1219 ---  Create tables with mod(col1,10)
1220 -------------------------------------------------------------------------
1221 create table t1 (col1 int) engine='NDB' 
1222 partition by range(mod(col1,10)) 
1223 (partition p0 values less than (15),
1224 partition p1 values less than maxvalue);
1225 create table t2 (col1 int) engine='NDB' 
1226 partition by list(mod(col1,10)) 
1227 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
1228 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
1229 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
1230 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
1231 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
1232 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
1234 create table t3 (col1 int) engine='NDB' 
1235 partition by hash(mod(col1,10));
1236 create table t4 (colint int, col1 int) engine='NDB' 
1237 partition by range(colint) 
1238 subpartition by hash(mod(col1,10)) subpartitions 2 
1239 (partition p0 values less than (15),
1240 partition p1 values less than maxvalue);
1241 create table t5 (colint int, col1 int) engine='NDB' 
1242 partition by list(colint) 
1243 subpartition by hash(mod(col1,10)) subpartitions 2 
1244 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15),
1245 partition p1 values in (16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
1246 partition p2 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45),
1247 partition p3 values in (46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
1249 create table t6 (colint int, col1 int) engine='NDB' 
1250 partition by range(colint) 
1251 (partition p0 values less than (mod(15,10)),
1252 partition p1 values less than maxvalue);
1253 -------------------------------------------------------------------------
1254 ---  Access tables with mod(col1,10) 
1255 -------------------------------------------------------------------------
1256 insert into t1 values (5);
1257 insert into t1 values (19);
1258 insert into t2 values (5);
1259 insert into t2 values (19);
1260 insert into t2 values (17);
1261 insert into t3 values (5);
1262 insert into t3 values (19);
1263 insert into t3 values (17);
1264 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_int.inc' into table t4;
1265 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_int.inc' into table t5;
1266 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_int.inc' into table t6;
1267 select mod(col1,10) from t1 order by col1;
1268 mod(col1,10)
1271 select * from t1 order by col1;
1272 col1
1275 select * from t2 order by col1;
1276 col1
1280 select * from t3 order by col1;
1281 col1
1285 select * from t4 order by colint;
1286 colint  col1
1287 1       5
1288 2       13
1289 3       15
1290 4       17
1291 5       23
1292 6       34
1293 7       56
1294 8       56
1295 9       45
1296 10      34
1297 11      78
1298 12      89
1299 13      67
1300 14      46
1301 15      34
1302 16      324
1303 17      345
1304 18      34
1305 19      78
1306 20      567
1307 21      4
1308 22      435
1309 23      34
1310 24      45
1311 25      4565
1312 26      4
1313 27      3
1314 28      2
1315 29      3
1316 30      5
1317 31      6
1318 32      8
1319 33      9
1320 34      745
1321 35      34
1322 36      34
1323 37      324
1324 38      67
1325 39      78
1326 40      89
1327 41      90
1328 42      78967
1329 50      56
1330 51      34
1331 55      123
1332 select * from t5 order by colint;
1333 colint  col1
1334 1       5
1335 2       13
1336 3       15
1337 4       17
1338 5       23
1339 6       34
1340 7       56
1341 8       56
1342 9       45
1343 10      34
1344 11      78
1345 12      89
1346 13      67
1347 14      46
1348 15      34
1349 16      324
1350 17      345
1351 18      34
1352 19      78
1353 20      567
1354 21      4
1355 22      435
1356 23      34
1357 24      45
1358 25      4565
1359 26      4
1360 27      3
1361 28      2
1362 29      3
1363 30      5
1364 31      6
1365 32      8
1366 33      9
1367 34      745
1368 35      34
1369 36      34
1370 37      324
1371 38      67
1372 39      78
1373 40      89
1374 41      90
1375 42      78967
1376 50      56
1377 51      34
1378 55      123
1379 select * from t6 order by colint;
1380 colint  col1
1381 1       5
1382 2       13
1383 3       15
1384 4       17
1385 5       23
1386 6       34
1387 7       56
1388 8       56
1389 9       45
1390 10      34
1391 11      78
1392 12      89
1393 13      67
1394 14      46
1395 15      34
1396 16      324
1397 17      345
1398 18      34
1399 19      78
1400 20      567
1401 21      4
1402 22      435
1403 23      34
1404 24      45
1405 25      4565
1406 26      4
1407 27      3
1408 28      2
1409 29      3
1410 30      5
1411 31      6
1412 32      8
1413 33      9
1414 34      745
1415 35      34
1416 36      34
1417 37      324
1418 38      67
1419 39      78
1420 40      89
1421 41      90
1422 42      78967
1423 50      56
1424 51      34
1425 55      123
1426 update t1 set col1=15  where col1=5;
1427 update t2 set col1=15  where col1=5;
1428 update t3 set col1=15  where col1=5;
1429 update t4 set col1=15  where col1=5;
1430 update t5 set col1=15  where col1=5;
1431 update t6 set col1=15  where col1=5;
1432 select * from t1 order by col1;
1433 col1
1436 select * from t2 order by col1;
1437 col1
1441 select * from t3 order by col1;
1442 col1
1446 select * from t4 order by colint;
1447 colint  col1
1448 1       15
1449 2       13
1450 3       15
1451 4       17
1452 5       23
1453 6       34
1454 7       56
1455 8       56
1456 9       45
1457 10      34
1458 11      78
1459 12      89
1460 13      67
1461 14      46
1462 15      34
1463 16      324
1464 17      345
1465 18      34
1466 19      78
1467 20      567
1468 21      4
1469 22      435
1470 23      34
1471 24      45
1472 25      4565
1473 26      4
1474 27      3
1475 28      2
1476 29      3
1477 30      15
1478 31      6
1479 32      8
1480 33      9
1481 34      745
1482 35      34
1483 36      34
1484 37      324
1485 38      67
1486 39      78
1487 40      89
1488 41      90
1489 42      78967
1490 50      56
1491 51      34
1492 55      123
1493 select * from t5 order by colint;
1494 colint  col1
1495 1       15
1496 2       13
1497 3       15
1498 4       17
1499 5       23
1500 6       34
1501 7       56
1502 8       56
1503 9       45
1504 10      34
1505 11      78
1506 12      89
1507 13      67
1508 14      46
1509 15      34
1510 16      324
1511 17      345
1512 18      34
1513 19      78
1514 20      567
1515 21      4
1516 22      435
1517 23      34
1518 24      45
1519 25      4565
1520 26      4
1521 27      3
1522 28      2
1523 29      3
1524 30      15
1525 31      6
1526 32      8
1527 33      9
1528 34      745
1529 35      34
1530 36      34
1531 37      324
1532 38      67
1533 39      78
1534 40      89
1535 41      90
1536 42      78967
1537 50      56
1538 51      34
1539 55      123
1540 select * from t6 order by colint;
1541 colint  col1
1542 1       15
1543 2       13
1544 3       15
1545 4       17
1546 5       23
1547 6       34
1548 7       56
1549 8       56
1550 9       45
1551 10      34
1552 11      78
1553 12      89
1554 13      67
1555 14      46
1556 15      34
1557 16      324
1558 17      345
1559 18      34
1560 19      78
1561 20      567
1562 21      4
1563 22      435
1564 23      34
1565 24      45
1566 25      4565
1567 26      4
1568 27      3
1569 28      2
1570 29      3
1571 30      15
1572 31      6
1573 32      8
1574 33      9
1575 34      745
1576 35      34
1577 36      34
1578 37      324
1579 38      67
1580 39      78
1581 40      89
1582 41      90
1583 42      78967
1584 50      56
1585 51      34
1586 55      123
1587 -------------------------------------------------------------------------
1588 ---  Alter tables with mod(col1,10)
1589 -------------------------------------------------------------------------
1590 drop table if exists t11 ;
1591 drop table if exists t22 ;
1592 drop table if exists t33 ;
1593 drop table if exists t44 ;
1594 drop table if exists t55 ;
1595 drop table if exists t66 ;
1596 create table t11 engine='NDB' as select * from t1;
1597 create table t22 engine='NDB' as select * from t2;
1598 create table t33 engine='NDB' as select * from t3;
1599 create table t44 engine='NDB' as select * from t4;
1600 create table t55 engine='NDB' as select * from t5;
1601 create table t66 engine='NDB' as select * from t6;
1602 alter table t11
1603 partition by range(mod(col1,10)) 
1604 (partition p0 values less than (15),
1605 partition p1 values less than maxvalue);
1606 alter table t22
1607 partition by list(mod(col1,10)) 
1608 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
1609 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
1610 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
1611 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
1612 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
1613 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
1615 alter table t33
1616 partition by hash(mod(col1,10));
1617 alter table t44
1618 partition by range(colint) 
1619 subpartition by hash(mod(col1,10)) subpartitions 2 
1620 (partition p0 values less than (15),
1621 partition p1 values less than maxvalue);
1622 alter table t55
1623 partition by list(colint) 
1624 subpartition by hash(mod(col1,10)) subpartitions 2 
1625 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15),
1626 partition p1 values in (16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
1627 partition p2 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45),
1628 partition p3 values in (46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
1630 alter table t66
1631 partition by range(colint) 
1632 (partition p0 values less than (mod(15,10)),
1633 partition p1 values less than maxvalue);
1634 select * from t11 order by col1;
1635 col1
1638 select * from t22 order by col1;
1639 col1
1643 select * from t33 order by col1;
1644 col1
1648 select * from t44 order by colint;
1649 colint  col1
1650 1       15
1651 2       13
1652 3       15
1653 4       17
1654 5       23
1655 6       34
1656 7       56
1657 8       56
1658 9       45
1659 10      34
1660 11      78
1661 12      89
1662 13      67
1663 14      46
1664 15      34
1665 16      324
1666 17      345
1667 18      34
1668 19      78
1669 20      567
1670 21      4
1671 22      435
1672 23      34
1673 24      45
1674 25      4565
1675 26      4
1676 27      3
1677 28      2
1678 29      3
1679 30      15
1680 31      6
1681 32      8
1682 33      9
1683 34      745
1684 35      34
1685 36      34
1686 37      324
1687 38      67
1688 39      78
1689 40      89
1690 41      90
1691 42      78967
1692 50      56
1693 51      34
1694 55      123
1695 select * from t55 order by colint;
1696 colint  col1
1697 1       15
1698 2       13
1699 3       15
1700 4       17
1701 5       23
1702 6       34
1703 7       56
1704 8       56
1705 9       45
1706 10      34
1707 11      78
1708 12      89
1709 13      67
1710 14      46
1711 15      34
1712 16      324
1713 17      345
1714 18      34
1715 19      78
1716 20      567
1717 21      4
1718 22      435
1719 23      34
1720 24      45
1721 25      4565
1722 26      4
1723 27      3
1724 28      2
1725 29      3
1726 30      15
1727 31      6
1728 32      8
1729 33      9
1730 34      745
1731 35      34
1732 36      34
1733 37      324
1734 38      67
1735 39      78
1736 40      89
1737 41      90
1738 42      78967
1739 50      56
1740 51      34
1741 55      123
1742 select * from t66 order by colint;
1743 colint  col1
1744 1       15
1745 2       13
1746 3       15
1747 4       17
1748 5       23
1749 6       34
1750 7       56
1751 8       56
1752 9       45
1753 10      34
1754 11      78
1755 12      89
1756 13      67
1757 14      46
1758 15      34
1759 16      324
1760 17      345
1761 18      34
1762 19      78
1763 20      567
1764 21      4
1765 22      435
1766 23      34
1767 24      45
1768 25      4565
1769 26      4
1770 27      3
1771 28      2
1772 29      3
1773 30      15
1774 31      6
1775 32      8
1776 33      9
1777 34      745
1778 35      34
1779 36      34
1780 37      324
1781 38      67
1782 39      78
1783 40      89
1784 41      90
1785 42      78967
1786 50      56
1787 51      34
1788 55      123
1789 ---------------------------
1790 ---- some alter table begin
1791 ---------------------------
1792 alter table t55
1793 partition by list(colint) 
1794 subpartition by hash(mod(col1,10)) subpartitions 4 
1795 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
1796 partition p1 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
1798 show create table t55;
1799 Table   Create Table
1800 t55     CREATE TABLE `t55` (
1801   `colint` int(11) DEFAULT NULL,
1802   `col1` int(11) DEFAULT NULL
1803 ) ENGINE=ndbcluster DEFAULT CHARSET=latin1
1804 /*!50100 PARTITION BY LIST (colint)
1805 SUBPARTITION BY HASH (mod(col1,10))
1806 SUBPARTITIONS 4
1807 (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30) ENGINE = ndbcluster,
1808  PARTITION p1 VALUES IN (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60) ENGINE = ndbcluster) */
1809 select * from t55 order by colint;
1810 colint  col1
1811 1       15
1812 2       13
1813 3       15
1814 4       17
1815 5       23
1816 6       34
1817 7       56
1818 8       56
1819 9       45
1820 10      34
1821 11      78
1822 12      89
1823 13      67
1824 14      46
1825 15      34
1826 16      324
1827 17      345
1828 18      34
1829 19      78
1830 20      567
1831 21      4
1832 22      435
1833 23      34
1834 24      45
1835 25      4565
1836 26      4
1837 27      3
1838 28      2
1839 29      3
1840 30      15
1841 31      6
1842 32      8
1843 33      9
1844 34      745
1845 35      34
1846 36      34
1847 37      324
1848 38      67
1849 39      78
1850 40      89
1851 41      90
1852 42      78967
1853 50      56
1854 51      34
1855 55      123
1856 -------------------------------------------------------------------------
1857 ---  Delete rows and partitions of tables with mod(col1,10)
1858 -------------------------------------------------------------------------
1859 delete from t1 where col1=19;
1860 delete from t2 where col1=19;
1861 delete from t3 where col1=19;
1862 delete from t4 where col1=19;
1863 delete from t5 where col1=19;
1864 delete from t6 where col1=19;
1865 select * from t1 order by col1;
1866 col1
1868 select * from t2 order by col1;
1869 col1
1872 select * from t3 order by col1;
1873 col1
1876 select * from t4 order by colint;
1877 colint  col1
1878 1       15
1879 2       13
1880 3       15
1881 4       17
1882 5       23
1883 6       34
1884 7       56
1885 8       56
1886 9       45
1887 10      34
1888 11      78
1889 12      89
1890 13      67
1891 14      46
1892 15      34
1893 16      324
1894 17      345
1895 18      34
1896 19      78
1897 20      567
1898 21      4
1899 22      435
1900 23      34
1901 24      45
1902 25      4565
1903 26      4
1904 27      3
1905 28      2
1906 29      3
1907 30      15
1908 31      6
1909 32      8
1910 33      9
1911 34      745
1912 35      34
1913 36      34
1914 37      324
1915 38      67
1916 39      78
1917 40      89
1918 41      90
1919 42      78967
1920 50      56
1921 51      34
1922 55      123
1923 select * from t5 order by colint;
1924 colint  col1
1925 1       15
1926 2       13
1927 3       15
1928 4       17
1929 5       23
1930 6       34
1931 7       56
1932 8       56
1933 9       45
1934 10      34
1935 11      78
1936 12      89
1937 13      67
1938 14      46
1939 15      34
1940 16      324
1941 17      345
1942 18      34
1943 19      78
1944 20      567
1945 21      4
1946 22      435
1947 23      34
1948 24      45
1949 25      4565
1950 26      4
1951 27      3
1952 28      2
1953 29      3
1954 30      15
1955 31      6
1956 32      8
1957 33      9
1958 34      745
1959 35      34
1960 36      34
1961 37      324
1962 38      67
1963 39      78
1964 40      89
1965 41      90
1966 42      78967
1967 50      56
1968 51      34
1969 55      123
1970 insert into t1 values (19);
1971 insert into t2 values (19);
1972 insert into t3 values (19);
1973 insert into t4 values (60,19);
1974 insert into t5 values (60,19);
1975 insert into t6 values (60,19);
1976 select * from t1 order by col1;
1977 col1
1980 select * from t2 order by col1;
1981 col1
1985 select * from t3 order by col1;
1986 col1
1990 select * from t4 order by colint;
1991 colint  col1
1992 1       15
1993 2       13
1994 3       15
1995 4       17
1996 5       23
1997 6       34
1998 7       56
1999 8       56
2000 9       45
2001 10      34
2002 11      78
2003 12      89
2004 13      67
2005 14      46
2006 15      34
2007 16      324
2008 17      345
2009 18      34
2010 19      78
2011 20      567
2012 21      4
2013 22      435
2014 23      34
2015 24      45
2016 25      4565
2017 26      4
2018 27      3
2019 28      2
2020 29      3
2021 30      15
2022 31      6
2023 32      8
2024 33      9
2025 34      745
2026 35      34
2027 36      34
2028 37      324
2029 38      67
2030 39      78
2031 40      89
2032 41      90
2033 42      78967
2034 50      56
2035 51      34
2036 55      123
2037 60      19
2038 select * from t5 order by colint;
2039 colint  col1
2040 1       15
2041 2       13
2042 3       15
2043 4       17
2044 5       23
2045 6       34
2046 7       56
2047 8       56
2048 9       45
2049 10      34
2050 11      78
2051 12      89
2052 13      67
2053 14      46
2054 15      34
2055 16      324
2056 17      345
2057 18      34
2058 19      78
2059 20      567
2060 21      4
2061 22      435
2062 23      34
2063 24      45
2064 25      4565
2065 26      4
2066 27      3
2067 28      2
2068 29      3
2069 30      15
2070 31      6
2071 32      8
2072 33      9
2073 34      745
2074 35      34
2075 36      34
2076 37      324
2077 38      67
2078 39      78
2079 40      89
2080 41      90
2081 42      78967
2082 50      56
2083 51      34
2084 55      123
2085 60      19
2086 select * from t6 order by colint;
2087 colint  col1
2088 1       15
2089 2       13
2090 3       15
2091 4       17
2092 5       23
2093 6       34
2094 7       56
2095 8       56
2096 9       45
2097 10      34
2098 11      78
2099 12      89
2100 13      67
2101 14      46
2102 15      34
2103 16      324
2104 17      345
2105 18      34
2106 19      78
2107 20      567
2108 21      4
2109 22      435
2110 23      34
2111 24      45
2112 25      4565
2113 26      4
2114 27      3
2115 28      2
2116 29      3
2117 30      15
2118 31      6
2119 32      8
2120 33      9
2121 34      745
2122 35      34
2123 36      34
2124 37      324
2125 38      67
2126 39      78
2127 40      89
2128 41      90
2129 42      78967
2130 50      56
2131 51      34
2132 55      123
2133 60      19
2134 -------------------------------------------------------------------------
2135 ---  Delete rows and partitions of tables with mod(col1,10)
2136 -------------------------------------------------------------------------
2137 delete from t11 where col1=19;
2138 delete from t22 where col1=19;
2139 delete from t33 where col1=19;
2140 delete from t44 where col1=19;
2141 delete from t55 where col1=19;
2142 delete from t66 where col1=19;
2143 select * from t11 order by col1;
2144 col1
2146 select * from t22 order by col1;
2147 col1
2150 select * from t33 order by col1;
2151 col1
2154 select * from t44 order by colint;
2155 colint  col1
2156 1       15
2157 2       13
2158 3       15
2159 4       17
2160 5       23
2161 6       34
2162 7       56
2163 8       56
2164 9       45
2165 10      34
2166 11      78
2167 12      89
2168 13      67
2169 14      46
2170 15      34
2171 16      324
2172 17      345
2173 18      34
2174 19      78
2175 20      567
2176 21      4
2177 22      435
2178 23      34
2179 24      45
2180 25      4565
2181 26      4
2182 27      3
2183 28      2
2184 29      3
2185 30      15
2186 31      6
2187 32      8
2188 33      9
2189 34      745
2190 35      34
2191 36      34
2192 37      324
2193 38      67
2194 39      78
2195 40      89
2196 41      90
2197 42      78967
2198 50      56
2199 51      34
2200 55      123
2201 select * from t55 order by colint;
2202 colint  col1
2203 1       15
2204 2       13
2205 3       15
2206 4       17
2207 5       23
2208 6       34
2209 7       56
2210 8       56
2211 9       45
2212 10      34
2213 11      78
2214 12      89
2215 13      67
2216 14      46
2217 15      34
2218 16      324
2219 17      345
2220 18      34
2221 19      78
2222 20      567
2223 21      4
2224 22      435
2225 23      34
2226 24      45
2227 25      4565
2228 26      4
2229 27      3
2230 28      2
2231 29      3
2232 30      15
2233 31      6
2234 32      8
2235 33      9
2236 34      745
2237 35      34
2238 36      34
2239 37      324
2240 38      67
2241 39      78
2242 40      89
2243 41      90
2244 42      78967
2245 50      56
2246 51      34
2247 55      123
2248 insert into t11 values (19);
2249 insert into t22 values (19);
2250 insert into t33 values (19);
2251 insert into t44 values (60,19);
2252 insert into t55 values (60,19);
2253 insert into t66 values (60,19);
2254 select * from t11 order by col1;
2255 col1
2258 select * from t22 order by col1;
2259 col1
2263 select * from t33 order by col1;
2264 col1
2268 select * from t44 order by colint;
2269 colint  col1
2270 1       15
2271 2       13
2272 3       15
2273 4       17
2274 5       23
2275 6       34
2276 7       56
2277 8       56
2278 9       45
2279 10      34
2280 11      78
2281 12      89
2282 13      67
2283 14      46
2284 15      34
2285 16      324
2286 17      345
2287 18      34
2288 19      78
2289 20      567
2290 21      4
2291 22      435
2292 23      34
2293 24      45
2294 25      4565
2295 26      4
2296 27      3
2297 28      2
2298 29      3
2299 30      15
2300 31      6
2301 32      8
2302 33      9
2303 34      745
2304 35      34
2305 36      34
2306 37      324
2307 38      67
2308 39      78
2309 40      89
2310 41      90
2311 42      78967
2312 50      56
2313 51      34
2314 55      123
2315 60      19
2316 select * from t55 order by colint;
2317 colint  col1
2318 1       15
2319 2       13
2320 3       15
2321 4       17
2322 5       23
2323 6       34
2324 7       56
2325 8       56
2326 9       45
2327 10      34
2328 11      78
2329 12      89
2330 13      67
2331 14      46
2332 15      34
2333 16      324
2334 17      345
2335 18      34
2336 19      78
2337 20      567
2338 21      4
2339 22      435
2340 23      34
2341 24      45
2342 25      4565
2343 26      4
2344 27      3
2345 28      2
2346 29      3
2347 30      15
2348 31      6
2349 32      8
2350 33      9
2351 34      745
2352 35      34
2353 36      34
2354 37      324
2355 38      67
2356 39      78
2357 40      89
2358 41      90
2359 42      78967
2360 50      56
2361 51      34
2362 55      123
2363 60      19
2364 select * from t66 order by colint;
2365 colint  col1
2366 1       15
2367 2       13
2368 3       15
2369 4       17
2370 5       23
2371 6       34
2372 7       56
2373 8       56
2374 9       45
2375 10      34
2376 11      78
2377 12      89
2378 13      67
2379 14      46
2380 15      34
2381 16      324
2382 17      345
2383 18      34
2384 19      78
2385 20      567
2386 21      4
2387 22      435
2388 23      34
2389 24      45
2390 25      4565
2391 26      4
2392 27      3
2393 28      2
2394 29      3
2395 30      15
2396 31      6
2397 32      8
2398 33      9
2399 34      745
2400 35      34
2401 36      34
2402 37      324
2403 38      67
2404 39      78
2405 40      89
2406 41      90
2407 42      78967
2408 50      56
2409 51      34
2410 55      123
2411 60      19
2412 -------------------------
2413 ---- some alter table end
2414 -------------------------
2415 drop table if exists t1 ;
2416 drop table if exists t2 ;
2417 drop table if exists t3 ;
2418 drop table if exists t4 ;
2419 drop table if exists t5 ;
2420 drop table if exists t6 ;
2421 drop table if exists t11 ;
2422 drop table if exists t22 ;
2423 drop table if exists t33 ;
2424 drop table if exists t44 ;
2425 drop table if exists t55 ;
2426 drop table if exists t66 ;
2427 -------------------------------------------------------------------------
2428 ---  day(col1)  in partition with coltype  date
2429 -------------------------------------------------------------------------
2430 drop table if exists t1 ;
2431 drop table if exists t2 ;
2432 drop table if exists t3 ;
2433 drop table if exists t4 ;
2434 drop table if exists t5 ;
2435 drop table if exists t6 ;
2436 -------------------------------------------------------------------------
2437 ---  Create tables with day(col1)
2438 -------------------------------------------------------------------------
2439 create table t1 (col1 date) engine='NDB' 
2440 partition by range(day(col1)) 
2441 (partition p0 values less than (15),
2442 partition p1 values less than maxvalue);
2443 create table t2 (col1 date) engine='NDB' 
2444 partition by list(day(col1)) 
2445 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
2446 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
2447 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
2448 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
2449 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
2450 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
2452 create table t3 (col1 date) engine='NDB' 
2453 partition by hash(day(col1));
2454 create table t4 (colint int, col1 date) engine='NDB' 
2455 partition by range(colint) 
2456 subpartition by hash(day(col1)) subpartitions 2 
2457 (partition p0 values less than (15),
2458 partition p1 values less than maxvalue);
2459 create table t5 (colint int, col1 date) engine='NDB' 
2460 partition by list(colint) 
2461 subpartition by hash(day(col1)) subpartitions 2 
2462 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15),
2463 partition p1 values in (16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
2464 partition p2 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45),
2465 partition p3 values in (46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
2467 create table t6 (colint int, col1 date) engine='NDB' 
2468 partition by range(colint) 
2469 (partition p0 values less than (day('2006-12-21')),
2470 partition p1 values less than maxvalue);
2471 -------------------------------------------------------------------------
2472 ---  Access tables with day(col1) 
2473 -------------------------------------------------------------------------
2474 insert into t1 values ('2006-02-03');
2475 insert into t1 values ('2006-01-17');
2476 insert into t2 values ('2006-02-03');
2477 insert into t2 values ('2006-01-17');
2478 insert into t2 values ('2006-01-25');
2479 insert into t3 values ('2006-02-03');
2480 insert into t3 values ('2006-01-17');
2481 insert into t3 values ('2006-01-25');
2482 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4;
2483 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5;
2484 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6;
2485 select day(col1) from t1 order by col1;
2486 day(col1)
2489 select * from t1 order by col1;
2490 col1
2491 2006-01-17
2492 2006-02-03
2493 select * from t2 order by col1;
2494 col1
2495 2006-01-17
2496 2006-01-25
2497 2006-02-03
2498 select * from t3 order by col1;
2499 col1
2500 2006-01-17
2501 2006-01-25
2502 2006-02-03
2503 select * from t4 order by colint;
2504 colint  col1
2505 1       2006-02-03
2506 2       2006-01-17
2507 3       2006-01-25
2508 4       2006-02-05
2509 select * from t5 order by colint;
2510 colint  col1
2511 1       2006-02-03
2512 2       2006-01-17
2513 3       2006-01-25
2514 4       2006-02-05
2515 select * from t6 order by colint;
2516 colint  col1
2517 1       2006-02-03
2518 2       2006-01-17
2519 3       2006-01-25
2520 4       2006-02-05
2521 update t1 set col1='2006-02-05' where col1='2006-02-03';
2522 update t2 set col1='2006-02-05' where col1='2006-02-03';
2523 update t3 set col1='2006-02-05' where col1='2006-02-03';
2524 update t4 set col1='2006-02-05' where col1='2006-02-03';
2525 update t5 set col1='2006-02-05' where col1='2006-02-03';
2526 update t6 set col1='2006-02-05' where col1='2006-02-03';
2527 select * from t1 order by col1;
2528 col1
2529 2006-01-17
2530 2006-02-05
2531 select * from t2 order by col1;
2532 col1
2533 2006-01-17
2534 2006-01-25
2535 2006-02-05
2536 select * from t3 order by col1;
2537 col1
2538 2006-01-17
2539 2006-01-25
2540 2006-02-05
2541 select * from t4 order by colint;
2542 colint  col1
2543 1       2006-02-05
2544 2       2006-01-17
2545 3       2006-01-25
2546 4       2006-02-05
2547 select * from t5 order by colint;
2548 colint  col1
2549 1       2006-02-05
2550 2       2006-01-17
2551 3       2006-01-25
2552 4       2006-02-05
2553 select * from t6 order by colint;
2554 colint  col1
2555 1       2006-02-05
2556 2       2006-01-17
2557 3       2006-01-25
2558 4       2006-02-05
2559 -------------------------------------------------------------------------
2560 ---  Alter tables with day(col1)
2561 -------------------------------------------------------------------------
2562 drop table if exists t11 ;
2563 drop table if exists t22 ;
2564 drop table if exists t33 ;
2565 drop table if exists t44 ;
2566 drop table if exists t55 ;
2567 drop table if exists t66 ;
2568 create table t11 engine='NDB' as select * from t1;
2569 create table t22 engine='NDB' as select * from t2;
2570 create table t33 engine='NDB' as select * from t3;
2571 create table t44 engine='NDB' as select * from t4;
2572 create table t55 engine='NDB' as select * from t5;
2573 create table t66 engine='NDB' as select * from t6;
2574 alter table t11
2575 partition by range(day(col1)) 
2576 (partition p0 values less than (15),
2577 partition p1 values less than maxvalue);
2578 alter table t22
2579 partition by list(day(col1)) 
2580 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
2581 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
2582 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
2583 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
2584 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
2585 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
2587 alter table t33
2588 partition by hash(day(col1));
2589 alter table t44
2590 partition by range(colint) 
2591 subpartition by hash(day(col1)) subpartitions 2 
2592 (partition p0 values less than (15),
2593 partition p1 values less than maxvalue);
2594 alter table t55
2595 partition by list(colint) 
2596 subpartition by hash(day(col1)) subpartitions 2 
2597 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15),
2598 partition p1 values in (16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
2599 partition p2 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45),
2600 partition p3 values in (46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
2602 alter table t66
2603 partition by range(colint) 
2604 (partition p0 values less than (day('2006-12-21')),
2605 partition p1 values less than maxvalue);
2606 select * from t11 order by col1;
2607 col1
2608 2006-01-17
2609 2006-02-05
2610 select * from t22 order by col1;
2611 col1
2612 2006-01-17
2613 2006-01-25
2614 2006-02-05
2615 select * from t33 order by col1;
2616 col1
2617 2006-01-17
2618 2006-01-25
2619 2006-02-05
2620 select * from t44 order by colint;
2621 colint  col1
2622 1       2006-02-05
2623 2       2006-01-17
2624 3       2006-01-25
2625 4       2006-02-05
2626 select * from t55 order by colint;
2627 colint  col1
2628 1       2006-02-05
2629 2       2006-01-17
2630 3       2006-01-25
2631 4       2006-02-05
2632 select * from t66 order by colint;
2633 colint  col1
2634 1       2006-02-05
2635 2       2006-01-17
2636 3       2006-01-25
2637 4       2006-02-05
2638 ---------------------------
2639 ---- some alter table begin
2640 ---------------------------
2641 alter table t55
2642 partition by list(colint) 
2643 subpartition by hash(day(col1)) subpartitions 4 
2644 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
2645 partition p1 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
2647 show create table t55;
2648 Table   Create Table
2649 t55     CREATE TABLE `t55` (
2650   `colint` int(11) DEFAULT NULL,
2651   `col1` date DEFAULT NULL
2652 ) ENGINE=ndbcluster DEFAULT CHARSET=latin1
2653 /*!50100 PARTITION BY LIST (colint)
2654 SUBPARTITION BY HASH (day(col1))
2655 SUBPARTITIONS 4
2656 (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30) ENGINE = ndbcluster,
2657  PARTITION p1 VALUES IN (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60) ENGINE = ndbcluster) */
2658 select * from t55 order by colint;
2659 colint  col1
2660 1       2006-02-05
2661 2       2006-01-17
2662 3       2006-01-25
2663 4       2006-02-05
2664 -------------------------------------------------------------------------
2665 ---  Delete rows and partitions of tables with day(col1)
2666 -------------------------------------------------------------------------
2667 delete from t1 where col1='2006-01-17';
2668 delete from t2 where col1='2006-01-17';
2669 delete from t3 where col1='2006-01-17';
2670 delete from t4 where col1='2006-01-17';
2671 delete from t5 where col1='2006-01-17';
2672 delete from t6 where col1='2006-01-17';
2673 select * from t1 order by col1;
2674 col1
2675 2006-02-05
2676 select * from t2 order by col1;
2677 col1
2678 2006-01-25
2679 2006-02-05
2680 select * from t3 order by col1;
2681 col1
2682 2006-01-25
2683 2006-02-05
2684 select * from t4 order by colint;
2685 colint  col1
2686 1       2006-02-05
2687 3       2006-01-25
2688 4       2006-02-05
2689 select * from t5 order by colint;
2690 colint  col1
2691 1       2006-02-05
2692 3       2006-01-25
2693 4       2006-02-05
2694 insert into t1 values ('2006-01-17');
2695 insert into t2 values ('2006-01-17');
2696 insert into t3 values ('2006-01-17');
2697 insert into t4 values (60,'2006-01-17');
2698 insert into t5 values (60,'2006-01-17');
2699 insert into t6 values (60,'2006-01-17');
2700 select * from t1 order by col1;
2701 col1
2702 2006-01-17
2703 2006-02-05
2704 select * from t2 order by col1;
2705 col1
2706 2006-01-17
2707 2006-01-25
2708 2006-02-05
2709 select * from t3 order by col1;
2710 col1
2711 2006-01-17
2712 2006-01-25
2713 2006-02-05
2714 select * from t4 order by colint;
2715 colint  col1
2716 1       2006-02-05
2717 3       2006-01-25
2718 4       2006-02-05
2719 60      2006-01-17
2720 select * from t5 order by colint;
2721 colint  col1
2722 1       2006-02-05
2723 3       2006-01-25
2724 4       2006-02-05
2725 60      2006-01-17
2726 select * from t6 order by colint;
2727 colint  col1
2728 1       2006-02-05
2729 3       2006-01-25
2730 4       2006-02-05
2731 60      2006-01-17
2732 -------------------------------------------------------------------------
2733 ---  Delete rows and partitions of tables with day(col1)
2734 -------------------------------------------------------------------------
2735 delete from t11 where col1='2006-01-17';
2736 delete from t22 where col1='2006-01-17';
2737 delete from t33 where col1='2006-01-17';
2738 delete from t44 where col1='2006-01-17';
2739 delete from t55 where col1='2006-01-17';
2740 delete from t66 where col1='2006-01-17';
2741 select * from t11 order by col1;
2742 col1
2743 2006-02-05
2744 select * from t22 order by col1;
2745 col1
2746 2006-01-25
2747 2006-02-05
2748 select * from t33 order by col1;
2749 col1
2750 2006-01-25
2751 2006-02-05
2752 select * from t44 order by colint;
2753 colint  col1
2754 1       2006-02-05
2755 3       2006-01-25
2756 4       2006-02-05
2757 select * from t55 order by colint;
2758 colint  col1
2759 1       2006-02-05
2760 3       2006-01-25
2761 4       2006-02-05
2762 insert into t11 values ('2006-01-17');
2763 insert into t22 values ('2006-01-17');
2764 insert into t33 values ('2006-01-17');
2765 insert into t44 values (60,'2006-01-17');
2766 insert into t55 values (60,'2006-01-17');
2767 insert into t66 values (60,'2006-01-17');
2768 select * from t11 order by col1;
2769 col1
2770 2006-01-17
2771 2006-02-05
2772 select * from t22 order by col1;
2773 col1
2774 2006-01-17
2775 2006-01-25
2776 2006-02-05
2777 select * from t33 order by col1;
2778 col1
2779 2006-01-17
2780 2006-01-25
2781 2006-02-05
2782 select * from t44 order by colint;
2783 colint  col1
2784 1       2006-02-05
2785 3       2006-01-25
2786 4       2006-02-05
2787 60      2006-01-17
2788 select * from t55 order by colint;
2789 colint  col1
2790 1       2006-02-05
2791 3       2006-01-25
2792 4       2006-02-05
2793 60      2006-01-17
2794 select * from t66 order by colint;
2795 colint  col1
2796 1       2006-02-05
2797 3       2006-01-25
2798 4       2006-02-05
2799 60      2006-01-17
2800 -------------------------
2801 ---- some alter table end
2802 -------------------------
2803 drop table if exists t1 ;
2804 drop table if exists t2 ;
2805 drop table if exists t3 ;
2806 drop table if exists t4 ;
2807 drop table if exists t5 ;
2808 drop table if exists t6 ;
2809 drop table if exists t11 ;
2810 drop table if exists t22 ;
2811 drop table if exists t33 ;
2812 drop table if exists t44 ;
2813 drop table if exists t55 ;
2814 drop table if exists t66 ;
2815 -------------------------------------------------------------------------
2816 ---  dayofmonth(col1)  in partition with coltype  date
2817 -------------------------------------------------------------------------
2818 drop table if exists t1 ;
2819 drop table if exists t2 ;
2820 drop table if exists t3 ;
2821 drop table if exists t4 ;
2822 drop table if exists t5 ;
2823 drop table if exists t6 ;
2824 -------------------------------------------------------------------------
2825 ---  Create tables with dayofmonth(col1)
2826 -------------------------------------------------------------------------
2827 create table t1 (col1 date) engine='NDB' 
2828 partition by range(dayofmonth(col1)) 
2829 (partition p0 values less than (15),
2830 partition p1 values less than maxvalue);
2831 create table t2 (col1 date) engine='NDB' 
2832 partition by list(dayofmonth(col1)) 
2833 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
2834 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
2835 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
2836 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
2837 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
2838 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
2840 create table t3 (col1 date) engine='NDB' 
2841 partition by hash(dayofmonth(col1));
2842 create table t4 (colint int, col1 date) engine='NDB' 
2843 partition by range(colint) 
2844 subpartition by hash(dayofmonth(col1)) subpartitions 2 
2845 (partition p0 values less than (15),
2846 partition p1 values less than maxvalue);
2847 create table t5 (colint int, col1 date) engine='NDB' 
2848 partition by list(colint) 
2849 subpartition by hash(dayofmonth(col1)) subpartitions 2 
2850 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15),
2851 partition p1 values in (16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
2852 partition p2 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45),
2853 partition p3 values in (46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
2855 create table t6 (colint int, col1 date) engine='NDB' 
2856 partition by range(colint) 
2857 (partition p0 values less than (dayofmonth('2006-12-24')),
2858 partition p1 values less than maxvalue);
2859 -------------------------------------------------------------------------
2860 ---  Access tables with dayofmonth(col1) 
2861 -------------------------------------------------------------------------
2862 insert into t1 values ('2006-02-03');
2863 insert into t1 values ('2006-01-17');
2864 insert into t2 values ('2006-02-03');
2865 insert into t2 values ('2006-01-17');
2866 insert into t2 values ('2006-01-25');
2867 insert into t3 values ('2006-02-03');
2868 insert into t3 values ('2006-01-17');
2869 insert into t3 values ('2006-01-25');
2870 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4;
2871 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5;
2872 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6;
2873 select dayofmonth(col1) from t1 order by col1;
2874 dayofmonth(col1)
2877 select * from t1 order by col1;
2878 col1
2879 2006-01-17
2880 2006-02-03
2881 select * from t2 order by col1;
2882 col1
2883 2006-01-17
2884 2006-01-25
2885 2006-02-03
2886 select * from t3 order by col1;
2887 col1
2888 2006-01-17
2889 2006-01-25
2890 2006-02-03
2891 select * from t4 order by colint;
2892 colint  col1
2893 1       2006-02-03
2894 2       2006-01-17
2895 3       2006-01-25
2896 4       2006-02-05
2897 select * from t5 order by colint;
2898 colint  col1
2899 1       2006-02-03
2900 2       2006-01-17
2901 3       2006-01-25
2902 4       2006-02-05
2903 select * from t6 order by colint;
2904 colint  col1
2905 1       2006-02-03
2906 2       2006-01-17
2907 3       2006-01-25
2908 4       2006-02-05
2909 update t1 set col1='2006-02-05' where col1='2006-02-03';
2910 update t2 set col1='2006-02-05' where col1='2006-02-03';
2911 update t3 set col1='2006-02-05' where col1='2006-02-03';
2912 update t4 set col1='2006-02-05' where col1='2006-02-03';
2913 update t5 set col1='2006-02-05' where col1='2006-02-03';
2914 update t6 set col1='2006-02-05' where col1='2006-02-03';
2915 select * from t1 order by col1;
2916 col1
2917 2006-01-17
2918 2006-02-05
2919 select * from t2 order by col1;
2920 col1
2921 2006-01-17
2922 2006-01-25
2923 2006-02-05
2924 select * from t3 order by col1;
2925 col1
2926 2006-01-17
2927 2006-01-25
2928 2006-02-05
2929 select * from t4 order by colint;
2930 colint  col1
2931 1       2006-02-05
2932 2       2006-01-17
2933 3       2006-01-25
2934 4       2006-02-05
2935 select * from t5 order by colint;
2936 colint  col1
2937 1       2006-02-05
2938 2       2006-01-17
2939 3       2006-01-25
2940 4       2006-02-05
2941 select * from t6 order by colint;
2942 colint  col1
2943 1       2006-02-05
2944 2       2006-01-17
2945 3       2006-01-25
2946 4       2006-02-05
2947 -------------------------------------------------------------------------
2948 ---  Alter tables with dayofmonth(col1)
2949 -------------------------------------------------------------------------
2950 drop table if exists t11 ;
2951 drop table if exists t22 ;
2952 drop table if exists t33 ;
2953 drop table if exists t44 ;
2954 drop table if exists t55 ;
2955 drop table if exists t66 ;
2956 create table t11 engine='NDB' as select * from t1;
2957 create table t22 engine='NDB' as select * from t2;
2958 create table t33 engine='NDB' as select * from t3;
2959 create table t44 engine='NDB' as select * from t4;
2960 create table t55 engine='NDB' as select * from t5;
2961 create table t66 engine='NDB' as select * from t6;
2962 alter table t11
2963 partition by range(dayofmonth(col1)) 
2964 (partition p0 values less than (15),
2965 partition p1 values less than maxvalue);
2966 alter table t22
2967 partition by list(dayofmonth(col1)) 
2968 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
2969 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
2970 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
2971 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
2972 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
2973 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
2975 alter table t33
2976 partition by hash(dayofmonth(col1));
2977 alter table t44
2978 partition by range(colint) 
2979 subpartition by hash(dayofmonth(col1)) subpartitions 2 
2980 (partition p0 values less than (15),
2981 partition p1 values less than maxvalue);
2982 alter table t55
2983 partition by list(colint) 
2984 subpartition by hash(dayofmonth(col1)) subpartitions 2 
2985 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15),
2986 partition p1 values in (16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
2987 partition p2 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45),
2988 partition p3 values in (46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
2990 alter table t66
2991 partition by range(colint) 
2992 (partition p0 values less than (dayofmonth('2006-12-24')),
2993 partition p1 values less than maxvalue);
2994 select * from t11 order by col1;
2995 col1
2996 2006-01-17
2997 2006-02-05
2998 select * from t22 order by col1;
2999 col1
3000 2006-01-17
3001 2006-01-25
3002 2006-02-05
3003 select * from t33 order by col1;
3004 col1
3005 2006-01-17
3006 2006-01-25
3007 2006-02-05
3008 select * from t44 order by colint;
3009 colint  col1
3010 1       2006-02-05
3011 2       2006-01-17
3012 3       2006-01-25
3013 4       2006-02-05
3014 select * from t55 order by colint;
3015 colint  col1
3016 1       2006-02-05
3017 2       2006-01-17
3018 3       2006-01-25
3019 4       2006-02-05
3020 select * from t66 order by colint;
3021 colint  col1
3022 1       2006-02-05
3023 2       2006-01-17
3024 3       2006-01-25
3025 4       2006-02-05
3026 ---------------------------
3027 ---- some alter table begin
3028 ---------------------------
3029 alter table t55
3030 partition by list(colint) 
3031 subpartition by hash(dayofmonth(col1)) subpartitions 4 
3032 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
3033 partition p1 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
3035 show create table t55;
3036 Table   Create Table
3037 t55     CREATE TABLE `t55` (
3038   `colint` int(11) DEFAULT NULL,
3039   `col1` date DEFAULT NULL
3040 ) ENGINE=ndbcluster DEFAULT CHARSET=latin1
3041 /*!50100 PARTITION BY LIST (colint)
3042 SUBPARTITION BY HASH (dayofmonth(col1))
3043 SUBPARTITIONS 4
3044 (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30) ENGINE = ndbcluster,
3045  PARTITION p1 VALUES IN (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60) ENGINE = ndbcluster) */
3046 select * from t55 order by colint;
3047 colint  col1
3048 1       2006-02-05
3049 2       2006-01-17
3050 3       2006-01-25
3051 4       2006-02-05
3052 -------------------------------------------------------------------------
3053 ---  Delete rows and partitions of tables with dayofmonth(col1)
3054 -------------------------------------------------------------------------
3055 delete from t1 where col1='2006-01-17';
3056 delete from t2 where col1='2006-01-17';
3057 delete from t3 where col1='2006-01-17';
3058 delete from t4 where col1='2006-01-17';
3059 delete from t5 where col1='2006-01-17';
3060 delete from t6 where col1='2006-01-17';
3061 select * from t1 order by col1;
3062 col1
3063 2006-02-05
3064 select * from t2 order by col1;
3065 col1
3066 2006-01-25
3067 2006-02-05
3068 select * from t3 order by col1;
3069 col1
3070 2006-01-25
3071 2006-02-05
3072 select * from t4 order by colint;
3073 colint  col1
3074 1       2006-02-05
3075 3       2006-01-25
3076 4       2006-02-05
3077 select * from t5 order by colint;
3078 colint  col1
3079 1       2006-02-05
3080 3       2006-01-25
3081 4       2006-02-05
3082 insert into t1 values ('2006-01-17');
3083 insert into t2 values ('2006-01-17');
3084 insert into t3 values ('2006-01-17');
3085 insert into t4 values (60,'2006-01-17');
3086 insert into t5 values (60,'2006-01-17');
3087 insert into t6 values (60,'2006-01-17');
3088 select * from t1 order by col1;
3089 col1
3090 2006-01-17
3091 2006-02-05
3092 select * from t2 order by col1;
3093 col1
3094 2006-01-17
3095 2006-01-25
3096 2006-02-05
3097 select * from t3 order by col1;
3098 col1
3099 2006-01-17
3100 2006-01-25
3101 2006-02-05
3102 select * from t4 order by colint;
3103 colint  col1
3104 1       2006-02-05
3105 3       2006-01-25
3106 4       2006-02-05
3107 60      2006-01-17
3108 select * from t5 order by colint;
3109 colint  col1
3110 1       2006-02-05
3111 3       2006-01-25
3112 4       2006-02-05
3113 60      2006-01-17
3114 select * from t6 order by colint;
3115 colint  col1
3116 1       2006-02-05
3117 3       2006-01-25
3118 4       2006-02-05
3119 60      2006-01-17
3120 -------------------------------------------------------------------------
3121 ---  Delete rows and partitions of tables with dayofmonth(col1)
3122 -------------------------------------------------------------------------
3123 delete from t11 where col1='2006-01-17';
3124 delete from t22 where col1='2006-01-17';
3125 delete from t33 where col1='2006-01-17';
3126 delete from t44 where col1='2006-01-17';
3127 delete from t55 where col1='2006-01-17';
3128 delete from t66 where col1='2006-01-17';
3129 select * from t11 order by col1;
3130 col1
3131 2006-02-05
3132 select * from t22 order by col1;
3133 col1
3134 2006-01-25
3135 2006-02-05
3136 select * from t33 order by col1;
3137 col1
3138 2006-01-25
3139 2006-02-05
3140 select * from t44 order by colint;
3141 colint  col1
3142 1       2006-02-05
3143 3       2006-01-25
3144 4       2006-02-05
3145 select * from t55 order by colint;
3146 colint  col1
3147 1       2006-02-05
3148 3       2006-01-25
3149 4       2006-02-05
3150 insert into t11 values ('2006-01-17');
3151 insert into t22 values ('2006-01-17');
3152 insert into t33 values ('2006-01-17');
3153 insert into t44 values (60,'2006-01-17');
3154 insert into t55 values (60,'2006-01-17');
3155 insert into t66 values (60,'2006-01-17');
3156 select * from t11 order by col1;
3157 col1
3158 2006-01-17
3159 2006-02-05
3160 select * from t22 order by col1;
3161 col1
3162 2006-01-17
3163 2006-01-25
3164 2006-02-05
3165 select * from t33 order by col1;
3166 col1
3167 2006-01-17
3168 2006-01-25
3169 2006-02-05
3170 select * from t44 order by colint;
3171 colint  col1
3172 1       2006-02-05
3173 3       2006-01-25
3174 4       2006-02-05
3175 60      2006-01-17
3176 select * from t55 order by colint;
3177 colint  col1
3178 1       2006-02-05
3179 3       2006-01-25
3180 4       2006-02-05
3181 60      2006-01-17
3182 select * from t66 order by colint;
3183 colint  col1
3184 1       2006-02-05
3185 3       2006-01-25
3186 4       2006-02-05
3187 60      2006-01-17
3188 -------------------------
3189 ---- some alter table end
3190 -------------------------
3191 drop table if exists t1 ;
3192 drop table if exists t2 ;
3193 drop table if exists t3 ;
3194 drop table if exists t4 ;
3195 drop table if exists t5 ;
3196 drop table if exists t6 ;
3197 drop table if exists t11 ;
3198 drop table if exists t22 ;
3199 drop table if exists t33 ;
3200 drop table if exists t44 ;
3201 drop table if exists t55 ;
3202 drop table if exists t66 ;
3203 -------------------------------------------------------------------------
3204 ---  dayofweek(col1)  in partition with coltype  date
3205 -------------------------------------------------------------------------
3206 drop table if exists t1 ;
3207 drop table if exists t2 ;
3208 drop table if exists t3 ;
3209 drop table if exists t4 ;
3210 drop table if exists t5 ;
3211 drop table if exists t6 ;
3212 -------------------------------------------------------------------------
3213 ---  Create tables with dayofweek(col1)
3214 -------------------------------------------------------------------------
3215 create table t1 (col1 date) engine='NDB' 
3216 partition by range(dayofweek(col1)) 
3217 (partition p0 values less than (15),
3218 partition p1 values less than maxvalue);
3219 create table t2 (col1 date) engine='NDB' 
3220 partition by list(dayofweek(col1)) 
3221 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
3222 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
3223 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
3224 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
3225 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
3226 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
3228 create table t3 (col1 date) engine='NDB' 
3229 partition by hash(dayofweek(col1));
3230 create table t4 (colint int, col1 date) engine='NDB' 
3231 partition by range(colint) 
3232 subpartition by hash(dayofweek(col1)) subpartitions 2 
3233 (partition p0 values less than (15),
3234 partition p1 values less than maxvalue);
3235 create table t5 (colint int, col1 date) engine='NDB' 
3236 partition by list(colint) 
3237 subpartition by hash(dayofweek(col1)) subpartitions 2 
3238 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15),
3239 partition p1 values in (16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
3240 partition p2 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45),
3241 partition p3 values in (46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
3243 create table t6 (colint int, col1 date) engine='NDB' 
3244 partition by range(colint) 
3245 (partition p0 values less than (dayofweek('2006-12-24')),
3246 partition p1 values less than maxvalue);
3247 -------------------------------------------------------------------------
3248 ---  Access tables with dayofweek(col1) 
3249 -------------------------------------------------------------------------
3250 insert into t1 values ('2006-01-03');
3251 insert into t1 values ('2006-02-17');
3252 insert into t2 values ('2006-01-03');
3253 insert into t2 values ('2006-02-17');
3254 insert into t2 values ('2006-01-25');
3255 insert into t3 values ('2006-01-03');
3256 insert into t3 values ('2006-02-17');
3257 insert into t3 values ('2006-01-25');
3258 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4;
3259 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5;
3260 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6;
3261 select dayofweek(col1) from t1 order by col1;
3262 dayofweek(col1)
3265 select * from t1 order by col1;
3266 col1
3267 2006-01-03
3268 2006-02-17
3269 select * from t2 order by col1;
3270 col1
3271 2006-01-03
3272 2006-01-25
3273 2006-02-17
3274 select * from t3 order by col1;
3275 col1
3276 2006-01-03
3277 2006-01-25
3278 2006-02-17
3279 select * from t4 order by colint;
3280 colint  col1
3281 1       2006-02-03
3282 2       2006-01-17
3283 3       2006-01-25
3284 4       2006-02-05
3285 select * from t5 order by colint;
3286 colint  col1
3287 1       2006-02-03
3288 2       2006-01-17
3289 3       2006-01-25
3290 4       2006-02-05
3291 select * from t6 order by colint;
3292 colint  col1
3293 1       2006-02-03
3294 2       2006-01-17
3295 3       2006-01-25
3296 4       2006-02-05
3297 update t1 set col1='2006-02-05' where col1='2006-01-03';
3298 update t2 set col1='2006-02-05' where col1='2006-01-03';
3299 update t3 set col1='2006-02-05' where col1='2006-01-03';
3300 update t4 set col1='2006-02-05' where col1='2006-01-03';
3301 update t5 set col1='2006-02-05' where col1='2006-01-03';
3302 update t6 set col1='2006-02-05' where col1='2006-01-03';
3303 select * from t1 order by col1;
3304 col1
3305 2006-02-05
3306 2006-02-17
3307 select * from t2 order by col1;
3308 col1
3309 2006-01-25
3310 2006-02-05
3311 2006-02-17
3312 select * from t3 order by col1;
3313 col1
3314 2006-01-25
3315 2006-02-05
3316 2006-02-17
3317 select * from t4 order by colint;
3318 colint  col1
3319 1       2006-02-03
3320 2       2006-01-17
3321 3       2006-01-25
3322 4       2006-02-05
3323 select * from t5 order by colint;
3324 colint  col1
3325 1       2006-02-03
3326 2       2006-01-17
3327 3       2006-01-25
3328 4       2006-02-05
3329 select * from t6 order by colint;
3330 colint  col1
3331 1       2006-02-03
3332 2       2006-01-17
3333 3       2006-01-25
3334 4       2006-02-05
3335 -------------------------------------------------------------------------
3336 ---  Alter tables with dayofweek(col1)
3337 -------------------------------------------------------------------------
3338 drop table if exists t11 ;
3339 drop table if exists t22 ;
3340 drop table if exists t33 ;
3341 drop table if exists t44 ;
3342 drop table if exists t55 ;
3343 drop table if exists t66 ;
3344 create table t11 engine='NDB' as select * from t1;
3345 create table t22 engine='NDB' as select * from t2;
3346 create table t33 engine='NDB' as select * from t3;
3347 create table t44 engine='NDB' as select * from t4;
3348 create table t55 engine='NDB' as select * from t5;
3349 create table t66 engine='NDB' as select * from t6;
3350 alter table t11
3351 partition by range(dayofweek(col1)) 
3352 (partition p0 values less than (15),
3353 partition p1 values less than maxvalue);
3354 alter table t22
3355 partition by list(dayofweek(col1)) 
3356 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
3357 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
3358 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
3359 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
3360 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
3361 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
3363 alter table t33
3364 partition by hash(dayofweek(col1));
3365 alter table t44
3366 partition by range(colint) 
3367 subpartition by hash(dayofweek(col1)) subpartitions 2 
3368 (partition p0 values less than (15),
3369 partition p1 values less than maxvalue);
3370 alter table t55
3371 partition by list(colint) 
3372 subpartition by hash(dayofweek(col1)) subpartitions 2 
3373 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15),
3374 partition p1 values in (16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
3375 partition p2 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45),
3376 partition p3 values in (46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
3378 alter table t66
3379 partition by range(colint) 
3380 (partition p0 values less than (dayofweek('2006-12-24')),
3381 partition p1 values less than maxvalue);
3382 select * from t11 order by col1;
3383 col1
3384 2006-02-05
3385 2006-02-17
3386 select * from t22 order by col1;
3387 col1
3388 2006-01-25
3389 2006-02-05
3390 2006-02-17
3391 select * from t33 order by col1;
3392 col1
3393 2006-01-25
3394 2006-02-05
3395 2006-02-17
3396 select * from t44 order by colint;
3397 colint  col1
3398 1       2006-02-03
3399 2       2006-01-17
3400 3       2006-01-25
3401 4       2006-02-05
3402 select * from t55 order by colint;
3403 colint  col1
3404 1       2006-02-03
3405 2       2006-01-17
3406 3       2006-01-25
3407 4       2006-02-05
3408 select * from t66 order by colint;
3409 colint  col1
3410 1       2006-02-03
3411 2       2006-01-17
3412 3       2006-01-25
3413 4       2006-02-05
3414 ---------------------------
3415 ---- some alter table begin
3416 ---------------------------
3417 alter table t55
3418 partition by list(colint) 
3419 subpartition by hash(dayofweek(col1)) subpartitions 4 
3420 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
3421 partition p1 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
3423 show create table t55;
3424 Table   Create Table
3425 t55     CREATE TABLE `t55` (
3426   `colint` int(11) DEFAULT NULL,
3427   `col1` date DEFAULT NULL
3428 ) ENGINE=ndbcluster DEFAULT CHARSET=latin1
3429 /*!50100 PARTITION BY LIST (colint)
3430 SUBPARTITION BY HASH (dayofweek(col1))
3431 SUBPARTITIONS 4
3432 (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30) ENGINE = ndbcluster,
3433  PARTITION p1 VALUES IN (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60) ENGINE = ndbcluster) */
3434 select * from t55 order by colint;
3435 colint  col1
3436 1       2006-02-03
3437 2       2006-01-17
3438 3       2006-01-25
3439 4       2006-02-05
3440 -------------------------------------------------------------------------
3441 ---  Delete rows and partitions of tables with dayofweek(col1)
3442 -------------------------------------------------------------------------
3443 delete from t1 where col1='2006-02-17';
3444 delete from t2 where col1='2006-02-17';
3445 delete from t3 where col1='2006-02-17';
3446 delete from t4 where col1='2006-02-17';
3447 delete from t5 where col1='2006-02-17';
3448 delete from t6 where col1='2006-02-17';
3449 select * from t1 order by col1;
3450 col1
3451 2006-02-05
3452 select * from t2 order by col1;
3453 col1
3454 2006-01-25
3455 2006-02-05
3456 select * from t3 order by col1;
3457 col1
3458 2006-01-25
3459 2006-02-05
3460 select * from t4 order by colint;
3461 colint  col1
3462 1       2006-02-03
3463 2       2006-01-17
3464 3       2006-01-25
3465 4       2006-02-05
3466 select * from t5 order by colint;
3467 colint  col1
3468 1       2006-02-03
3469 2       2006-01-17
3470 3       2006-01-25
3471 4       2006-02-05
3472 insert into t1 values ('2006-02-17');
3473 insert into t2 values ('2006-02-17');
3474 insert into t3 values ('2006-02-17');
3475 insert into t4 values (60,'2006-02-17');
3476 insert into t5 values (60,'2006-02-17');
3477 insert into t6 values (60,'2006-02-17');
3478 select * from t1 order by col1;
3479 col1
3480 2006-02-05
3481 2006-02-17
3482 select * from t2 order by col1;
3483 col1
3484 2006-01-25
3485 2006-02-05
3486 2006-02-17
3487 select * from t3 order by col1;
3488 col1
3489 2006-01-25
3490 2006-02-05
3491 2006-02-17
3492 select * from t4 order by colint;
3493 colint  col1
3494 1       2006-02-03
3495 2       2006-01-17
3496 3       2006-01-25
3497 4       2006-02-05
3498 60      2006-02-17
3499 select * from t5 order by colint;
3500 colint  col1
3501 1       2006-02-03
3502 2       2006-01-17
3503 3       2006-01-25
3504 4       2006-02-05
3505 60      2006-02-17
3506 select * from t6 order by colint;
3507 colint  col1
3508 1       2006-02-03
3509 2       2006-01-17
3510 3       2006-01-25
3511 4       2006-02-05
3512 60      2006-02-17
3513 -------------------------------------------------------------------------
3514 ---  Delete rows and partitions of tables with dayofweek(col1)
3515 -------------------------------------------------------------------------
3516 delete from t11 where col1='2006-02-17';
3517 delete from t22 where col1='2006-02-17';
3518 delete from t33 where col1='2006-02-17';
3519 delete from t44 where col1='2006-02-17';
3520 delete from t55 where col1='2006-02-17';
3521 delete from t66 where col1='2006-02-17';
3522 select * from t11 order by col1;
3523 col1
3524 2006-02-05
3525 select * from t22 order by col1;
3526 col1
3527 2006-01-25
3528 2006-02-05
3529 select * from t33 order by col1;
3530 col1
3531 2006-01-25
3532 2006-02-05
3533 select * from t44 order by colint;
3534 colint  col1
3535 1       2006-02-03
3536 2       2006-01-17
3537 3       2006-01-25
3538 4       2006-02-05
3539 select * from t55 order by colint;
3540 colint  col1
3541 1       2006-02-03
3542 2       2006-01-17
3543 3       2006-01-25
3544 4       2006-02-05
3545 insert into t11 values ('2006-02-17');
3546 insert into t22 values ('2006-02-17');
3547 insert into t33 values ('2006-02-17');
3548 insert into t44 values (60,'2006-02-17');
3549 insert into t55 values (60,'2006-02-17');
3550 insert into t66 values (60,'2006-02-17');
3551 select * from t11 order by col1;
3552 col1
3553 2006-02-05
3554 2006-02-17
3555 select * from t22 order by col1;
3556 col1
3557 2006-01-25
3558 2006-02-05
3559 2006-02-17
3560 select * from t33 order by col1;
3561 col1
3562 2006-01-25
3563 2006-02-05
3564 2006-02-17
3565 select * from t44 order by colint;
3566 colint  col1
3567 1       2006-02-03
3568 2       2006-01-17
3569 3       2006-01-25
3570 4       2006-02-05
3571 60      2006-02-17
3572 select * from t55 order by colint;
3573 colint  col1
3574 1       2006-02-03
3575 2       2006-01-17
3576 3       2006-01-25
3577 4       2006-02-05
3578 60      2006-02-17
3579 select * from t66 order by colint;
3580 colint  col1
3581 1       2006-02-03
3582 2       2006-01-17
3583 3       2006-01-25
3584 4       2006-02-05
3585 60      2006-02-17
3586 -------------------------
3587 ---- some alter table end
3588 -------------------------
3589 drop table if exists t1 ;
3590 drop table if exists t2 ;
3591 drop table if exists t3 ;
3592 drop table if exists t4 ;
3593 drop table if exists t5 ;
3594 drop table if exists t6 ;
3595 drop table if exists t11 ;
3596 drop table if exists t22 ;
3597 drop table if exists t33 ;
3598 drop table if exists t44 ;
3599 drop table if exists t55 ;
3600 drop table if exists t66 ;
3601 -------------------------------------------------------------------------
3602 ---  dayofyear(col1)  in partition with coltype  date
3603 -------------------------------------------------------------------------
3604 drop table if exists t1 ;
3605 drop table if exists t2 ;
3606 drop table if exists t3 ;
3607 drop table if exists t4 ;
3608 drop table if exists t5 ;
3609 drop table if exists t6 ;
3610 -------------------------------------------------------------------------
3611 ---  Create tables with dayofyear(col1)
3612 -------------------------------------------------------------------------
3613 create table t1 (col1 date) engine='NDB' 
3614 partition by range(dayofyear(col1)) 
3615 (partition p0 values less than (15),
3616 partition p1 values less than maxvalue);
3617 create table t2 (col1 date) engine='NDB' 
3618 partition by list(dayofyear(col1)) 
3619 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
3620 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
3621 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
3622 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
3623 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
3624 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
3626 create table t3 (col1 date) engine='NDB' 
3627 partition by hash(dayofyear(col1));
3628 create table t4 (colint int, col1 date) engine='NDB' 
3629 partition by range(colint) 
3630 subpartition by hash(dayofyear(col1)) subpartitions 2 
3631 (partition p0 values less than (15),
3632 partition p1 values less than maxvalue);
3633 create table t5 (colint int, col1 date) engine='NDB' 
3634 partition by list(colint) 
3635 subpartition by hash(dayofyear(col1)) subpartitions 2 
3636 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15),
3637 partition p1 values in (16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
3638 partition p2 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45),
3639 partition p3 values in (46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
3641 create table t6 (colint int, col1 date) engine='NDB' 
3642 partition by range(colint) 
3643 (partition p0 values less than (dayofyear('2006-12-25')),
3644 partition p1 values less than maxvalue);
3645 -------------------------------------------------------------------------
3646 ---  Access tables with dayofyear(col1) 
3647 -------------------------------------------------------------------------
3648 insert into t1 values ('2006-01-03');
3649 insert into t1 values ('2006-01-17');
3650 insert into t2 values ('2006-01-03');
3651 insert into t2 values ('2006-01-17');
3652 insert into t2 values ('2006-02-25');
3653 insert into t3 values ('2006-01-03');
3654 insert into t3 values ('2006-01-17');
3655 insert into t3 values ('2006-02-25');
3656 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4;
3657 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5;
3658 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6;
3659 select dayofyear(col1) from t1 order by col1;
3660 dayofyear(col1)
3663 select * from t1 order by col1;
3664 col1
3665 2006-01-03
3666 2006-01-17
3667 select * from t2 order by col1;
3668 col1
3669 2006-01-03
3670 2006-01-17
3671 2006-02-25
3672 select * from t3 order by col1;
3673 col1
3674 2006-01-03
3675 2006-01-17
3676 2006-02-25
3677 select * from t4 order by colint;
3678 colint  col1
3679 1       2006-02-03
3680 2       2006-01-17
3681 3       2006-01-25
3682 4       2006-02-05
3683 select * from t5 order by colint;
3684 colint  col1
3685 1       2006-02-03
3686 2       2006-01-17
3687 3       2006-01-25
3688 4       2006-02-05
3689 select * from t6 order by colint;
3690 colint  col1
3691 1       2006-02-03
3692 2       2006-01-17
3693 3       2006-01-25
3694 4       2006-02-05
3695 update t1 set col1='2006-02-05' where col1='2006-01-03';
3696 update t2 set col1='2006-02-05' where col1='2006-01-03';
3697 update t3 set col1='2006-02-05' where col1='2006-01-03';
3698 update t4 set col1='2006-02-05' where col1='2006-01-03';
3699 update t5 set col1='2006-02-05' where col1='2006-01-03';
3700 update t6 set col1='2006-02-05' where col1='2006-01-03';
3701 select * from t1 order by col1;
3702 col1
3703 2006-01-17
3704 2006-02-05
3705 select * from t2 order by col1;
3706 col1
3707 2006-01-17
3708 2006-02-05
3709 2006-02-25
3710 select * from t3 order by col1;
3711 col1
3712 2006-01-17
3713 2006-02-05
3714 2006-02-25
3715 select * from t4 order by colint;
3716 colint  col1
3717 1       2006-02-03
3718 2       2006-01-17
3719 3       2006-01-25
3720 4       2006-02-05
3721 select * from t5 order by colint;
3722 colint  col1
3723 1       2006-02-03
3724 2       2006-01-17
3725 3       2006-01-25
3726 4       2006-02-05
3727 select * from t6 order by colint;
3728 colint  col1
3729 1       2006-02-03
3730 2       2006-01-17
3731 3       2006-01-25
3732 4       2006-02-05
3733 -------------------------------------------------------------------------
3734 ---  Alter tables with dayofyear(col1)
3735 -------------------------------------------------------------------------
3736 drop table if exists t11 ;
3737 drop table if exists t22 ;
3738 drop table if exists t33 ;
3739 drop table if exists t44 ;
3740 drop table if exists t55 ;
3741 drop table if exists t66 ;
3742 create table t11 engine='NDB' as select * from t1;
3743 create table t22 engine='NDB' as select * from t2;
3744 create table t33 engine='NDB' as select * from t3;
3745 create table t44 engine='NDB' as select * from t4;
3746 create table t55 engine='NDB' as select * from t5;
3747 create table t66 engine='NDB' as select * from t6;
3748 alter table t11
3749 partition by range(dayofyear(col1)) 
3750 (partition p0 values less than (15),
3751 partition p1 values less than maxvalue);
3752 alter table t22
3753 partition by list(dayofyear(col1)) 
3754 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
3755 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
3756 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
3757 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
3758 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
3759 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
3761 alter table t33
3762 partition by hash(dayofyear(col1));
3763 alter table t44
3764 partition by range(colint) 
3765 subpartition by hash(dayofyear(col1)) subpartitions 2 
3766 (partition p0 values less than (15),
3767 partition p1 values less than maxvalue);
3768 alter table t55
3769 partition by list(colint) 
3770 subpartition by hash(dayofyear(col1)) subpartitions 2 
3771 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15),
3772 partition p1 values in (16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
3773 partition p2 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45),
3774 partition p3 values in (46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
3776 alter table t66
3777 partition by range(colint) 
3778 (partition p0 values less than (dayofyear('2006-12-25')),
3779 partition p1 values less than maxvalue);
3780 select * from t11 order by col1;
3781 col1
3782 2006-01-17
3783 2006-02-05
3784 select * from t22 order by col1;
3785 col1
3786 2006-01-17
3787 2006-02-05
3788 2006-02-25
3789 select * from t33 order by col1;
3790 col1
3791 2006-01-17
3792 2006-02-05
3793 2006-02-25
3794 select * from t44 order by colint;
3795 colint  col1
3796 1       2006-02-03
3797 2       2006-01-17
3798 3       2006-01-25
3799 4       2006-02-05
3800 select * from t55 order by colint;
3801 colint  col1
3802 1       2006-02-03
3803 2       2006-01-17
3804 3       2006-01-25
3805 4       2006-02-05
3806 select * from t66 order by colint;
3807 colint  col1
3808 1       2006-02-03
3809 2       2006-01-17
3810 3       2006-01-25
3811 4       2006-02-05
3812 ---------------------------
3813 ---- some alter table begin
3814 ---------------------------
3815 alter table t55
3816 partition by list(colint) 
3817 subpartition by hash(dayofyear(col1)) subpartitions 4 
3818 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
3819 partition p1 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
3821 show create table t55;
3822 Table   Create Table
3823 t55     CREATE TABLE `t55` (
3824   `colint` int(11) DEFAULT NULL,
3825   `col1` date DEFAULT NULL
3826 ) ENGINE=ndbcluster DEFAULT CHARSET=latin1
3827 /*!50100 PARTITION BY LIST (colint)
3828 SUBPARTITION BY HASH (dayofyear(col1))
3829 SUBPARTITIONS 4
3830 (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30) ENGINE = ndbcluster,
3831  PARTITION p1 VALUES IN (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60) ENGINE = ndbcluster) */
3832 select * from t55 order by colint;
3833 colint  col1
3834 1       2006-02-03
3835 2       2006-01-17
3836 3       2006-01-25
3837 4       2006-02-05
3838 -------------------------------------------------------------------------
3839 ---  Delete rows and partitions of tables with dayofyear(col1)
3840 -------------------------------------------------------------------------
3841 delete from t1 where col1='2006-01-17';
3842 delete from t2 where col1='2006-01-17';
3843 delete from t3 where col1='2006-01-17';
3844 delete from t4 where col1='2006-01-17';
3845 delete from t5 where col1='2006-01-17';
3846 delete from t6 where col1='2006-01-17';
3847 select * from t1 order by col1;
3848 col1
3849 2006-02-05
3850 select * from t2 order by col1;
3851 col1
3852 2006-02-05
3853 2006-02-25
3854 select * from t3 order by col1;
3855 col1
3856 2006-02-05
3857 2006-02-25
3858 select * from t4 order by colint;
3859 colint  col1
3860 1       2006-02-03
3861 3       2006-01-25
3862 4       2006-02-05
3863 select * from t5 order by colint;
3864 colint  col1
3865 1       2006-02-03
3866 3       2006-01-25
3867 4       2006-02-05
3868 insert into t1 values ('2006-01-17');
3869 insert into t2 values ('2006-01-17');
3870 insert into t3 values ('2006-01-17');
3871 insert into t4 values (60,'2006-01-17');
3872 insert into t5 values (60,'2006-01-17');
3873 insert into t6 values (60,'2006-01-17');
3874 select * from t1 order by col1;
3875 col1
3876 2006-01-17
3877 2006-02-05
3878 select * from t2 order by col1;
3879 col1
3880 2006-01-17
3881 2006-02-05
3882 2006-02-25
3883 select * from t3 order by col1;
3884 col1
3885 2006-01-17
3886 2006-02-05
3887 2006-02-25
3888 select * from t4 order by colint;
3889 colint  col1
3890 1       2006-02-03
3891 3       2006-01-25
3892 4       2006-02-05
3893 60      2006-01-17
3894 select * from t5 order by colint;
3895 colint  col1
3896 1       2006-02-03
3897 3       2006-01-25
3898 4       2006-02-05
3899 60      2006-01-17
3900 select * from t6 order by colint;
3901 colint  col1
3902 1       2006-02-03
3903 3       2006-01-25
3904 4       2006-02-05
3905 60      2006-01-17
3906 -------------------------------------------------------------------------
3907 ---  Delete rows and partitions of tables with dayofyear(col1)
3908 -------------------------------------------------------------------------
3909 delete from t11 where col1='2006-01-17';
3910 delete from t22 where col1='2006-01-17';
3911 delete from t33 where col1='2006-01-17';
3912 delete from t44 where col1='2006-01-17';
3913 delete from t55 where col1='2006-01-17';
3914 delete from t66 where col1='2006-01-17';
3915 select * from t11 order by col1;
3916 col1
3917 2006-02-05
3918 select * from t22 order by col1;
3919 col1
3920 2006-02-05
3921 2006-02-25
3922 select * from t33 order by col1;
3923 col1
3924 2006-02-05
3925 2006-02-25
3926 select * from t44 order by colint;
3927 colint  col1
3928 1       2006-02-03
3929 3       2006-01-25
3930 4       2006-02-05
3931 select * from t55 order by colint;
3932 colint  col1
3933 1       2006-02-03
3934 3       2006-01-25
3935 4       2006-02-05
3936 insert into t11 values ('2006-01-17');
3937 insert into t22 values ('2006-01-17');
3938 insert into t33 values ('2006-01-17');
3939 insert into t44 values (60,'2006-01-17');
3940 insert into t55 values (60,'2006-01-17');
3941 insert into t66 values (60,'2006-01-17');
3942 select * from t11 order by col1;
3943 col1
3944 2006-01-17
3945 2006-02-05
3946 select * from t22 order by col1;
3947 col1
3948 2006-01-17
3949 2006-02-05
3950 2006-02-25
3951 select * from t33 order by col1;
3952 col1
3953 2006-01-17
3954 2006-02-05
3955 2006-02-25
3956 select * from t44 order by colint;
3957 colint  col1
3958 1       2006-02-03
3959 3       2006-01-25
3960 4       2006-02-05
3961 60      2006-01-17
3962 select * from t55 order by colint;
3963 colint  col1
3964 1       2006-02-03
3965 3       2006-01-25
3966 4       2006-02-05
3967 60      2006-01-17
3968 select * from t66 order by colint;
3969 colint  col1
3970 1       2006-02-03
3971 3       2006-01-25
3972 4       2006-02-05
3973 60      2006-01-17
3974 -------------------------
3975 ---- some alter table end
3976 -------------------------
3977 drop table if exists t1 ;
3978 drop table if exists t2 ;
3979 drop table if exists t3 ;
3980 drop table if exists t4 ;
3981 drop table if exists t5 ;
3982 drop table if exists t6 ;
3983 drop table if exists t11 ;
3984 drop table if exists t22 ;
3985 drop table if exists t33 ;
3986 drop table if exists t44 ;
3987 drop table if exists t55 ;
3988 drop table if exists t66 ;
3989 -------------------------------------------------------------------------
3990 ---  dayofyear(col1)  in partition with coltype  char(30)
3991 -------------------------------------------------------------------------
3992 drop table if exists t1 ;
3993 drop table if exists t2 ;
3994 drop table if exists t3 ;
3995 drop table if exists t4 ;
3996 drop table if exists t5 ;
3997 drop table if exists t6 ;
3998 -------------------------------------------------------------------------
3999 ---  Create tables with dayofyear(col1)
4000 -------------------------------------------------------------------------
4001 create table t1 (col1 char(30)) engine='NDB' 
4002 partition by range(dayofyear(col1)) 
4003 (partition p0 values less than (15),
4004 partition p1 values less than maxvalue);
4005 create table t2 (col1 char(30)) engine='NDB' 
4006 partition by list(dayofyear(col1)) 
4007 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
4008 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
4009 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
4010 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
4011 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
4012 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
4014 create table t3 (col1 char(30)) engine='NDB' 
4015 partition by hash(dayofyear(col1));
4016 create table t4 (colint int, col1 char(30)) engine='NDB' 
4017 partition by range(colint) 
4018 subpartition by hash(dayofyear(col1)) subpartitions 2 
4019 (partition p0 values less than (15),
4020 partition p1 values less than maxvalue);
4021 create table t5 (colint int, col1 char(30)) engine='NDB' 
4022 partition by list(colint) 
4023 subpartition by hash(dayofyear(col1)) subpartitions 2 
4024 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15),
4025 partition p1 values in (16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
4026 partition p2 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45),
4027 partition p3 values in (46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
4029 create table t6 (colint int, col1 char(30)) engine='NDB' 
4030 partition by range(colint) 
4031 (partition p0 values less than (dayofyear('2006-12-25')),
4032 partition p1 values less than maxvalue);
4033 -------------------------------------------------------------------------
4034 ---  Access tables with dayofyear(col1) 
4035 -------------------------------------------------------------------------
4036 insert into t1 values ('2006-01-03');
4037 insert into t1 values ('2006-01-17');
4038 insert into t2 values ('2006-01-03');
4039 insert into t2 values ('2006-01-17');
4040 insert into t2 values ('2006-02-25');
4041 insert into t3 values ('2006-01-03');
4042 insert into t3 values ('2006-01-17');
4043 insert into t3 values ('2006-02-25');
4044 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4;
4045 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5;
4046 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6;
4047 select dayofyear(col1) from t1 order by col1;
4048 dayofyear(col1)
4051 select * from t1 order by col1;
4052 col1
4053 2006-01-03
4054 2006-01-17
4055 select * from t2 order by col1;
4056 col1
4057 2006-01-03
4058 2006-01-17
4059 2006-02-25
4060 select * from t3 order by col1;
4061 col1
4062 2006-01-03
4063 2006-01-17
4064 2006-02-25
4065 select * from t4 order by colint;
4066 colint  col1
4067 1       2006-02-03
4068 2       2006-01-17
4069 3       2006-01-25
4070 4       2006-02-05
4071 select * from t5 order by colint;
4072 colint  col1
4073 1       2006-02-03
4074 2       2006-01-17
4075 3       2006-01-25
4076 4       2006-02-05
4077 select * from t6 order by colint;
4078 colint  col1
4079 1       2006-02-03
4080 2       2006-01-17
4081 3       2006-01-25
4082 4       2006-02-05
4083 update t1 set col1='2006-02-05' where col1='2006-01-03';
4084 update t2 set col1='2006-02-05' where col1='2006-01-03';
4085 update t3 set col1='2006-02-05' where col1='2006-01-03';
4086 update t4 set col1='2006-02-05' where col1='2006-01-03';
4087 update t5 set col1='2006-02-05' where col1='2006-01-03';
4088 update t6 set col1='2006-02-05' where col1='2006-01-03';
4089 select * from t1 order by col1;
4090 col1
4091 2006-01-17
4092 2006-02-05
4093 select * from t2 order by col1;
4094 col1
4095 2006-01-17
4096 2006-02-05
4097 2006-02-25
4098 select * from t3 order by col1;
4099 col1
4100 2006-01-17
4101 2006-02-05
4102 2006-02-25
4103 select * from t4 order by colint;
4104 colint  col1
4105 1       2006-02-03
4106 2       2006-01-17
4107 3       2006-01-25
4108 4       2006-02-05
4109 select * from t5 order by colint;
4110 colint  col1
4111 1       2006-02-03
4112 2       2006-01-17
4113 3       2006-01-25
4114 4       2006-02-05
4115 select * from t6 order by colint;
4116 colint  col1
4117 1       2006-02-03
4118 2       2006-01-17
4119 3       2006-01-25
4120 4       2006-02-05
4121 -------------------------------------------------------------------------
4122 ---  Alter tables with dayofyear(col1)
4123 -------------------------------------------------------------------------
4124 drop table if exists t11 ;
4125 drop table if exists t22 ;
4126 drop table if exists t33 ;
4127 drop table if exists t44 ;
4128 drop table if exists t55 ;
4129 drop table if exists t66 ;
4130 create table t11 engine='NDB' as select * from t1;
4131 create table t22 engine='NDB' as select * from t2;
4132 create table t33 engine='NDB' as select * from t3;
4133 create table t44 engine='NDB' as select * from t4;
4134 create table t55 engine='NDB' as select * from t5;
4135 create table t66 engine='NDB' as select * from t6;
4136 alter table t11
4137 partition by range(dayofyear(col1)) 
4138 (partition p0 values less than (15),
4139 partition p1 values less than maxvalue);
4140 alter table t22
4141 partition by list(dayofyear(col1)) 
4142 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
4143 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
4144 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
4145 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
4146 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
4147 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
4149 alter table t33
4150 partition by hash(dayofyear(col1));
4151 alter table t44
4152 partition by range(colint) 
4153 subpartition by hash(dayofyear(col1)) subpartitions 2 
4154 (partition p0 values less than (15),
4155 partition p1 values less than maxvalue);
4156 alter table t55
4157 partition by list(colint) 
4158 subpartition by hash(dayofyear(col1)) subpartitions 2 
4159 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15),
4160 partition p1 values in (16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
4161 partition p2 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45),
4162 partition p3 values in (46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
4164 alter table t66
4165 partition by range(colint) 
4166 (partition p0 values less than (dayofyear('2006-12-25')),
4167 partition p1 values less than maxvalue);
4168 select * from t11 order by col1;
4169 col1
4170 2006-01-17
4171 2006-02-05
4172 select * from t22 order by col1;
4173 col1
4174 2006-01-17
4175 2006-02-05
4176 2006-02-25
4177 select * from t33 order by col1;
4178 col1
4179 2006-01-17
4180 2006-02-05
4181 2006-02-25
4182 select * from t44 order by colint;
4183 colint  col1
4184 1       2006-02-03
4185 2       2006-01-17
4186 3       2006-01-25
4187 4       2006-02-05
4188 select * from t55 order by colint;
4189 colint  col1
4190 1       2006-02-03
4191 2       2006-01-17
4192 3       2006-01-25
4193 4       2006-02-05
4194 select * from t66 order by colint;
4195 colint  col1
4196 1       2006-02-03
4197 2       2006-01-17
4198 3       2006-01-25
4199 4       2006-02-05
4200 ---------------------------
4201 ---- some alter table begin
4202 ---------------------------
4203 alter table t55
4204 partition by list(colint) 
4205 subpartition by hash(dayofyear(col1)) subpartitions 4 
4206 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
4207 partition p1 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
4209 show create table t55;
4210 Table   Create Table
4211 t55     CREATE TABLE `t55` (
4212   `colint` int(11) DEFAULT NULL,
4213   `col1` char(30) DEFAULT NULL
4214 ) ENGINE=ndbcluster DEFAULT CHARSET=latin1
4215 /*!50100 PARTITION BY LIST (colint)
4216 SUBPARTITION BY HASH (dayofyear(col1))
4217 SUBPARTITIONS 4
4218 (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30) ENGINE = ndbcluster,
4219  PARTITION p1 VALUES IN (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60) ENGINE = ndbcluster) */
4220 select * from t55 order by colint;
4221 colint  col1
4222 1       2006-02-03
4223 2       2006-01-17
4224 3       2006-01-25
4225 4       2006-02-05
4226 -------------------------------------------------------------------------
4227 ---  Delete rows and partitions of tables with dayofyear(col1)
4228 -------------------------------------------------------------------------
4229 delete from t1 where col1='2006-01-17';
4230 delete from t2 where col1='2006-01-17';
4231 delete from t3 where col1='2006-01-17';
4232 delete from t4 where col1='2006-01-17';
4233 delete from t5 where col1='2006-01-17';
4234 delete from t6 where col1='2006-01-17';
4235 select * from t1 order by col1;
4236 col1
4237 2006-02-05
4238 select * from t2 order by col1;
4239 col1
4240 2006-02-05
4241 2006-02-25
4242 select * from t3 order by col1;
4243 col1
4244 2006-02-05
4245 2006-02-25
4246 select * from t4 order by colint;
4247 colint  col1
4248 1       2006-02-03
4249 3       2006-01-25
4250 4       2006-02-05
4251 select * from t5 order by colint;
4252 colint  col1
4253 1       2006-02-03
4254 3       2006-01-25
4255 4       2006-02-05
4256 insert into t1 values ('2006-01-17');
4257 insert into t2 values ('2006-01-17');
4258 insert into t3 values ('2006-01-17');
4259 insert into t4 values (60,'2006-01-17');
4260 insert into t5 values (60,'2006-01-17');
4261 insert into t6 values (60,'2006-01-17');
4262 select * from t1 order by col1;
4263 col1
4264 2006-01-17
4265 2006-02-05
4266 select * from t2 order by col1;
4267 col1
4268 2006-01-17
4269 2006-02-05
4270 2006-02-25
4271 select * from t3 order by col1;
4272 col1
4273 2006-01-17
4274 2006-02-05
4275 2006-02-25
4276 select * from t4 order by colint;
4277 colint  col1
4278 1       2006-02-03
4279 3       2006-01-25
4280 4       2006-02-05
4281 60      2006-01-17
4282 select * from t5 order by colint;
4283 colint  col1
4284 1       2006-02-03
4285 3       2006-01-25
4286 4       2006-02-05
4287 60      2006-01-17
4288 select * from t6 order by colint;
4289 colint  col1
4290 1       2006-02-03
4291 3       2006-01-25
4292 4       2006-02-05
4293 60      2006-01-17
4294 -------------------------------------------------------------------------
4295 ---  Delete rows and partitions of tables with dayofyear(col1)
4296 -------------------------------------------------------------------------
4297 delete from t11 where col1='2006-01-17';
4298 delete from t22 where col1='2006-01-17';
4299 delete from t33 where col1='2006-01-17';
4300 delete from t44 where col1='2006-01-17';
4301 delete from t55 where col1='2006-01-17';
4302 delete from t66 where col1='2006-01-17';
4303 select * from t11 order by col1;
4304 col1
4305 2006-02-05
4306 select * from t22 order by col1;
4307 col1
4308 2006-02-05
4309 2006-02-25
4310 select * from t33 order by col1;
4311 col1
4312 2006-02-05
4313 2006-02-25
4314 select * from t44 order by colint;
4315 colint  col1
4316 1       2006-02-03
4317 3       2006-01-25
4318 4       2006-02-05
4319 select * from t55 order by colint;
4320 colint  col1
4321 1       2006-02-03
4322 3       2006-01-25
4323 4       2006-02-05
4324 insert into t11 values ('2006-01-17');
4325 insert into t22 values ('2006-01-17');
4326 insert into t33 values ('2006-01-17');
4327 insert into t44 values (60,'2006-01-17');
4328 insert into t55 values (60,'2006-01-17');
4329 insert into t66 values (60,'2006-01-17');
4330 select * from t11 order by col1;
4331 col1
4332 2006-01-17
4333 2006-02-05
4334 select * from t22 order by col1;
4335 col1
4336 2006-01-17
4337 2006-02-05
4338 2006-02-25
4339 select * from t33 order by col1;
4340 col1
4341 2006-01-17
4342 2006-02-05
4343 2006-02-25
4344 select * from t44 order by colint;
4345 colint  col1
4346 1       2006-02-03
4347 3       2006-01-25
4348 4       2006-02-05
4349 60      2006-01-17
4350 select * from t55 order by colint;
4351 colint  col1
4352 1       2006-02-03
4353 3       2006-01-25
4354 4       2006-02-05
4355 60      2006-01-17
4356 select * from t66 order by colint;
4357 colint  col1
4358 1       2006-02-03
4359 3       2006-01-25
4360 4       2006-02-05
4361 60      2006-01-17
4362 -------------------------
4363 ---- some alter table end
4364 -------------------------
4365 drop table if exists t1 ;
4366 drop table if exists t2 ;
4367 drop table if exists t3 ;
4368 drop table if exists t4 ;
4369 drop table if exists t5 ;
4370 drop table if exists t6 ;
4371 drop table if exists t11 ;
4372 drop table if exists t22 ;
4373 drop table if exists t33 ;
4374 drop table if exists t44 ;
4375 drop table if exists t55 ;
4376 drop table if exists t66 ;
4377 -------------------------------------------------------------------------
4378 ---  extract(month from col1)  in partition with coltype  date
4379 -------------------------------------------------------------------------
4380 drop table if exists t1 ;
4381 drop table if exists t2 ;
4382 drop table if exists t3 ;
4383 drop table if exists t4 ;
4384 drop table if exists t5 ;
4385 drop table if exists t6 ;
4386 -------------------------------------------------------------------------
4387 ---  Create tables with extract(month from col1)
4388 -------------------------------------------------------------------------
4389 create table t1 (col1 date) engine='NDB' 
4390 partition by range(extract(month from col1)) 
4391 (partition p0 values less than (15),
4392 partition p1 values less than maxvalue);
4393 create table t2 (col1 date) engine='NDB' 
4394 partition by list(extract(month from col1)) 
4395 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
4396 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
4397 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
4398 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
4399 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
4400 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
4402 create table t3 (col1 date) engine='NDB' 
4403 partition by hash(extract(month from col1));
4404 create table t4 (colint int, col1 date) engine='NDB' 
4405 partition by range(colint) 
4406 subpartition by hash(extract(month from col1)) subpartitions 2 
4407 (partition p0 values less than (15),
4408 partition p1 values less than maxvalue);
4409 create table t5 (colint int, col1 date) engine='NDB' 
4410 partition by list(colint) 
4411 subpartition by hash(extract(month from col1)) subpartitions 2 
4412 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15),
4413 partition p1 values in (16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
4414 partition p2 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45),
4415 partition p3 values in (46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
4417 create table t6 (colint int, col1 date) engine='NDB' 
4418 partition by range(colint) 
4419 (partition p0 values less than (extract(year from '1998-11-23')),
4420 partition p1 values less than maxvalue);
4421 -------------------------------------------------------------------------
4422 ---  Access tables with extract(month from col1) 
4423 -------------------------------------------------------------------------
4424 insert into t1 values ('2006-01-03');
4425 insert into t1 values ('2006-02-17');
4426 insert into t2 values ('2006-01-03');
4427 insert into t2 values ('2006-02-17');
4428 insert into t2 values ('2006-01-25');
4429 insert into t3 values ('2006-01-03');
4430 insert into t3 values ('2006-02-17');
4431 insert into t3 values ('2006-01-25');
4432 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4;
4433 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5;
4434 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6;
4435 select extract(month from col1) from t1 order by col1;
4436 extract(month from col1)
4439 select * from t1 order by col1;
4440 col1
4441 2006-01-03
4442 2006-02-17
4443 select * from t2 order by col1;
4444 col1
4445 2006-01-03
4446 2006-01-25
4447 2006-02-17
4448 select * from t3 order by col1;
4449 col1
4450 2006-01-03
4451 2006-01-25
4452 2006-02-17
4453 select * from t4 order by colint;
4454 colint  col1
4455 1       2006-02-03
4456 2       2006-01-17
4457 3       2006-01-25
4458 4       2006-02-05
4459 select * from t5 order by colint;
4460 colint  col1
4461 1       2006-02-03
4462 2       2006-01-17
4463 3       2006-01-25
4464 4       2006-02-05
4465 select * from t6 order by colint;
4466 colint  col1
4467 1       2006-02-03
4468 2       2006-01-17
4469 3       2006-01-25
4470 4       2006-02-05
4471 update t1 set col1='2006-02-05' where col1='2006-01-03';
4472 update t2 set col1='2006-02-05' where col1='2006-01-03';
4473 update t3 set col1='2006-02-05' where col1='2006-01-03';
4474 update t4 set col1='2006-02-05' where col1='2006-01-03';
4475 update t5 set col1='2006-02-05' where col1='2006-01-03';
4476 update t6 set col1='2006-02-05' where col1='2006-01-03';
4477 select * from t1 order by col1;
4478 col1
4479 2006-02-05
4480 2006-02-17
4481 select * from t2 order by col1;
4482 col1
4483 2006-01-25
4484 2006-02-05
4485 2006-02-17
4486 select * from t3 order by col1;
4487 col1
4488 2006-01-25
4489 2006-02-05
4490 2006-02-17
4491 select * from t4 order by colint;
4492 colint  col1
4493 1       2006-02-03
4494 2       2006-01-17
4495 3       2006-01-25
4496 4       2006-02-05
4497 select * from t5 order by colint;
4498 colint  col1
4499 1       2006-02-03
4500 2       2006-01-17
4501 3       2006-01-25
4502 4       2006-02-05
4503 select * from t6 order by colint;
4504 colint  col1
4505 1       2006-02-03
4506 2       2006-01-17
4507 3       2006-01-25
4508 4       2006-02-05
4509 -------------------------------------------------------------------------
4510 ---  Alter tables with extract(month from col1)
4511 -------------------------------------------------------------------------
4512 drop table if exists t11 ;
4513 drop table if exists t22 ;
4514 drop table if exists t33 ;
4515 drop table if exists t44 ;
4516 drop table if exists t55 ;
4517 drop table if exists t66 ;
4518 create table t11 engine='NDB' as select * from t1;
4519 create table t22 engine='NDB' as select * from t2;
4520 create table t33 engine='NDB' as select * from t3;
4521 create table t44 engine='NDB' as select * from t4;
4522 create table t55 engine='NDB' as select * from t5;
4523 create table t66 engine='NDB' as select * from t6;
4524 alter table t11
4525 partition by range(extract(month from col1)) 
4526 (partition p0 values less than (15),
4527 partition p1 values less than maxvalue);
4528 alter table t22
4529 partition by list(extract(month from col1)) 
4530 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
4531 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
4532 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
4533 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
4534 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
4535 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
4537 alter table t33
4538 partition by hash(extract(month from col1));
4539 alter table t44
4540 partition by range(colint) 
4541 subpartition by hash(extract(month from col1)) subpartitions 2 
4542 (partition p0 values less than (15),
4543 partition p1 values less than maxvalue);
4544 alter table t55
4545 partition by list(colint) 
4546 subpartition by hash(extract(month from col1)) subpartitions 2 
4547 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15),
4548 partition p1 values in (16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
4549 partition p2 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45),
4550 partition p3 values in (46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
4552 alter table t66
4553 partition by range(colint) 
4554 (partition p0 values less than (extract(year from '1998-11-23')),
4555 partition p1 values less than maxvalue);
4556 select * from t11 order by col1;
4557 col1
4558 2006-02-05
4559 2006-02-17
4560 select * from t22 order by col1;
4561 col1
4562 2006-01-25
4563 2006-02-05
4564 2006-02-17
4565 select * from t33 order by col1;
4566 col1
4567 2006-01-25
4568 2006-02-05
4569 2006-02-17
4570 select * from t44 order by colint;
4571 colint  col1
4572 1       2006-02-03
4573 2       2006-01-17
4574 3       2006-01-25
4575 4       2006-02-05
4576 select * from t55 order by colint;
4577 colint  col1
4578 1       2006-02-03
4579 2       2006-01-17
4580 3       2006-01-25
4581 4       2006-02-05
4582 select * from t66 order by colint;
4583 colint  col1
4584 1       2006-02-03
4585 2       2006-01-17
4586 3       2006-01-25
4587 4       2006-02-05
4588 ---------------------------
4589 ---- some alter table begin
4590 ---------------------------
4591 alter table t55
4592 partition by list(colint) 
4593 subpartition by hash(extract(month from col1)) subpartitions 4 
4594 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
4595 partition p1 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
4597 show create table t55;
4598 Table   Create Table
4599 t55     CREATE TABLE `t55` (
4600   `colint` int(11) DEFAULT NULL,
4601   `col1` date DEFAULT NULL
4602 ) ENGINE=ndbcluster DEFAULT CHARSET=latin1
4603 /*!50100 PARTITION BY LIST (colint)
4604 SUBPARTITION BY HASH (extract(month from col1))
4605 SUBPARTITIONS 4
4606 (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30) ENGINE = ndbcluster,
4607  PARTITION p1 VALUES IN (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60) ENGINE = ndbcluster) */
4608 select * from t55 order by colint;
4609 colint  col1
4610 1       2006-02-03
4611 2       2006-01-17
4612 3       2006-01-25
4613 4       2006-02-05
4614 -------------------------------------------------------------------------
4615 ---  Delete rows and partitions of tables with extract(month from col1)
4616 -------------------------------------------------------------------------
4617 delete from t1 where col1='2006-02-17';
4618 delete from t2 where col1='2006-02-17';
4619 delete from t3 where col1='2006-02-17';
4620 delete from t4 where col1='2006-02-17';
4621 delete from t5 where col1='2006-02-17';
4622 delete from t6 where col1='2006-02-17';
4623 select * from t1 order by col1;
4624 col1
4625 2006-02-05
4626 select * from t2 order by col1;
4627 col1
4628 2006-01-25
4629 2006-02-05
4630 select * from t3 order by col1;
4631 col1
4632 2006-01-25
4633 2006-02-05
4634 select * from t4 order by colint;
4635 colint  col1
4636 1       2006-02-03
4637 2       2006-01-17
4638 3       2006-01-25
4639 4       2006-02-05
4640 select * from t5 order by colint;
4641 colint  col1
4642 1       2006-02-03
4643 2       2006-01-17
4644 3       2006-01-25
4645 4       2006-02-05
4646 insert into t1 values ('2006-02-17');
4647 insert into t2 values ('2006-02-17');
4648 insert into t3 values ('2006-02-17');
4649 insert into t4 values (60,'2006-02-17');
4650 insert into t5 values (60,'2006-02-17');
4651 insert into t6 values (60,'2006-02-17');
4652 select * from t1 order by col1;
4653 col1
4654 2006-02-05
4655 2006-02-17
4656 select * from t2 order by col1;
4657 col1
4658 2006-01-25
4659 2006-02-05
4660 2006-02-17
4661 select * from t3 order by col1;
4662 col1
4663 2006-01-25
4664 2006-02-05
4665 2006-02-17
4666 select * from t4 order by colint;
4667 colint  col1
4668 1       2006-02-03
4669 2       2006-01-17
4670 3       2006-01-25
4671 4       2006-02-05
4672 60      2006-02-17
4673 select * from t5 order by colint;
4674 colint  col1
4675 1       2006-02-03
4676 2       2006-01-17
4677 3       2006-01-25
4678 4       2006-02-05
4679 60      2006-02-17
4680 select * from t6 order by colint;
4681 colint  col1
4682 1       2006-02-03
4683 2       2006-01-17
4684 3       2006-01-25
4685 4       2006-02-05
4686 60      2006-02-17
4687 -------------------------------------------------------------------------
4688 ---  Delete rows and partitions of tables with extract(month from col1)
4689 -------------------------------------------------------------------------
4690 delete from t11 where col1='2006-02-17';
4691 delete from t22 where col1='2006-02-17';
4692 delete from t33 where col1='2006-02-17';
4693 delete from t44 where col1='2006-02-17';
4694 delete from t55 where col1='2006-02-17';
4695 delete from t66 where col1='2006-02-17';
4696 select * from t11 order by col1;
4697 col1
4698 2006-02-05
4699 select * from t22 order by col1;
4700 col1
4701 2006-01-25
4702 2006-02-05
4703 select * from t33 order by col1;
4704 col1
4705 2006-01-25
4706 2006-02-05
4707 select * from t44 order by colint;
4708 colint  col1
4709 1       2006-02-03
4710 2       2006-01-17
4711 3       2006-01-25
4712 4       2006-02-05
4713 select * from t55 order by colint;
4714 colint  col1
4715 1       2006-02-03
4716 2       2006-01-17
4717 3       2006-01-25
4718 4       2006-02-05
4719 insert into t11 values ('2006-02-17');
4720 insert into t22 values ('2006-02-17');
4721 insert into t33 values ('2006-02-17');
4722 insert into t44 values (60,'2006-02-17');
4723 insert into t55 values (60,'2006-02-17');
4724 insert into t66 values (60,'2006-02-17');
4725 select * from t11 order by col1;
4726 col1
4727 2006-02-05
4728 2006-02-17
4729 select * from t22 order by col1;
4730 col1
4731 2006-01-25
4732 2006-02-05
4733 2006-02-17
4734 select * from t33 order by col1;
4735 col1
4736 2006-01-25
4737 2006-02-05
4738 2006-02-17
4739 select * from t44 order by colint;
4740 colint  col1
4741 1       2006-02-03
4742 2       2006-01-17
4743 3       2006-01-25
4744 4       2006-02-05
4745 60      2006-02-17
4746 select * from t55 order by colint;
4747 colint  col1
4748 1       2006-02-03
4749 2       2006-01-17
4750 3       2006-01-25
4751 4       2006-02-05
4752 60      2006-02-17
4753 select * from t66 order by colint;
4754 colint  col1
4755 1       2006-02-03
4756 2       2006-01-17
4757 3       2006-01-25
4758 4       2006-02-05
4759 60      2006-02-17
4760 -------------------------
4761 ---- some alter table end
4762 -------------------------
4763 drop table if exists t1 ;
4764 drop table if exists t2 ;
4765 drop table if exists t3 ;
4766 drop table if exists t4 ;
4767 drop table if exists t5 ;
4768 drop table if exists t6 ;
4769 drop table if exists t11 ;
4770 drop table if exists t22 ;
4771 drop table if exists t33 ;
4772 drop table if exists t44 ;
4773 drop table if exists t55 ;
4774 drop table if exists t66 ;
4775 -------------------------------------------------------------------------
4776 ---  hour(col1)  in partition with coltype  time
4777 -------------------------------------------------------------------------
4778 drop table if exists t1 ;
4779 drop table if exists t2 ;
4780 drop table if exists t3 ;
4781 drop table if exists t4 ;
4782 drop table if exists t5 ;
4783 drop table if exists t6 ;
4784 -------------------------------------------------------------------------
4785 ---  Create tables with hour(col1)
4786 -------------------------------------------------------------------------
4787 create table t1 (col1 time) engine='NDB' 
4788 partition by range(hour(col1)) 
4789 (partition p0 values less than (15),
4790 partition p1 values less than maxvalue);
4791 create table t2 (col1 time) engine='NDB' 
4792 partition by list(hour(col1)) 
4793 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
4794 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
4795 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
4796 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
4797 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
4798 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
4800 create table t3 (col1 time) engine='NDB' 
4801 partition by hash(hour(col1));
4802 create table t4 (colint int, col1 time) engine='NDB' 
4803 partition by range(colint) 
4804 subpartition by hash(hour(col1)) subpartitions 2 
4805 (partition p0 values less than (15),
4806 partition p1 values less than maxvalue);
4807 create table t5 (colint int, col1 time) engine='NDB' 
4808 partition by list(colint) 
4809 subpartition by hash(hour(col1)) subpartitions 2 
4810 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15),
4811 partition p1 values in (16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
4812 partition p2 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45),
4813 partition p3 values in (46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
4815 create table t6 (colint int, col1 time) engine='NDB' 
4816 partition by range(colint) 
4817 (partition p0 values less than (hour('18:30')),
4818 partition p1 values less than maxvalue);
4819 -------------------------------------------------------------------------
4820 ---  Access tables with hour(col1) 
4821 -------------------------------------------------------------------------
4822 insert into t1 values ('09:09');
4823 insert into t1 values ('14:30');
4824 insert into t2 values ('09:09');
4825 insert into t2 values ('14:30');
4826 insert into t2 values ('21:59');
4827 insert into t3 values ('09:09');
4828 insert into t3 values ('14:30');
4829 insert into t3 values ('21:59');
4830 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t4;
4831 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t5;
4832 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t6;
4833 select hour(col1) from t1 order by col1;
4834 hour(col1)
4837 select * from t1 order by col1;
4838 col1
4839 09:09:00
4840 14:30:00
4841 select * from t2 order by col1;
4842 col1
4843 09:09:00
4844 14:30:00
4845 21:59:00
4846 select * from t3 order by col1;
4847 col1
4848 09:09:00
4849 14:30:00
4850 21:59:00
4851 select * from t4 order by colint;
4852 colint  col1
4853 1       09:09:15
4854 2       04:30:01
4855 3       00:59:22
4856 4       05:30:34
4857 select * from t5 order by colint;
4858 colint  col1
4859 1       09:09:15
4860 2       04:30:01
4861 3       00:59:22
4862 4       05:30:34
4863 select * from t6 order by colint;
4864 colint  col1
4865 1       09:09:15
4866 2       04:30:01
4867 3       00:59:22
4868 4       05:30:34
4869 update t1 set col1='10:30' where col1='09:09';
4870 update t2 set col1='10:30' where col1='09:09';
4871 update t3 set col1='10:30' where col1='09:09';
4872 update t4 set col1='10:30' where col1='09:09';
4873 update t5 set col1='10:30' where col1='09:09';
4874 update t6 set col1='10:30' where col1='09:09';
4875 select * from t1 order by col1;
4876 col1
4877 10:30:00
4878 14:30:00
4879 select * from t2 order by col1;
4880 col1
4881 10:30:00
4882 14:30:00
4883 21:59:00
4884 select * from t3 order by col1;
4885 col1
4886 10:30:00
4887 14:30:00
4888 21:59:00
4889 select * from t4 order by colint;
4890 colint  col1
4891 1       09:09:15
4892 2       04:30:01
4893 3       00:59:22
4894 4       05:30:34
4895 select * from t5 order by colint;
4896 colint  col1
4897 1       09:09:15
4898 2       04:30:01
4899 3       00:59:22
4900 4       05:30:34
4901 select * from t6 order by colint;
4902 colint  col1
4903 1       09:09:15
4904 2       04:30:01
4905 3       00:59:22
4906 4       05:30:34
4907 -------------------------------------------------------------------------
4908 ---  Alter tables with hour(col1)
4909 -------------------------------------------------------------------------
4910 drop table if exists t11 ;
4911 drop table if exists t22 ;
4912 drop table if exists t33 ;
4913 drop table if exists t44 ;
4914 drop table if exists t55 ;
4915 drop table if exists t66 ;
4916 create table t11 engine='NDB' as select * from t1;
4917 create table t22 engine='NDB' as select * from t2;
4918 create table t33 engine='NDB' as select * from t3;
4919 create table t44 engine='NDB' as select * from t4;
4920 create table t55 engine='NDB' as select * from t5;
4921 create table t66 engine='NDB' as select * from t6;
4922 alter table t11
4923 partition by range(hour(col1)) 
4924 (partition p0 values less than (15),
4925 partition p1 values less than maxvalue);
4926 alter table t22
4927 partition by list(hour(col1)) 
4928 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
4929 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
4930 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
4931 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
4932 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
4933 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
4935 alter table t33
4936 partition by hash(hour(col1));
4937 alter table t44
4938 partition by range(colint) 
4939 subpartition by hash(hour(col1)) subpartitions 2 
4940 (partition p0 values less than (15),
4941 partition p1 values less than maxvalue);
4942 alter table t55
4943 partition by list(colint) 
4944 subpartition by hash(hour(col1)) subpartitions 2 
4945 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15),
4946 partition p1 values in (16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
4947 partition p2 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45),
4948 partition p3 values in (46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
4950 alter table t66
4951 partition by range(colint) 
4952 (partition p0 values less than (hour('18:30')),
4953 partition p1 values less than maxvalue);
4954 select * from t11 order by col1;
4955 col1
4956 10:30:00
4957 14:30:00
4958 select * from t22 order by col1;
4959 col1
4960 10:30:00
4961 14:30:00
4962 21:59:00
4963 select * from t33 order by col1;
4964 col1
4965 10:30:00
4966 14:30:00
4967 21:59:00
4968 select * from t44 order by colint;
4969 colint  col1
4970 1       09:09:15
4971 2       04:30:01
4972 3       00:59:22
4973 4       05:30:34
4974 select * from t55 order by colint;
4975 colint  col1
4976 1       09:09:15
4977 2       04:30:01
4978 3       00:59:22
4979 4       05:30:34
4980 select * from t66 order by colint;
4981 colint  col1
4982 1       09:09:15
4983 2       04:30:01
4984 3       00:59:22
4985 4       05:30:34
4986 ---------------------------
4987 ---- some alter table begin
4988 ---------------------------
4989 alter table t55
4990 partition by list(colint) 
4991 subpartition by hash(hour(col1)) subpartitions 4 
4992 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
4993 partition p1 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
4995 show create table t55;
4996 Table   Create Table
4997 t55     CREATE TABLE `t55` (
4998   `colint` int(11) DEFAULT NULL,
4999   `col1` time DEFAULT NULL
5000 ) ENGINE=ndbcluster DEFAULT CHARSET=latin1
5001 /*!50100 PARTITION BY LIST (colint)
5002 SUBPARTITION BY HASH (hour(col1))
5003 SUBPARTITIONS 4
5004 (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30) ENGINE = ndbcluster,
5005  PARTITION p1 VALUES IN (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60) ENGINE = ndbcluster) */
5006 select * from t55 order by colint;
5007 colint  col1
5008 1       09:09:15
5009 2       04:30:01
5010 3       00:59:22
5011 4       05:30:34
5012 -------------------------------------------------------------------------
5013 ---  Delete rows and partitions of tables with hour(col1)
5014 -------------------------------------------------------------------------
5015 delete from t1 where col1='14:30';
5016 delete from t2 where col1='14:30';
5017 delete from t3 where col1='14:30';
5018 delete from t4 where col1='14:30';
5019 delete from t5 where col1='14:30';
5020 delete from t6 where col1='14:30';
5021 select * from t1 order by col1;
5022 col1
5023 10:30:00
5024 select * from t2 order by col1;
5025 col1
5026 10:30:00
5027 21:59:00
5028 select * from t3 order by col1;
5029 col1
5030 10:30:00
5031 21:59:00
5032 select * from t4 order by colint;
5033 colint  col1
5034 1       09:09:15
5035 2       04:30:01
5036 3       00:59:22
5037 4       05:30:34
5038 select * from t5 order by colint;
5039 colint  col1
5040 1       09:09:15
5041 2       04:30:01
5042 3       00:59:22
5043 4       05:30:34
5044 insert into t1 values ('14:30');
5045 insert into t2 values ('14:30');
5046 insert into t3 values ('14:30');
5047 insert into t4 values (60,'14:30');
5048 insert into t5 values (60,'14:30');
5049 insert into t6 values (60,'14:30');
5050 select * from t1 order by col1;
5051 col1
5052 10:30:00
5053 14:30:00
5054 select * from t2 order by col1;
5055 col1
5056 10:30:00
5057 14:30:00
5058 21:59:00
5059 select * from t3 order by col1;
5060 col1
5061 10:30:00
5062 14:30:00
5063 21:59:00
5064 select * from t4 order by colint;
5065 colint  col1
5066 1       09:09:15
5067 2       04:30:01
5068 3       00:59:22
5069 4       05:30:34
5070 60      14:30:00
5071 select * from t5 order by colint;
5072 colint  col1
5073 1       09:09:15
5074 2       04:30:01
5075 3       00:59:22
5076 4       05:30:34
5077 60      14:30:00
5078 select * from t6 order by colint;
5079 colint  col1
5080 1       09:09:15
5081 2       04:30:01
5082 3       00:59:22
5083 4       05:30:34
5084 60      14:30:00
5085 -------------------------------------------------------------------------
5086 ---  Delete rows and partitions of tables with hour(col1)
5087 -------------------------------------------------------------------------
5088 delete from t11 where col1='14:30';
5089 delete from t22 where col1='14:30';
5090 delete from t33 where col1='14:30';
5091 delete from t44 where col1='14:30';
5092 delete from t55 where col1='14:30';
5093 delete from t66 where col1='14:30';
5094 select * from t11 order by col1;
5095 col1
5096 10:30:00
5097 select * from t22 order by col1;
5098 col1
5099 10:30:00
5100 21:59:00
5101 select * from t33 order by col1;
5102 col1
5103 10:30:00
5104 21:59:00
5105 select * from t44 order by colint;
5106 colint  col1
5107 1       09:09:15
5108 2       04:30:01
5109 3       00:59:22
5110 4       05:30:34
5111 select * from t55 order by colint;
5112 colint  col1
5113 1       09:09:15
5114 2       04:30:01
5115 3       00:59:22
5116 4       05:30:34
5117 insert into t11 values ('14:30');
5118 insert into t22 values ('14:30');
5119 insert into t33 values ('14:30');
5120 insert into t44 values (60,'14:30');
5121 insert into t55 values (60,'14:30');
5122 insert into t66 values (60,'14:30');
5123 select * from t11 order by col1;
5124 col1
5125 10:30:00
5126 14:30:00
5127 select * from t22 order by col1;
5128 col1
5129 10:30:00
5130 14:30:00
5131 21:59:00
5132 select * from t33 order by col1;
5133 col1
5134 10:30:00
5135 14:30:00
5136 21:59:00
5137 select * from t44 order by colint;
5138 colint  col1
5139 1       09:09:15
5140 2       04:30:01
5141 3       00:59:22
5142 4       05:30:34
5143 60      14:30:00
5144 select * from t55 order by colint;
5145 colint  col1
5146 1       09:09:15
5147 2       04:30:01
5148 3       00:59:22
5149 4       05:30:34
5150 60      14:30:00
5151 select * from t66 order by colint;
5152 colint  col1
5153 1       09:09:15
5154 2       04:30:01
5155 3       00:59:22
5156 4       05:30:34
5157 60      14:30:00
5158 -------------------------
5159 ---- some alter table end
5160 -------------------------
5161 drop table if exists t1 ;
5162 drop table if exists t2 ;
5163 drop table if exists t3 ;
5164 drop table if exists t4 ;
5165 drop table if exists t5 ;
5166 drop table if exists t6 ;
5167 drop table if exists t11 ;
5168 drop table if exists t22 ;
5169 drop table if exists t33 ;
5170 drop table if exists t44 ;
5171 drop table if exists t55 ;
5172 drop table if exists t66 ;
5173 -------------------------------------------------------------------------
5174 ---  microsecond(col1)  in partition with coltype  time
5175 -------------------------------------------------------------------------
5176 drop table if exists t1 ;
5177 drop table if exists t2 ;
5178 drop table if exists t3 ;
5179 drop table if exists t4 ;
5180 drop table if exists t5 ;
5181 drop table if exists t6 ;
5182 -------------------------------------------------------------------------
5183 ---  Create tables with microsecond(col1)
5184 -------------------------------------------------------------------------
5185 create table t1 (col1 time) engine='NDB' 
5186 partition by range(microsecond(col1)) 
5187 (partition p0 values less than (15),
5188 partition p1 values less than maxvalue);
5189 create table t2 (col1 time) engine='NDB' 
5190 partition by list(microsecond(col1)) 
5191 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
5192 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
5193 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
5194 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
5195 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
5196 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
5198 create table t3 (col1 time) engine='NDB' 
5199 partition by hash(microsecond(col1));
5200 create table t4 (colint int, col1 time) engine='NDB' 
5201 partition by range(colint) 
5202 subpartition by hash(microsecond(col1)) subpartitions 2 
5203 (partition p0 values less than (15),
5204 partition p1 values less than maxvalue);
5205 create table t5 (colint int, col1 time) engine='NDB' 
5206 partition by list(colint) 
5207 subpartition by hash(microsecond(col1)) subpartitions 2 
5208 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15),
5209 partition p1 values in (16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
5210 partition p2 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45),
5211 partition p3 values in (46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
5213 create table t6 (colint int, col1 time) engine='NDB' 
5214 partition by range(colint) 
5215 (partition p0 values less than (microsecond('10:30:10.000010')),
5216 partition p1 values less than maxvalue);
5217 -------------------------------------------------------------------------
5218 ---  Access tables with microsecond(col1) 
5219 -------------------------------------------------------------------------
5220 insert into t1 values ('09:09:15.000002');
5221 insert into t1 values ('04:30:01.000018');
5222 insert into t2 values ('09:09:15.000002');
5223 insert into t2 values ('04:30:01.000018');
5224 insert into t2 values ('00:59:22.000024');
5225 insert into t3 values ('09:09:15.000002');
5226 insert into t3 values ('04:30:01.000018');
5227 insert into t3 values ('00:59:22.000024');
5228 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t4;
5229 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t5;
5230 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t6;
5231 select microsecond(col1) from t1 order by col1;
5232 microsecond(col1)
5235 select * from t1 order by col1;
5236 col1
5237 04:30:01
5238 09:09:15
5239 select * from t2 order by col1;
5240 col1
5241 00:59:22
5242 04:30:01
5243 09:09:15
5244 select * from t3 order by col1;
5245 col1
5246 00:59:22
5247 04:30:01
5248 09:09:15
5249 select * from t4 order by colint;
5250 colint  col1
5251 1       09:09:15
5252 2       04:30:01
5253 3       00:59:22
5254 4       05:30:34
5255 select * from t5 order by colint;
5256 colint  col1
5257 1       09:09:15
5258 2       04:30:01
5259 3       00:59:22
5260 4       05:30:34
5261 select * from t6 order by colint;
5262 colint  col1
5263 1       09:09:15
5264 2       04:30:01
5265 3       00:59:22
5266 4       05:30:34
5267 update t1 set col1='05:30:34.000037' where col1='09:09:15.000002';
5268 update t2 set col1='05:30:34.000037' where col1='09:09:15.000002';
5269 update t3 set col1='05:30:34.000037' where col1='09:09:15.000002';
5270 update t4 set col1='05:30:34.000037' where col1='09:09:15.000002';
5271 update t5 set col1='05:30:34.000037' where col1='09:09:15.000002';
5272 update t6 set col1='05:30:34.000037' where col1='09:09:15.000002';
5273 select * from t1 order by col1;
5274 col1
5275 04:30:01
5276 05:30:34
5277 select * from t2 order by col1;
5278 col1
5279 00:59:22
5280 04:30:01
5281 05:30:34
5282 select * from t3 order by col1;
5283 col1
5284 00:59:22
5285 04:30:01
5286 05:30:34
5287 select * from t4 order by colint;
5288 colint  col1
5289 1       05:30:34
5290 2       04:30:01
5291 3       00:59:22
5292 4       05:30:34
5293 select * from t5 order by colint;
5294 colint  col1
5295 1       05:30:34
5296 2       04:30:01
5297 3       00:59:22
5298 4       05:30:34
5299 select * from t6 order by colint;
5300 colint  col1
5301 1       05:30:34
5302 2       04:30:01
5303 3       00:59:22
5304 4       05:30:34
5305 -------------------------------------------------------------------------
5306 ---  Alter tables with microsecond(col1)
5307 -------------------------------------------------------------------------
5308 drop table if exists t11 ;
5309 drop table if exists t22 ;
5310 drop table if exists t33 ;
5311 drop table if exists t44 ;
5312 drop table if exists t55 ;
5313 drop table if exists t66 ;
5314 create table t11 engine='NDB' as select * from t1;
5315 create table t22 engine='NDB' as select * from t2;
5316 create table t33 engine='NDB' as select * from t3;
5317 create table t44 engine='NDB' as select * from t4;
5318 create table t55 engine='NDB' as select * from t5;
5319 create table t66 engine='NDB' as select * from t6;
5320 alter table t11
5321 partition by range(microsecond(col1)) 
5322 (partition p0 values less than (15),
5323 partition p1 values less than maxvalue);
5324 alter table t22
5325 partition by list(microsecond(col1)) 
5326 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
5327 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
5328 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
5329 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
5330 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
5331 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
5333 alter table t33
5334 partition by hash(microsecond(col1));
5335 alter table t44
5336 partition by range(colint) 
5337 subpartition by hash(microsecond(col1)) subpartitions 2 
5338 (partition p0 values less than (15),
5339 partition p1 values less than maxvalue);
5340 alter table t55
5341 partition by list(colint) 
5342 subpartition by hash(microsecond(col1)) subpartitions 2 
5343 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15),
5344 partition p1 values in (16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
5345 partition p2 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45),
5346 partition p3 values in (46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
5348 alter table t66
5349 partition by range(colint) 
5350 (partition p0 values less than (microsecond('10:30:10.000010')),
5351 partition p1 values less than maxvalue);
5352 select * from t11 order by col1;
5353 col1
5354 04:30:01
5355 05:30:34
5356 select * from t22 order by col1;
5357 col1
5358 00:59:22
5359 04:30:01
5360 05:30:34
5361 select * from t33 order by col1;
5362 col1
5363 00:59:22
5364 04:30:01
5365 05:30:34
5366 select * from t44 order by colint;
5367 colint  col1
5368 1       05:30:34
5369 2       04:30:01
5370 3       00:59:22
5371 4       05:30:34
5372 select * from t55 order by colint;
5373 colint  col1
5374 1       05:30:34
5375 2       04:30:01
5376 3       00:59:22
5377 4       05:30:34
5378 select * from t66 order by colint;
5379 colint  col1
5380 1       05:30:34
5381 2       04:30:01
5382 3       00:59:22
5383 4       05:30:34
5384 ---------------------------
5385 ---- some alter table begin
5386 ---------------------------
5387 alter table t55
5388 partition by list(colint) 
5389 subpartition by hash(microsecond(col1)) subpartitions 4 
5390 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
5391 partition p1 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
5393 show create table t55;
5394 Table   Create Table
5395 t55     CREATE TABLE `t55` (
5396   `colint` int(11) DEFAULT NULL,
5397   `col1` time DEFAULT NULL
5398 ) ENGINE=ndbcluster DEFAULT CHARSET=latin1
5399 /*!50100 PARTITION BY LIST (colint)
5400 SUBPARTITION BY HASH (microsecond(col1))
5401 SUBPARTITIONS 4
5402 (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30) ENGINE = ndbcluster,
5403  PARTITION p1 VALUES IN (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60) ENGINE = ndbcluster) */
5404 select * from t55 order by colint;
5405 colint  col1
5406 1       05:30:34
5407 2       04:30:01
5408 3       00:59:22
5409 4       05:30:34
5410 -------------------------------------------------------------------------
5411 ---  Delete rows and partitions of tables with microsecond(col1)
5412 -------------------------------------------------------------------------
5413 delete from t1 where col1='04:30:01.000018';
5414 delete from t2 where col1='04:30:01.000018';
5415 delete from t3 where col1='04:30:01.000018';
5416 delete from t4 where col1='04:30:01.000018';
5417 delete from t5 where col1='04:30:01.000018';
5418 delete from t6 where col1='04:30:01.000018';
5419 select * from t1 order by col1;
5420 col1
5421 05:30:34
5422 select * from t2 order by col1;
5423 col1
5424 00:59:22
5425 05:30:34
5426 select * from t3 order by col1;
5427 col1
5428 00:59:22
5429 05:30:34
5430 select * from t4 order by colint;
5431 colint  col1
5432 1       05:30:34
5433 3       00:59:22
5434 4       05:30:34
5435 select * from t5 order by colint;
5436 colint  col1
5437 1       05:30:34
5438 3       00:59:22
5439 4       05:30:34
5440 insert into t1 values ('04:30:01.000018');
5441 insert into t2 values ('04:30:01.000018');
5442 insert into t3 values ('04:30:01.000018');
5443 insert into t4 values (60,'04:30:01.000018');
5444 insert into t5 values (60,'04:30:01.000018');
5445 insert into t6 values (60,'04:30:01.000018');
5446 select * from t1 order by col1;
5447 col1
5448 04:30:01
5449 05:30:34
5450 select * from t2 order by col1;
5451 col1
5452 00:59:22
5453 04:30:01
5454 05:30:34
5455 select * from t3 order by col1;
5456 col1
5457 00:59:22
5458 04:30:01
5459 05:30:34
5460 select * from t4 order by colint;
5461 colint  col1
5462 1       05:30:34
5463 3       00:59:22
5464 4       05:30:34
5465 60      04:30:01
5466 select * from t5 order by colint;
5467 colint  col1
5468 1       05:30:34
5469 3       00:59:22
5470 4       05:30:34
5471 60      04:30:01
5472 select * from t6 order by colint;
5473 colint  col1
5474 1       05:30:34
5475 3       00:59:22
5476 4       05:30:34
5477 60      04:30:01
5478 -------------------------------------------------------------------------
5479 ---  Delete rows and partitions of tables with microsecond(col1)
5480 -------------------------------------------------------------------------
5481 delete from t11 where col1='04:30:01.000018';
5482 delete from t22 where col1='04:30:01.000018';
5483 delete from t33 where col1='04:30:01.000018';
5484 delete from t44 where col1='04:30:01.000018';
5485 delete from t55 where col1='04:30:01.000018';
5486 delete from t66 where col1='04:30:01.000018';
5487 select * from t11 order by col1;
5488 col1
5489 05:30:34
5490 select * from t22 order by col1;
5491 col1
5492 00:59:22
5493 05:30:34
5494 select * from t33 order by col1;
5495 col1
5496 00:59:22
5497 05:30:34
5498 select * from t44 order by colint;
5499 colint  col1
5500 1       05:30:34
5501 3       00:59:22
5502 4       05:30:34
5503 select * from t55 order by colint;
5504 colint  col1
5505 1       05:30:34
5506 3       00:59:22
5507 4       05:30:34
5508 insert into t11 values ('04:30:01.000018');
5509 insert into t22 values ('04:30:01.000018');
5510 insert into t33 values ('04:30:01.000018');
5511 insert into t44 values (60,'04:30:01.000018');
5512 insert into t55 values (60,'04:30:01.000018');
5513 insert into t66 values (60,'04:30:01.000018');
5514 select * from t11 order by col1;
5515 col1
5516 04:30:01
5517 05:30:34
5518 select * from t22 order by col1;
5519 col1
5520 00:59:22
5521 04:30:01
5522 05:30:34
5523 select * from t33 order by col1;
5524 col1
5525 00:59:22
5526 04:30:01
5527 05:30:34
5528 select * from t44 order by colint;
5529 colint  col1
5530 1       05:30:34
5531 3       00:59:22
5532 4       05:30:34
5533 60      04:30:01
5534 select * from t55 order by colint;
5535 colint  col1
5536 1       05:30:34
5537 3       00:59:22
5538 4       05:30:34
5539 60      04:30:01
5540 select * from t66 order by colint;
5541 colint  col1
5542 1       05:30:34
5543 3       00:59:22
5544 4       05:30:34
5545 60      04:30:01
5546 -------------------------
5547 ---- some alter table end
5548 -------------------------
5549 drop table if exists t1 ;
5550 drop table if exists t2 ;
5551 drop table if exists t3 ;
5552 drop table if exists t4 ;
5553 drop table if exists t5 ;
5554 drop table if exists t6 ;
5555 drop table if exists t11 ;
5556 drop table if exists t22 ;
5557 drop table if exists t33 ;
5558 drop table if exists t44 ;
5559 drop table if exists t55 ;
5560 drop table if exists t66 ;
5561 -------------------------------------------------------------------------
5562 ---  minute(col1)  in partition with coltype  time
5563 -------------------------------------------------------------------------
5564 drop table if exists t1 ;
5565 drop table if exists t2 ;
5566 drop table if exists t3 ;
5567 drop table if exists t4 ;
5568 drop table if exists t5 ;
5569 drop table if exists t6 ;
5570 -------------------------------------------------------------------------
5571 ---  Create tables with minute(col1)
5572 -------------------------------------------------------------------------
5573 create table t1 (col1 time) engine='NDB' 
5574 partition by range(minute(col1)) 
5575 (partition p0 values less than (15),
5576 partition p1 values less than maxvalue);
5577 create table t2 (col1 time) engine='NDB' 
5578 partition by list(minute(col1)) 
5579 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
5580 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
5581 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
5582 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
5583 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
5584 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
5586 create table t3 (col1 time) engine='NDB' 
5587 partition by hash(minute(col1));
5588 create table t4 (colint int, col1 time) engine='NDB' 
5589 partition by range(colint) 
5590 subpartition by hash(minute(col1)) subpartitions 2 
5591 (partition p0 values less than (15),
5592 partition p1 values less than maxvalue);
5593 create table t5 (colint int, col1 time) engine='NDB' 
5594 partition by list(colint) 
5595 subpartition by hash(minute(col1)) subpartitions 2 
5596 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15),
5597 partition p1 values in (16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
5598 partition p2 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45),
5599 partition p3 values in (46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
5601 create table t6 (colint int, col1 time) engine='NDB' 
5602 partition by range(colint) 
5603 (partition p0 values less than (minute('18:30')),
5604 partition p1 values less than maxvalue);
5605 -------------------------------------------------------------------------
5606 ---  Access tables with minute(col1) 
5607 -------------------------------------------------------------------------
5608 insert into t1 values ('09:09:15');
5609 insert into t1 values ('14:30:45');
5610 insert into t2 values ('09:09:15');
5611 insert into t2 values ('14:30:45');
5612 insert into t2 values ('21:59:22');
5613 insert into t3 values ('09:09:15');
5614 insert into t3 values ('14:30:45');
5615 insert into t3 values ('21:59:22');
5616 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t4;
5617 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t5;
5618 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t6;
5619 select minute(col1) from t1 order by col1;
5620 minute(col1)
5623 select * from t1 order by col1;
5624 col1
5625 09:09:15
5626 14:30:45
5627 select * from t2 order by col1;
5628 col1
5629 09:09:15
5630 14:30:45
5631 21:59:22
5632 select * from t3 order by col1;
5633 col1
5634 09:09:15
5635 14:30:45
5636 21:59:22
5637 select * from t4 order by colint;
5638 colint  col1
5639 1       09:09:15
5640 2       04:30:01
5641 3       00:59:22
5642 4       05:30:34
5643 select * from t5 order by colint;
5644 colint  col1
5645 1       09:09:15
5646 2       04:30:01
5647 3       00:59:22
5648 4       05:30:34
5649 select * from t6 order by colint;
5650 colint  col1
5651 1       09:09:15
5652 2       04:30:01
5653 3       00:59:22
5654 4       05:30:34
5655 update t1 set col1='10:24:23' where col1='09:09:15';
5656 update t2 set col1='10:24:23' where col1='09:09:15';
5657 update t3 set col1='10:24:23' where col1='09:09:15';
5658 update t4 set col1='10:24:23' where col1='09:09:15';
5659 update t5 set col1='10:24:23' where col1='09:09:15';
5660 update t6 set col1='10:24:23' where col1='09:09:15';
5661 select * from t1 order by col1;
5662 col1
5663 10:24:23
5664 14:30:45
5665 select * from t2 order by col1;
5666 col1
5667 10:24:23
5668 14:30:45
5669 21:59:22
5670 select * from t3 order by col1;
5671 col1
5672 10:24:23
5673 14:30:45
5674 21:59:22
5675 select * from t4 order by colint;
5676 colint  col1
5677 1       10:24:23
5678 2       04:30:01
5679 3       00:59:22
5680 4       05:30:34
5681 select * from t5 order by colint;
5682 colint  col1
5683 1       10:24:23
5684 2       04:30:01
5685 3       00:59:22
5686 4       05:30:34
5687 select * from t6 order by colint;
5688 colint  col1
5689 1       10:24:23
5690 2       04:30:01
5691 3       00:59:22
5692 4       05:30:34
5693 -------------------------------------------------------------------------
5694 ---  Alter tables with minute(col1)
5695 -------------------------------------------------------------------------
5696 drop table if exists t11 ;
5697 drop table if exists t22 ;
5698 drop table if exists t33 ;
5699 drop table if exists t44 ;
5700 drop table if exists t55 ;
5701 drop table if exists t66 ;
5702 create table t11 engine='NDB' as select * from t1;
5703 create table t22 engine='NDB' as select * from t2;
5704 create table t33 engine='NDB' as select * from t3;
5705 create table t44 engine='NDB' as select * from t4;
5706 create table t55 engine='NDB' as select * from t5;
5707 create table t66 engine='NDB' as select * from t6;
5708 alter table t11
5709 partition by range(minute(col1)) 
5710 (partition p0 values less than (15),
5711 partition p1 values less than maxvalue);
5712 alter table t22
5713 partition by list(minute(col1)) 
5714 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
5715 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
5716 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
5717 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
5718 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
5719 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
5721 alter table t33
5722 partition by hash(minute(col1));
5723 alter table t44
5724 partition by range(colint) 
5725 subpartition by hash(minute(col1)) subpartitions 2 
5726 (partition p0 values less than (15),
5727 partition p1 values less than maxvalue);
5728 alter table t55
5729 partition by list(colint) 
5730 subpartition by hash(minute(col1)) subpartitions 2 
5731 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15),
5732 partition p1 values in (16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
5733 partition p2 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45),
5734 partition p3 values in (46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
5736 alter table t66
5737 partition by range(colint) 
5738 (partition p0 values less than (minute('18:30')),
5739 partition p1 values less than maxvalue);
5740 select * from t11 order by col1;
5741 col1
5742 10:24:23
5743 14:30:45
5744 select * from t22 order by col1;
5745 col1
5746 10:24:23
5747 14:30:45
5748 21:59:22
5749 select * from t33 order by col1;
5750 col1
5751 10:24:23
5752 14:30:45
5753 21:59:22
5754 select * from t44 order by colint;
5755 colint  col1
5756 1       10:24:23
5757 2       04:30:01
5758 3       00:59:22
5759 4       05:30:34
5760 select * from t55 order by colint;
5761 colint  col1
5762 1       10:24:23
5763 2       04:30:01
5764 3       00:59:22
5765 4       05:30:34
5766 select * from t66 order by colint;
5767 colint  col1
5768 1       10:24:23
5769 2       04:30:01
5770 3       00:59:22
5771 4       05:30:34
5772 ---------------------------
5773 ---- some alter table begin
5774 ---------------------------
5775 alter table t55
5776 partition by list(colint) 
5777 subpartition by hash(minute(col1)) subpartitions 4 
5778 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
5779 partition p1 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
5781 show create table t55;
5782 Table   Create Table
5783 t55     CREATE TABLE `t55` (
5784   `colint` int(11) DEFAULT NULL,
5785   `col1` time DEFAULT NULL
5786 ) ENGINE=ndbcluster DEFAULT CHARSET=latin1
5787 /*!50100 PARTITION BY LIST (colint)
5788 SUBPARTITION BY HASH (minute(col1))
5789 SUBPARTITIONS 4
5790 (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30) ENGINE = ndbcluster,
5791  PARTITION p1 VALUES IN (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60) ENGINE = ndbcluster) */
5792 select * from t55 order by colint;
5793 colint  col1
5794 1       10:24:23
5795 2       04:30:01
5796 3       00:59:22
5797 4       05:30:34
5798 -------------------------------------------------------------------------
5799 ---  Delete rows and partitions of tables with minute(col1)
5800 -------------------------------------------------------------------------
5801 delete from t1 where col1='14:30:45';
5802 delete from t2 where col1='14:30:45';
5803 delete from t3 where col1='14:30:45';
5804 delete from t4 where col1='14:30:45';
5805 delete from t5 where col1='14:30:45';
5806 delete from t6 where col1='14:30:45';
5807 select * from t1 order by col1;
5808 col1
5809 10:24:23
5810 select * from t2 order by col1;
5811 col1
5812 10:24:23
5813 21:59:22
5814 select * from t3 order by col1;
5815 col1
5816 10:24:23
5817 21:59:22
5818 select * from t4 order by colint;
5819 colint  col1
5820 1       10:24:23
5821 2       04:30:01
5822 3       00:59:22
5823 4       05:30:34
5824 select * from t5 order by colint;
5825 colint  col1
5826 1       10:24:23
5827 2       04:30:01
5828 3       00:59:22
5829 4       05:30:34
5830 insert into t1 values ('14:30:45');
5831 insert into t2 values ('14:30:45');
5832 insert into t3 values ('14:30:45');
5833 insert into t4 values (60,'14:30:45');
5834 insert into t5 values (60,'14:30:45');
5835 insert into t6 values (60,'14:30:45');
5836 select * from t1 order by col1;
5837 col1
5838 10:24:23
5839 14:30:45
5840 select * from t2 order by col1;
5841 col1
5842 10:24:23
5843 14:30:45
5844 21:59:22
5845 select * from t3 order by col1;
5846 col1
5847 10:24:23
5848 14:30:45
5849 21:59:22
5850 select * from t4 order by colint;
5851 colint  col1
5852 1       10:24:23
5853 2       04:30:01
5854 3       00:59:22
5855 4       05:30:34
5856 60      14:30:45
5857 select * from t5 order by colint;
5858 colint  col1
5859 1       10:24:23
5860 2       04:30:01
5861 3       00:59:22
5862 4       05:30:34
5863 60      14:30:45
5864 select * from t6 order by colint;
5865 colint  col1
5866 1       10:24:23
5867 2       04:30:01
5868 3       00:59:22
5869 4       05:30:34
5870 60      14:30:45
5871 -------------------------------------------------------------------------
5872 ---  Delete rows and partitions of tables with minute(col1)
5873 -------------------------------------------------------------------------
5874 delete from t11 where col1='14:30:45';
5875 delete from t22 where col1='14:30:45';
5876 delete from t33 where col1='14:30:45';
5877 delete from t44 where col1='14:30:45';
5878 delete from t55 where col1='14:30:45';
5879 delete from t66 where col1='14:30:45';
5880 select * from t11 order by col1;
5881 col1
5882 10:24:23
5883 select * from t22 order by col1;
5884 col1
5885 10:24:23
5886 21:59:22
5887 select * from t33 order by col1;
5888 col1
5889 10:24:23
5890 21:59:22
5891 select * from t44 order by colint;
5892 colint  col1
5893 1       10:24:23
5894 2       04:30:01
5895 3       00:59:22
5896 4       05:30:34
5897 select * from t55 order by colint;
5898 colint  col1
5899 1       10:24:23
5900 2       04:30:01
5901 3       00:59:22
5902 4       05:30:34
5903 insert into t11 values ('14:30:45');
5904 insert into t22 values ('14:30:45');
5905 insert into t33 values ('14:30:45');
5906 insert into t44 values (60,'14:30:45');
5907 insert into t55 values (60,'14:30:45');
5908 insert into t66 values (60,'14:30:45');
5909 select * from t11 order by col1;
5910 col1
5911 10:24:23
5912 14:30:45
5913 select * from t22 order by col1;
5914 col1
5915 10:24:23
5916 14:30:45
5917 21:59:22
5918 select * from t33 order by col1;
5919 col1
5920 10:24:23
5921 14:30:45
5922 21:59:22
5923 select * from t44 order by colint;
5924 colint  col1
5925 1       10:24:23
5926 2       04:30:01
5927 3       00:59:22
5928 4       05:30:34
5929 60      14:30:45
5930 select * from t55 order by colint;
5931 colint  col1
5932 1       10:24:23
5933 2       04:30:01
5934 3       00:59:22
5935 4       05:30:34
5936 60      14:30:45
5937 select * from t66 order by colint;
5938 colint  col1
5939 1       10:24:23
5940 2       04:30:01
5941 3       00:59:22
5942 4       05:30:34
5943 60      14:30:45
5944 -------------------------
5945 ---- some alter table end
5946 -------------------------
5947 drop table if exists t1 ;
5948 drop table if exists t2 ;
5949 drop table if exists t3 ;
5950 drop table if exists t4 ;
5951 drop table if exists t5 ;
5952 drop table if exists t6 ;
5953 drop table if exists t11 ;
5954 drop table if exists t22 ;
5955 drop table if exists t33 ;
5956 drop table if exists t44 ;
5957 drop table if exists t55 ;
5958 drop table if exists t66 ;
5959 -------------------------------------------------------------------------
5960 ---  second(col1)  in partition with coltype  time
5961 -------------------------------------------------------------------------
5962 drop table if exists t1 ;
5963 drop table if exists t2 ;
5964 drop table if exists t3 ;
5965 drop table if exists t4 ;
5966 drop table if exists t5 ;
5967 drop table if exists t6 ;
5968 -------------------------------------------------------------------------
5969 ---  Create tables with second(col1)
5970 -------------------------------------------------------------------------
5971 create table t1 (col1 time) engine='NDB' 
5972 partition by range(second(col1)) 
5973 (partition p0 values less than (15),
5974 partition p1 values less than maxvalue);
5975 create table t2 (col1 time) engine='NDB' 
5976 partition by list(second(col1)) 
5977 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
5978 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
5979 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
5980 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
5981 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
5982 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
5984 create table t3 (col1 time) engine='NDB' 
5985 partition by hash(second(col1));
5986 create table t4 (colint int, col1 time) engine='NDB' 
5987 partition by range(colint) 
5988 subpartition by hash(second(col1)) subpartitions 2 
5989 (partition p0 values less than (15),
5990 partition p1 values less than maxvalue);
5991 create table t5 (colint int, col1 time) engine='NDB' 
5992 partition by list(colint) 
5993 subpartition by hash(second(col1)) subpartitions 2 
5994 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15),
5995 partition p1 values in (16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
5996 partition p2 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45),
5997 partition p3 values in (46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
5999 create table t6 (colint int, col1 time) engine='NDB' 
6000 partition by range(colint) 
6001 (partition p0 values less than (second('18:30:14')),
6002 partition p1 values less than maxvalue);
6003 -------------------------------------------------------------------------
6004 ---  Access tables with second(col1) 
6005 -------------------------------------------------------------------------
6006 insert into t1 values ('09:09:09');
6007 insert into t1 values ('14:30:20');
6008 insert into t2 values ('09:09:09');
6009 insert into t2 values ('14:30:20');
6010 insert into t2 values ('21:59:22');
6011 insert into t3 values ('09:09:09');
6012 insert into t3 values ('14:30:20');
6013 insert into t3 values ('21:59:22');
6014 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t4;
6015 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t5;
6016 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t6;
6017 select second(col1) from t1 order by col1;
6018 second(col1)
6021 select * from t1 order by col1;
6022 col1
6023 09:09:09
6024 14:30:20
6025 select * from t2 order by col1;
6026 col1
6027 09:09:09
6028 14:30:20
6029 21:59:22
6030 select * from t3 order by col1;
6031 col1
6032 09:09:09
6033 14:30:20
6034 21:59:22
6035 select * from t4 order by colint;
6036 colint  col1
6037 1       09:09:15
6038 2       04:30:01
6039 3       00:59:22
6040 4       05:30:34
6041 select * from t5 order by colint;
6042 colint  col1
6043 1       09:09:15
6044 2       04:30:01
6045 3       00:59:22
6046 4       05:30:34
6047 select * from t6 order by colint;
6048 colint  col1
6049 1       09:09:15
6050 2       04:30:01
6051 3       00:59:22
6052 4       05:30:34
6053 update t1 set col1='10:22:33' where col1='09:09:09';
6054 update t2 set col1='10:22:33' where col1='09:09:09';
6055 update t3 set col1='10:22:33' where col1='09:09:09';
6056 update t4 set col1='10:22:33' where col1='09:09:09';
6057 update t5 set col1='10:22:33' where col1='09:09:09';
6058 update t6 set col1='10:22:33' where col1='09:09:09';
6059 select * from t1 order by col1;
6060 col1
6061 10:22:33
6062 14:30:20
6063 select * from t2 order by col1;
6064 col1
6065 10:22:33
6066 14:30:20
6067 21:59:22
6068 select * from t3 order by col1;
6069 col1
6070 10:22:33
6071 14:30:20
6072 21:59:22
6073 select * from t4 order by colint;
6074 colint  col1
6075 1       09:09:15
6076 2       04:30:01
6077 3       00:59:22
6078 4       05:30:34
6079 select * from t5 order by colint;
6080 colint  col1
6081 1       09:09:15
6082 2       04:30:01
6083 3       00:59:22
6084 4       05:30:34
6085 select * from t6 order by colint;
6086 colint  col1
6087 1       09:09:15
6088 2       04:30:01
6089 3       00:59:22
6090 4       05:30:34
6091 -------------------------------------------------------------------------
6092 ---  Alter tables with second(col1)
6093 -------------------------------------------------------------------------
6094 drop table if exists t11 ;
6095 drop table if exists t22 ;
6096 drop table if exists t33 ;
6097 drop table if exists t44 ;
6098 drop table if exists t55 ;
6099 drop table if exists t66 ;
6100 create table t11 engine='NDB' as select * from t1;
6101 create table t22 engine='NDB' as select * from t2;
6102 create table t33 engine='NDB' as select * from t3;
6103 create table t44 engine='NDB' as select * from t4;
6104 create table t55 engine='NDB' as select * from t5;
6105 create table t66 engine='NDB' as select * from t6;
6106 alter table t11
6107 partition by range(second(col1)) 
6108 (partition p0 values less than (15),
6109 partition p1 values less than maxvalue);
6110 alter table t22
6111 partition by list(second(col1)) 
6112 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
6113 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
6114 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
6115 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
6116 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
6117 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
6119 alter table t33
6120 partition by hash(second(col1));
6121 alter table t44
6122 partition by range(colint) 
6123 subpartition by hash(second(col1)) subpartitions 2 
6124 (partition p0 values less than (15),
6125 partition p1 values less than maxvalue);
6126 alter table t55
6127 partition by list(colint) 
6128 subpartition by hash(second(col1)) subpartitions 2 
6129 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15),
6130 partition p1 values in (16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
6131 partition p2 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45),
6132 partition p3 values in (46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
6134 alter table t66
6135 partition by range(colint) 
6136 (partition p0 values less than (second('18:30:14')),
6137 partition p1 values less than maxvalue);
6138 select * from t11 order by col1;
6139 col1
6140 10:22:33
6141 14:30:20
6142 select * from t22 order by col1;
6143 col1
6144 10:22:33
6145 14:30:20
6146 21:59:22
6147 select * from t33 order by col1;
6148 col1
6149 10:22:33
6150 14:30:20
6151 21:59:22
6152 select * from t44 order by colint;
6153 colint  col1
6154 1       09:09:15
6155 2       04:30:01
6156 3       00:59:22
6157 4       05:30:34
6158 select * from t55 order by colint;
6159 colint  col1
6160 1       09:09:15
6161 2       04:30:01
6162 3       00:59:22
6163 4       05:30:34
6164 select * from t66 order by colint;
6165 colint  col1
6166 1       09:09:15
6167 2       04:30:01
6168 3       00:59:22
6169 4       05:30:34
6170 ---------------------------
6171 ---- some alter table begin
6172 ---------------------------
6173 alter table t55
6174 partition by list(colint) 
6175 subpartition by hash(second(col1)) subpartitions 4 
6176 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
6177 partition p1 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
6179 show create table t55;
6180 Table   Create Table
6181 t55     CREATE TABLE `t55` (
6182   `colint` int(11) DEFAULT NULL,
6183   `col1` time DEFAULT NULL
6184 ) ENGINE=ndbcluster DEFAULT CHARSET=latin1
6185 /*!50100 PARTITION BY LIST (colint)
6186 SUBPARTITION BY HASH (second(col1))
6187 SUBPARTITIONS 4
6188 (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30) ENGINE = ndbcluster,
6189  PARTITION p1 VALUES IN (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60) ENGINE = ndbcluster) */
6190 select * from t55 order by colint;
6191 colint  col1
6192 1       09:09:15
6193 2       04:30:01
6194 3       00:59:22
6195 4       05:30:34
6196 -------------------------------------------------------------------------
6197 ---  Delete rows and partitions of tables with second(col1)
6198 -------------------------------------------------------------------------
6199 delete from t1 where col1='14:30:20';
6200 delete from t2 where col1='14:30:20';
6201 delete from t3 where col1='14:30:20';
6202 delete from t4 where col1='14:30:20';
6203 delete from t5 where col1='14:30:20';
6204 delete from t6 where col1='14:30:20';
6205 select * from t1 order by col1;
6206 col1
6207 10:22:33
6208 select * from t2 order by col1;
6209 col1
6210 10:22:33
6211 21:59:22
6212 select * from t3 order by col1;
6213 col1
6214 10:22:33
6215 21:59:22
6216 select * from t4 order by colint;
6217 colint  col1
6218 1       09:09:15
6219 2       04:30:01
6220 3       00:59:22
6221 4       05:30:34
6222 select * from t5 order by colint;
6223 colint  col1
6224 1       09:09:15
6225 2       04:30:01
6226 3       00:59:22
6227 4       05:30:34
6228 insert into t1 values ('14:30:20');
6229 insert into t2 values ('14:30:20');
6230 insert into t3 values ('14:30:20');
6231 insert into t4 values (60,'14:30:20');
6232 insert into t5 values (60,'14:30:20');
6233 insert into t6 values (60,'14:30:20');
6234 select * from t1 order by col1;
6235 col1
6236 10:22:33
6237 14:30:20
6238 select * from t2 order by col1;
6239 col1
6240 10:22:33
6241 14:30:20
6242 21:59:22
6243 select * from t3 order by col1;
6244 col1
6245 10:22:33
6246 14:30:20
6247 21:59:22
6248 select * from t4 order by colint;
6249 colint  col1
6250 1       09:09:15
6251 2       04:30:01
6252 3       00:59:22
6253 4       05:30:34
6254 60      14:30:20
6255 select * from t5 order by colint;
6256 colint  col1
6257 1       09:09:15
6258 2       04:30:01
6259 3       00:59:22
6260 4       05:30:34
6261 60      14:30:20
6262 select * from t6 order by colint;
6263 colint  col1
6264 1       09:09:15
6265 2       04:30:01
6266 3       00:59:22
6267 4       05:30:34
6268 60      14:30:20
6269 -------------------------------------------------------------------------
6270 ---  Delete rows and partitions of tables with second(col1)
6271 -------------------------------------------------------------------------
6272 delete from t11 where col1='14:30:20';
6273 delete from t22 where col1='14:30:20';
6274 delete from t33 where col1='14:30:20';
6275 delete from t44 where col1='14:30:20';
6276 delete from t55 where col1='14:30:20';
6277 delete from t66 where col1='14:30:20';
6278 select * from t11 order by col1;
6279 col1
6280 10:22:33
6281 select * from t22 order by col1;
6282 col1
6283 10:22:33
6284 21:59:22
6285 select * from t33 order by col1;
6286 col1
6287 10:22:33
6288 21:59:22
6289 select * from t44 order by colint;
6290 colint  col1
6291 1       09:09:15
6292 2       04:30:01
6293 3       00:59:22
6294 4       05:30:34
6295 select * from t55 order by colint;
6296 colint  col1
6297 1       09:09:15
6298 2       04:30:01
6299 3       00:59:22
6300 4       05:30:34
6301 insert into t11 values ('14:30:20');
6302 insert into t22 values ('14:30:20');
6303 insert into t33 values ('14:30:20');
6304 insert into t44 values (60,'14:30:20');
6305 insert into t55 values (60,'14:30:20');
6306 insert into t66 values (60,'14:30:20');
6307 select * from t11 order by col1;
6308 col1
6309 10:22:33
6310 14:30:20
6311 select * from t22 order by col1;
6312 col1
6313 10:22:33
6314 14:30:20
6315 21:59:22
6316 select * from t33 order by col1;
6317 col1
6318 10:22:33
6319 14:30:20
6320 21:59:22
6321 select * from t44 order by colint;
6322 colint  col1
6323 1       09:09:15
6324 2       04:30:01
6325 3       00:59:22
6326 4       05:30:34
6327 60      14:30:20
6328 select * from t55 order by colint;
6329 colint  col1
6330 1       09:09:15
6331 2       04:30:01
6332 3       00:59:22
6333 4       05:30:34
6334 60      14:30:20
6335 select * from t66 order by colint;
6336 colint  col1
6337 1       09:09:15
6338 2       04:30:01
6339 3       00:59:22
6340 4       05:30:34
6341 60      14:30:20
6342 -------------------------
6343 ---- some alter table end
6344 -------------------------
6345 drop table if exists t1 ;
6346 drop table if exists t2 ;
6347 drop table if exists t3 ;
6348 drop table if exists t4 ;
6349 drop table if exists t5 ;
6350 drop table if exists t6 ;
6351 drop table if exists t11 ;
6352 drop table if exists t22 ;
6353 drop table if exists t33 ;
6354 drop table if exists t44 ;
6355 drop table if exists t55 ;
6356 drop table if exists t66 ;
6357 -------------------------------------------------------------------------
6358 ---  second(col1)  in partition with coltype  char(30)
6359 -------------------------------------------------------------------------
6360 drop table if exists t1 ;
6361 drop table if exists t2 ;
6362 drop table if exists t3 ;
6363 drop table if exists t4 ;
6364 drop table if exists t5 ;
6365 drop table if exists t6 ;
6366 -------------------------------------------------------------------------
6367 ---  Create tables with second(col1)
6368 -------------------------------------------------------------------------
6369 create table t1 (col1 char(30)) engine='NDB' 
6370 partition by range(second(col1)) 
6371 (partition p0 values less than (15),
6372 partition p1 values less than maxvalue);
6373 create table t2 (col1 char(30)) engine='NDB' 
6374 partition by list(second(col1)) 
6375 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
6376 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
6377 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
6378 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
6379 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
6380 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
6382 create table t3 (col1 char(30)) engine='NDB' 
6383 partition by hash(second(col1));
6384 create table t4 (colint int, col1 char(30)) engine='NDB' 
6385 partition by range(colint) 
6386 subpartition by hash(second(col1)) subpartitions 2 
6387 (partition p0 values less than (15),
6388 partition p1 values less than maxvalue);
6389 create table t5 (colint int, col1 char(30)) engine='NDB' 
6390 partition by list(colint) 
6391 subpartition by hash(second(col1)) subpartitions 2 
6392 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15),
6393 partition p1 values in (16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
6394 partition p2 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45),
6395 partition p3 values in (46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
6397 create table t6 (colint int, col1 char(30)) engine='NDB' 
6398 partition by range(colint) 
6399 (partition p0 values less than (second('18:30:14')),
6400 partition p1 values less than maxvalue);
6401 -------------------------------------------------------------------------
6402 ---  Access tables with second(col1) 
6403 -------------------------------------------------------------------------
6404 insert into t1 values ('09:09:09');
6405 insert into t1 values ('14:30:20');
6406 insert into t2 values ('09:09:09');
6407 insert into t2 values ('14:30:20');
6408 insert into t2 values ('21:59:22');
6409 insert into t3 values ('09:09:09');
6410 insert into t3 values ('14:30:20');
6411 insert into t3 values ('21:59:22');
6412 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t4;
6413 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t5;
6414 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t6;
6415 select second(col1) from t1 order by col1;
6416 second(col1)
6419 select * from t1 order by col1;
6420 col1
6421 09:09:09
6422 14:30:20
6423 select * from t2 order by col1;
6424 col1
6425 09:09:09
6426 14:30:20
6427 21:59:22
6428 select * from t3 order by col1;
6429 col1
6430 09:09:09
6431 14:30:20
6432 21:59:22
6433 select * from t4 order by colint;
6434 colint  col1
6435 1       09:09:15.000002
6436 2       04:30:01.000018
6437 3       00:59:22.000024
6438 4       05:30:34.000037
6439 select * from t5 order by colint;
6440 colint  col1
6441 1       09:09:15.000002
6442 2       04:30:01.000018
6443 3       00:59:22.000024
6444 4       05:30:34.000037
6445 select * from t6 order by colint;
6446 colint  col1
6447 1       09:09:15.000002
6448 2       04:30:01.000018
6449 3       00:59:22.000024
6450 4       05:30:34.000037
6451 update t1 set col1='10:22:33' where col1='09:09:09';
6452 update t2 set col1='10:22:33' where col1='09:09:09';
6453 update t3 set col1='10:22:33' where col1='09:09:09';
6454 update t4 set col1='10:22:33' where col1='09:09:09';
6455 update t5 set col1='10:22:33' where col1='09:09:09';
6456 update t6 set col1='10:22:33' where col1='09:09:09';
6457 select * from t1 order by col1;
6458 col1
6459 10:22:33
6460 14:30:20
6461 select * from t2 order by col1;
6462 col1
6463 10:22:33
6464 14:30:20
6465 21:59:22
6466 select * from t3 order by col1;
6467 col1
6468 10:22:33
6469 14:30:20
6470 21:59:22
6471 select * from t4 order by colint;
6472 colint  col1
6473 1       09:09:15.000002
6474 2       04:30:01.000018
6475 3       00:59:22.000024
6476 4       05:30:34.000037
6477 select * from t5 order by colint;
6478 colint  col1
6479 1       09:09:15.000002
6480 2       04:30:01.000018
6481 3       00:59:22.000024
6482 4       05:30:34.000037
6483 select * from t6 order by colint;
6484 colint  col1
6485 1       09:09:15.000002
6486 2       04:30:01.000018
6487 3       00:59:22.000024
6488 4       05:30:34.000037
6489 -------------------------------------------------------------------------
6490 ---  Alter tables with second(col1)
6491 -------------------------------------------------------------------------
6492 drop table if exists t11 ;
6493 drop table if exists t22 ;
6494 drop table if exists t33 ;
6495 drop table if exists t44 ;
6496 drop table if exists t55 ;
6497 drop table if exists t66 ;
6498 create table t11 engine='NDB' as select * from t1;
6499 create table t22 engine='NDB' as select * from t2;
6500 create table t33 engine='NDB' as select * from t3;
6501 create table t44 engine='NDB' as select * from t4;
6502 create table t55 engine='NDB' as select * from t5;
6503 create table t66 engine='NDB' as select * from t6;
6504 alter table t11
6505 partition by range(second(col1)) 
6506 (partition p0 values less than (15),
6507 partition p1 values less than maxvalue);
6508 alter table t22
6509 partition by list(second(col1)) 
6510 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
6511 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
6512 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
6513 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
6514 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
6515 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
6517 alter table t33
6518 partition by hash(second(col1));
6519 alter table t44
6520 partition by range(colint) 
6521 subpartition by hash(second(col1)) subpartitions 2 
6522 (partition p0 values less than (15),
6523 partition p1 values less than maxvalue);
6524 alter table t55
6525 partition by list(colint) 
6526 subpartition by hash(second(col1)) subpartitions 2 
6527 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15),
6528 partition p1 values in (16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
6529 partition p2 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45),
6530 partition p3 values in (46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
6532 alter table t66
6533 partition by range(colint) 
6534 (partition p0 values less than (second('18:30:14')),
6535 partition p1 values less than maxvalue);
6536 select * from t11 order by col1;
6537 col1
6538 10:22:33
6539 14:30:20
6540 select * from t22 order by col1;
6541 col1
6542 10:22:33
6543 14:30:20
6544 21:59:22
6545 select * from t33 order by col1;
6546 col1
6547 10:22:33
6548 14:30:20
6549 21:59:22
6550 select * from t44 order by colint;
6551 colint  col1
6552 1       09:09:15.000002
6553 2       04:30:01.000018
6554 3       00:59:22.000024
6555 4       05:30:34.000037
6556 select * from t55 order by colint;
6557 colint  col1
6558 1       09:09:15.000002
6559 2       04:30:01.000018
6560 3       00:59:22.000024
6561 4       05:30:34.000037
6562 select * from t66 order by colint;
6563 colint  col1
6564 1       09:09:15.000002
6565 2       04:30:01.000018
6566 3       00:59:22.000024
6567 4       05:30:34.000037
6568 ---------------------------
6569 ---- some alter table begin
6570 ---------------------------
6571 alter table t55
6572 partition by list(colint) 
6573 subpartition by hash(second(col1)) subpartitions 4 
6574 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
6575 partition p1 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
6577 show create table t55;
6578 Table   Create Table
6579 t55     CREATE TABLE `t55` (
6580   `colint` int(11) DEFAULT NULL,
6581   `col1` char(30) DEFAULT NULL
6582 ) ENGINE=ndbcluster DEFAULT CHARSET=latin1
6583 /*!50100 PARTITION BY LIST (colint)
6584 SUBPARTITION BY HASH (second(col1))
6585 SUBPARTITIONS 4
6586 (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30) ENGINE = ndbcluster,
6587  PARTITION p1 VALUES IN (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60) ENGINE = ndbcluster) */
6588 select * from t55 order by colint;
6589 colint  col1
6590 1       09:09:15.000002
6591 2       04:30:01.000018
6592 3       00:59:22.000024
6593 4       05:30:34.000037
6594 -------------------------------------------------------------------------
6595 ---  Delete rows and partitions of tables with second(col1)
6596 -------------------------------------------------------------------------
6597 delete from t1 where col1='14:30:20';
6598 delete from t2 where col1='14:30:20';
6599 delete from t3 where col1='14:30:20';
6600 delete from t4 where col1='14:30:20';
6601 delete from t5 where col1='14:30:20';
6602 delete from t6 where col1='14:30:20';
6603 select * from t1 order by col1;
6604 col1
6605 10:22:33
6606 select * from t2 order by col1;
6607 col1
6608 10:22:33
6609 21:59:22
6610 select * from t3 order by col1;
6611 col1
6612 10:22:33
6613 21:59:22
6614 select * from t4 order by colint;
6615 colint  col1
6616 1       09:09:15.000002
6617 2       04:30:01.000018
6618 3       00:59:22.000024
6619 4       05:30:34.000037
6620 select * from t5 order by colint;
6621 colint  col1
6622 1       09:09:15.000002
6623 2       04:30:01.000018
6624 3       00:59:22.000024
6625 4       05:30:34.000037
6626 insert into t1 values ('14:30:20');
6627 insert into t2 values ('14:30:20');
6628 insert into t3 values ('14:30:20');
6629 insert into t4 values (60,'14:30:20');
6630 insert into t5 values (60,'14:30:20');
6631 insert into t6 values (60,'14:30:20');
6632 select * from t1 order by col1;
6633 col1
6634 10:22:33
6635 14:30:20
6636 select * from t2 order by col1;
6637 col1
6638 10:22:33
6639 14:30:20
6640 21:59:22
6641 select * from t3 order by col1;
6642 col1
6643 10:22:33
6644 14:30:20
6645 21:59:22
6646 select * from t4 order by colint;
6647 colint  col1
6648 1       09:09:15.000002
6649 2       04:30:01.000018
6650 3       00:59:22.000024
6651 4       05:30:34.000037
6652 60      14:30:20
6653 select * from t5 order by colint;
6654 colint  col1
6655 1       09:09:15.000002
6656 2       04:30:01.000018
6657 3       00:59:22.000024
6658 4       05:30:34.000037
6659 60      14:30:20
6660 select * from t6 order by colint;
6661 colint  col1
6662 1       09:09:15.000002
6663 2       04:30:01.000018
6664 3       00:59:22.000024
6665 4       05:30:34.000037
6666 60      14:30:20
6667 -------------------------------------------------------------------------
6668 ---  Delete rows and partitions of tables with second(col1)
6669 -------------------------------------------------------------------------
6670 delete from t11 where col1='14:30:20';
6671 delete from t22 where col1='14:30:20';
6672 delete from t33 where col1='14:30:20';
6673 delete from t44 where col1='14:30:20';
6674 delete from t55 where col1='14:30:20';
6675 delete from t66 where col1='14:30:20';
6676 select * from t11 order by col1;
6677 col1
6678 10:22:33
6679 select * from t22 order by col1;
6680 col1
6681 10:22:33
6682 21:59:22
6683 select * from t33 order by col1;
6684 col1
6685 10:22:33
6686 21:59:22
6687 select * from t44 order by colint;
6688 colint  col1
6689 1       09:09:15.000002
6690 2       04:30:01.000018
6691 3       00:59:22.000024
6692 4       05:30:34.000037
6693 select * from t55 order by colint;
6694 colint  col1
6695 1       09:09:15.000002
6696 2       04:30:01.000018
6697 3       00:59:22.000024
6698 4       05:30:34.000037
6699 insert into t11 values ('14:30:20');
6700 insert into t22 values ('14:30:20');
6701 insert into t33 values ('14:30:20');
6702 insert into t44 values (60,'14:30:20');
6703 insert into t55 values (60,'14:30:20');
6704 insert into t66 values (60,'14:30:20');
6705 select * from t11 order by col1;
6706 col1
6707 10:22:33
6708 14:30:20
6709 select * from t22 order by col1;
6710 col1
6711 10:22:33
6712 14:30:20
6713 21:59:22
6714 select * from t33 order by col1;
6715 col1
6716 10:22:33
6717 14:30:20
6718 21:59:22
6719 select * from t44 order by colint;
6720 colint  col1
6721 1       09:09:15.000002
6722 2       04:30:01.000018
6723 3       00:59:22.000024
6724 4       05:30:34.000037
6725 60      14:30:20
6726 select * from t55 order by colint;
6727 colint  col1
6728 1       09:09:15.000002
6729 2       04:30:01.000018
6730 3       00:59:22.000024
6731 4       05:30:34.000037
6732 60      14:30:20
6733 select * from t66 order by colint;
6734 colint  col1
6735 1       09:09:15.000002
6736 2       04:30:01.000018
6737 3       00:59:22.000024
6738 4       05:30:34.000037
6739 60      14:30:20
6740 -------------------------
6741 ---- some alter table end
6742 -------------------------
6743 drop table if exists t1 ;
6744 drop table if exists t2 ;
6745 drop table if exists t3 ;
6746 drop table if exists t4 ;
6747 drop table if exists t5 ;
6748 drop table if exists t6 ;
6749 drop table if exists t11 ;
6750 drop table if exists t22 ;
6751 drop table if exists t33 ;
6752 drop table if exists t44 ;
6753 drop table if exists t55 ;
6754 drop table if exists t66 ;
6755 -------------------------------------------------------------------------
6756 ---  month(col1)  in partition with coltype  date
6757 -------------------------------------------------------------------------
6758 drop table if exists t1 ;
6759 drop table if exists t2 ;
6760 drop table if exists t3 ;
6761 drop table if exists t4 ;
6762 drop table if exists t5 ;
6763 drop table if exists t6 ;
6764 -------------------------------------------------------------------------
6765 ---  Create tables with month(col1)
6766 -------------------------------------------------------------------------
6767 create table t1 (col1 date) engine='NDB' 
6768 partition by range(month(col1)) 
6769 (partition p0 values less than (15),
6770 partition p1 values less than maxvalue);
6771 create table t2 (col1 date) engine='NDB' 
6772 partition by list(month(col1)) 
6773 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
6774 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
6775 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
6776 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
6777 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
6778 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
6780 create table t3 (col1 date) engine='NDB' 
6781 partition by hash(month(col1));
6782 create table t4 (colint int, col1 date) engine='NDB' 
6783 partition by range(colint) 
6784 subpartition by hash(month(col1)) subpartitions 2 
6785 (partition p0 values less than (15),
6786 partition p1 values less than maxvalue);
6787 create table t5 (colint int, col1 date) engine='NDB' 
6788 partition by list(colint) 
6789 subpartition by hash(month(col1)) subpartitions 2 
6790 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15),
6791 partition p1 values in (16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
6792 partition p2 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45),
6793 partition p3 values in (46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
6795 create table t6 (colint int, col1 date) engine='NDB' 
6796 partition by range(colint) 
6797 (partition p0 values less than (month('2006-10-14')),
6798 partition p1 values less than maxvalue);
6799 -------------------------------------------------------------------------
6800 ---  Access tables with month(col1) 
6801 -------------------------------------------------------------------------
6802 insert into t1 values ('2006-01-03');
6803 insert into t1 values ('2006-12-17');
6804 insert into t2 values ('2006-01-03');
6805 insert into t2 values ('2006-12-17');
6806 insert into t2 values ('2006-05-25');
6807 insert into t3 values ('2006-01-03');
6808 insert into t3 values ('2006-12-17');
6809 insert into t3 values ('2006-05-25');
6810 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4;
6811 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5;
6812 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6;
6813 select month(col1) from t1 order by col1;
6814 month(col1)
6817 select * from t1 order by col1;
6818 col1
6819 2006-01-03
6820 2006-12-17
6821 select * from t2 order by col1;
6822 col1
6823 2006-01-03
6824 2006-05-25
6825 2006-12-17
6826 select * from t3 order by col1;
6827 col1
6828 2006-01-03
6829 2006-05-25
6830 2006-12-17
6831 select * from t4 order by colint;
6832 colint  col1
6833 1       2006-02-03
6834 2       2006-01-17
6835 3       2006-01-25
6836 4       2006-02-05
6837 select * from t5 order by colint;
6838 colint  col1
6839 1       2006-02-03
6840 2       2006-01-17
6841 3       2006-01-25
6842 4       2006-02-05
6843 select * from t6 order by colint;
6844 colint  col1
6845 1       2006-02-03
6846 2       2006-01-17
6847 3       2006-01-25
6848 4       2006-02-05
6849 update t1 set col1='2006-11-06' where col1='2006-01-03';
6850 update t2 set col1='2006-11-06' where col1='2006-01-03';
6851 update t3 set col1='2006-11-06' where col1='2006-01-03';
6852 update t4 set col1='2006-11-06' where col1='2006-01-03';
6853 update t5 set col1='2006-11-06' where col1='2006-01-03';
6854 update t6 set col1='2006-11-06' where col1='2006-01-03';
6855 select * from t1 order by col1;
6856 col1
6857 2006-11-06
6858 2006-12-17
6859 select * from t2 order by col1;
6860 col1
6861 2006-05-25
6862 2006-11-06
6863 2006-12-17
6864 select * from t3 order by col1;
6865 col1
6866 2006-05-25
6867 2006-11-06
6868 2006-12-17
6869 select * from t4 order by colint;
6870 colint  col1
6871 1       2006-02-03
6872 2       2006-01-17
6873 3       2006-01-25
6874 4       2006-02-05
6875 select * from t5 order by colint;
6876 colint  col1
6877 1       2006-02-03
6878 2       2006-01-17
6879 3       2006-01-25
6880 4       2006-02-05
6881 select * from t6 order by colint;
6882 colint  col1
6883 1       2006-02-03
6884 2       2006-01-17
6885 3       2006-01-25
6886 4       2006-02-05
6887 -------------------------------------------------------------------------
6888 ---  Alter tables with month(col1)
6889 -------------------------------------------------------------------------
6890 drop table if exists t11 ;
6891 drop table if exists t22 ;
6892 drop table if exists t33 ;
6893 drop table if exists t44 ;
6894 drop table if exists t55 ;
6895 drop table if exists t66 ;
6896 create table t11 engine='NDB' as select * from t1;
6897 create table t22 engine='NDB' as select * from t2;
6898 create table t33 engine='NDB' as select * from t3;
6899 create table t44 engine='NDB' as select * from t4;
6900 create table t55 engine='NDB' as select * from t5;
6901 create table t66 engine='NDB' as select * from t6;
6902 alter table t11
6903 partition by range(month(col1)) 
6904 (partition p0 values less than (15),
6905 partition p1 values less than maxvalue);
6906 alter table t22
6907 partition by list(month(col1)) 
6908 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
6909 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
6910 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
6911 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
6912 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
6913 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
6915 alter table t33
6916 partition by hash(month(col1));
6917 alter table t44
6918 partition by range(colint) 
6919 subpartition by hash(month(col1)) subpartitions 2 
6920 (partition p0 values less than (15),
6921 partition p1 values less than maxvalue);
6922 alter table t55
6923 partition by list(colint) 
6924 subpartition by hash(month(col1)) subpartitions 2 
6925 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15),
6926 partition p1 values in (16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
6927 partition p2 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45),
6928 partition p3 values in (46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
6930 alter table t66
6931 partition by range(colint) 
6932 (partition p0 values less than (month('2006-10-14')),
6933 partition p1 values less than maxvalue);
6934 select * from t11 order by col1;
6935 col1
6936 2006-11-06
6937 2006-12-17
6938 select * from t22 order by col1;
6939 col1
6940 2006-05-25
6941 2006-11-06
6942 2006-12-17
6943 select * from t33 order by col1;
6944 col1
6945 2006-05-25
6946 2006-11-06
6947 2006-12-17
6948 select * from t44 order by colint;
6949 colint  col1
6950 1       2006-02-03
6951 2       2006-01-17
6952 3       2006-01-25
6953 4       2006-02-05
6954 select * from t55 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 select * from t66 order by colint;
6961 colint  col1
6962 1       2006-02-03
6963 2       2006-01-17
6964 3       2006-01-25
6965 4       2006-02-05
6966 ---------------------------
6967 ---- some alter table begin
6968 ---------------------------
6969 alter table t55
6970 partition by list(colint) 
6971 subpartition by hash(month(col1)) subpartitions 4 
6972 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
6973 partition p1 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
6975 show create table t55;
6976 Table   Create Table
6977 t55     CREATE TABLE `t55` (
6978   `colint` int(11) DEFAULT NULL,
6979   `col1` date DEFAULT NULL
6980 ) ENGINE=ndbcluster DEFAULT CHARSET=latin1
6981 /*!50100 PARTITION BY LIST (colint)
6982 SUBPARTITION BY HASH (month(col1))
6983 SUBPARTITIONS 4
6984 (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30) ENGINE = ndbcluster,
6985  PARTITION p1 VALUES IN (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60) ENGINE = ndbcluster) */
6986 select * from t55 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 -------------------------------------------------------------------------
6993 ---  Delete rows and partitions of tables with month(col1)
6994 -------------------------------------------------------------------------
6995 delete from t1 where col1='2006-12-17';
6996 delete from t2 where col1='2006-12-17';
6997 delete from t3 where col1='2006-12-17';
6998 delete from t4 where col1='2006-12-17';
6999 delete from t5 where col1='2006-12-17';
7000 delete from t6 where col1='2006-12-17';
7001 select * from t1 order by col1;
7002 col1
7003 2006-11-06
7004 select * from t2 order by col1;
7005 col1
7006 2006-05-25
7007 2006-11-06
7008 select * from t3 order by col1;
7009 col1
7010 2006-05-25
7011 2006-11-06
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 select * from t5 order by colint;
7019 colint  col1
7020 1       2006-02-03
7021 2       2006-01-17
7022 3       2006-01-25
7023 4       2006-02-05
7024 insert into t1 values ('2006-12-17');
7025 insert into t2 values ('2006-12-17');
7026 insert into t3 values ('2006-12-17');
7027 insert into t4 values (60,'2006-12-17');
7028 insert into t5 values (60,'2006-12-17');
7029 insert into t6 values (60,'2006-12-17');
7030 select * from t1 order by col1;
7031 col1
7032 2006-11-06
7033 2006-12-17
7034 select * from t2 order by col1;
7035 col1
7036 2006-05-25
7037 2006-11-06
7038 2006-12-17
7039 select * from t3 order by col1;
7040 col1
7041 2006-05-25
7042 2006-11-06
7043 2006-12-17
7044 select * from t4 order by colint;
7045 colint  col1
7046 1       2006-02-03
7047 2       2006-01-17
7048 3       2006-01-25
7049 4       2006-02-05
7050 60      2006-12-17
7051 select * from t5 order by colint;
7052 colint  col1
7053 1       2006-02-03
7054 2       2006-01-17
7055 3       2006-01-25
7056 4       2006-02-05
7057 60      2006-12-17
7058 select * from t6 order by colint;
7059 colint  col1
7060 1       2006-02-03
7061 2       2006-01-17
7062 3       2006-01-25
7063 4       2006-02-05
7064 60      2006-12-17
7065 -------------------------------------------------------------------------
7066 ---  Delete rows and partitions of tables with month(col1)
7067 -------------------------------------------------------------------------
7068 delete from t11 where col1='2006-12-17';
7069 delete from t22 where col1='2006-12-17';
7070 delete from t33 where col1='2006-12-17';
7071 delete from t44 where col1='2006-12-17';
7072 delete from t55 where col1='2006-12-17';
7073 delete from t66 where col1='2006-12-17';
7074 select * from t11 order by col1;
7075 col1
7076 2006-11-06
7077 select * from t22 order by col1;
7078 col1
7079 2006-05-25
7080 2006-11-06
7081 select * from t33 order by col1;
7082 col1
7083 2006-05-25
7084 2006-11-06
7085 select * from t44 order by colint;
7086 colint  col1
7087 1       2006-02-03
7088 2       2006-01-17
7089 3       2006-01-25
7090 4       2006-02-05
7091 select * from t55 order by colint;
7092 colint  col1
7093 1       2006-02-03
7094 2       2006-01-17
7095 3       2006-01-25
7096 4       2006-02-05
7097 insert into t11 values ('2006-12-17');
7098 insert into t22 values ('2006-12-17');
7099 insert into t33 values ('2006-12-17');
7100 insert into t44 values (60,'2006-12-17');
7101 insert into t55 values (60,'2006-12-17');
7102 insert into t66 values (60,'2006-12-17');
7103 select * from t11 order by col1;
7104 col1
7105 2006-11-06
7106 2006-12-17
7107 select * from t22 order by col1;
7108 col1
7109 2006-05-25
7110 2006-11-06
7111 2006-12-17
7112 select * from t33 order by col1;
7113 col1
7114 2006-05-25
7115 2006-11-06
7116 2006-12-17
7117 select * from t44 order by colint;
7118 colint  col1
7119 1       2006-02-03
7120 2       2006-01-17
7121 3       2006-01-25
7122 4       2006-02-05
7123 60      2006-12-17
7124 select * from t55 order by colint;
7125 colint  col1
7126 1       2006-02-03
7127 2       2006-01-17
7128 3       2006-01-25
7129 4       2006-02-05
7130 60      2006-12-17
7131 select * from t66 order by colint;
7132 colint  col1
7133 1       2006-02-03
7134 2       2006-01-17
7135 3       2006-01-25
7136 4       2006-02-05
7137 60      2006-12-17
7138 -------------------------
7139 ---- some alter table end
7140 -------------------------
7141 drop table if exists t1 ;
7142 drop table if exists t2 ;
7143 drop table if exists t3 ;
7144 drop table if exists t4 ;
7145 drop table if exists t5 ;
7146 drop table if exists t6 ;
7147 drop table if exists t11 ;
7148 drop table if exists t22 ;
7149 drop table if exists t33 ;
7150 drop table if exists t44 ;
7151 drop table if exists t55 ;
7152 drop table if exists t66 ;
7153 -------------------------------------------------------------------------
7154 ---  quarter(col1)  in partition with coltype  date
7155 -------------------------------------------------------------------------
7156 drop table if exists t1 ;
7157 drop table if exists t2 ;
7158 drop table if exists t3 ;
7159 drop table if exists t4 ;
7160 drop table if exists t5 ;
7161 drop table if exists t6 ;
7162 -------------------------------------------------------------------------
7163 ---  Create tables with quarter(col1)
7164 -------------------------------------------------------------------------
7165 create table t1 (col1 date) engine='NDB' 
7166 partition by range(quarter(col1)) 
7167 (partition p0 values less than (15),
7168 partition p1 values less than maxvalue);
7169 create table t2 (col1 date) engine='NDB' 
7170 partition by list(quarter(col1)) 
7171 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
7172 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
7173 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
7174 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
7175 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
7176 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
7178 create table t3 (col1 date) engine='NDB' 
7179 partition by hash(quarter(col1));
7180 create table t4 (colint int, col1 date) engine='NDB' 
7181 partition by range(colint) 
7182 subpartition by hash(quarter(col1)) subpartitions 2 
7183 (partition p0 values less than (15),
7184 partition p1 values less than maxvalue);
7185 create table t5 (colint int, col1 date) engine='NDB' 
7186 partition by list(colint) 
7187 subpartition by hash(quarter(col1)) subpartitions 2 
7188 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15),
7189 partition p1 values in (16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
7190 partition p2 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45),
7191 partition p3 values in (46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
7193 create table t6 (colint int, col1 date) engine='NDB' 
7194 partition by range(colint) 
7195 (partition p0 values less than (quarter('2006-10-14')),
7196 partition p1 values less than maxvalue);
7197 -------------------------------------------------------------------------
7198 ---  Access tables with quarter(col1) 
7199 -------------------------------------------------------------------------
7200 insert into t1 values ('2006-01-03');
7201 insert into t1 values ('2006-12-17');
7202 insert into t2 values ('2006-01-03');
7203 insert into t2 values ('2006-12-17');
7204 insert into t2 values ('2006-09-25');
7205 insert into t3 values ('2006-01-03');
7206 insert into t3 values ('2006-12-17');
7207 insert into t3 values ('2006-09-25');
7208 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4;
7209 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5;
7210 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6;
7211 select quarter(col1) from t1 order by col1;
7212 quarter(col1)
7215 select * from t1 order by col1;
7216 col1
7217 2006-01-03
7218 2006-12-17
7219 select * from t2 order by col1;
7220 col1
7221 2006-01-03
7222 2006-09-25
7223 2006-12-17
7224 select * from t3 order by col1;
7225 col1
7226 2006-01-03
7227 2006-09-25
7228 2006-12-17
7229 select * from t4 order by colint;
7230 colint  col1
7231 1       2006-02-03
7232 2       2006-01-17
7233 3       2006-01-25
7234 4       2006-02-05
7235 select * from t5 order by colint;
7236 colint  col1
7237 1       2006-02-03
7238 2       2006-01-17
7239 3       2006-01-25
7240 4       2006-02-05
7241 select * from t6 order by colint;
7242 colint  col1
7243 1       2006-02-03
7244 2       2006-01-17
7245 3       2006-01-25
7246 4       2006-02-05
7247 update t1 set col1='2006-07-30' where col1='2006-01-03';
7248 update t2 set col1='2006-07-30' where col1='2006-01-03';
7249 update t3 set col1='2006-07-30' where col1='2006-01-03';
7250 update t4 set col1='2006-07-30' where col1='2006-01-03';
7251 update t5 set col1='2006-07-30' where col1='2006-01-03';
7252 update t6 set col1='2006-07-30' where col1='2006-01-03';
7253 select * from t1 order by col1;
7254 col1
7255 2006-07-30
7256 2006-12-17
7257 select * from t2 order by col1;
7258 col1
7259 2006-07-30
7260 2006-09-25
7261 2006-12-17
7262 select * from t3 order by col1;
7263 col1
7264 2006-07-30
7265 2006-09-25
7266 2006-12-17
7267 select * from t4 order by colint;
7268 colint  col1
7269 1       2006-02-03
7270 2       2006-01-17
7271 3       2006-01-25
7272 4       2006-02-05
7273 select * from t5 order by colint;
7274 colint  col1
7275 1       2006-02-03
7276 2       2006-01-17
7277 3       2006-01-25
7278 4       2006-02-05
7279 select * from t6 order by colint;
7280 colint  col1
7281 1       2006-02-03
7282 2       2006-01-17
7283 3       2006-01-25
7284 4       2006-02-05
7285 -------------------------------------------------------------------------
7286 ---  Alter tables with quarter(col1)
7287 -------------------------------------------------------------------------
7288 drop table if exists t11 ;
7289 drop table if exists t22 ;
7290 drop table if exists t33 ;
7291 drop table if exists t44 ;
7292 drop table if exists t55 ;
7293 drop table if exists t66 ;
7294 create table t11 engine='NDB' as select * from t1;
7295 create table t22 engine='NDB' as select * from t2;
7296 create table t33 engine='NDB' as select * from t3;
7297 create table t44 engine='NDB' as select * from t4;
7298 create table t55 engine='NDB' as select * from t5;
7299 create table t66 engine='NDB' as select * from t6;
7300 alter table t11
7301 partition by range(quarter(col1)) 
7302 (partition p0 values less than (15),
7303 partition p1 values less than maxvalue);
7304 alter table t22
7305 partition by list(quarter(col1)) 
7306 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
7307 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
7308 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
7309 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
7310 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
7311 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
7313 alter table t33
7314 partition by hash(quarter(col1));
7315 alter table t44
7316 partition by range(colint) 
7317 subpartition by hash(quarter(col1)) subpartitions 2 
7318 (partition p0 values less than (15),
7319 partition p1 values less than maxvalue);
7320 alter table t55
7321 partition by list(colint) 
7322 subpartition by hash(quarter(col1)) subpartitions 2 
7323 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15),
7324 partition p1 values in (16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
7325 partition p2 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45),
7326 partition p3 values in (46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
7328 alter table t66
7329 partition by range(colint) 
7330 (partition p0 values less than (quarter('2006-10-14')),
7331 partition p1 values less than maxvalue);
7332 select * from t11 order by col1;
7333 col1
7334 2006-07-30
7335 2006-12-17
7336 select * from t22 order by col1;
7337 col1
7338 2006-07-30
7339 2006-09-25
7340 2006-12-17
7341 select * from t33 order by col1;
7342 col1
7343 2006-07-30
7344 2006-09-25
7345 2006-12-17
7346 select * from t44 order by colint;
7347 colint  col1
7348 1       2006-02-03
7349 2       2006-01-17
7350 3       2006-01-25
7351 4       2006-02-05
7352 select * from t55 order by colint;
7353 colint  col1
7354 1       2006-02-03
7355 2       2006-01-17
7356 3       2006-01-25
7357 4       2006-02-05
7358 select * from t66 order by colint;
7359 colint  col1
7360 1       2006-02-03
7361 2       2006-01-17
7362 3       2006-01-25
7363 4       2006-02-05
7364 ---------------------------
7365 ---- some alter table begin
7366 ---------------------------
7367 alter table t55
7368 partition by list(colint) 
7369 subpartition by hash(quarter(col1)) subpartitions 4 
7370 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
7371 partition p1 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
7373 show create table t55;
7374 Table   Create Table
7375 t55     CREATE TABLE `t55` (
7376   `colint` int(11) DEFAULT NULL,
7377   `col1` date DEFAULT NULL
7378 ) ENGINE=ndbcluster DEFAULT CHARSET=latin1
7379 /*!50100 PARTITION BY LIST (colint)
7380 SUBPARTITION BY HASH (quarter(col1))
7381 SUBPARTITIONS 4
7382 (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30) ENGINE = ndbcluster,
7383  PARTITION p1 VALUES IN (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60) ENGINE = ndbcluster) */
7384 select * from t55 order by colint;
7385 colint  col1
7386 1       2006-02-03
7387 2       2006-01-17
7388 3       2006-01-25
7389 4       2006-02-05
7390 -------------------------------------------------------------------------
7391 ---  Delete rows and partitions of tables with quarter(col1)
7392 -------------------------------------------------------------------------
7393 delete from t1 where col1='2006-12-17';
7394 delete from t2 where col1='2006-12-17';
7395 delete from t3 where col1='2006-12-17';
7396 delete from t4 where col1='2006-12-17';
7397 delete from t5 where col1='2006-12-17';
7398 delete from t6 where col1='2006-12-17';
7399 select * from t1 order by col1;
7400 col1
7401 2006-07-30
7402 select * from t2 order by col1;
7403 col1
7404 2006-07-30
7405 2006-09-25
7406 select * from t3 order by col1;
7407 col1
7408 2006-07-30
7409 2006-09-25
7410 select * from t4 order by colint;
7411 colint  col1
7412 1       2006-02-03
7413 2       2006-01-17
7414 3       2006-01-25
7415 4       2006-02-05
7416 select * from t5 order by colint;
7417 colint  col1
7418 1       2006-02-03
7419 2       2006-01-17
7420 3       2006-01-25
7421 4       2006-02-05
7422 insert into t1 values ('2006-12-17');
7423 insert into t2 values ('2006-12-17');
7424 insert into t3 values ('2006-12-17');
7425 insert into t4 values (60,'2006-12-17');
7426 insert into t5 values (60,'2006-12-17');
7427 insert into t6 values (60,'2006-12-17');
7428 select * from t1 order by col1;
7429 col1
7430 2006-07-30
7431 2006-12-17
7432 select * from t2 order by col1;
7433 col1
7434 2006-07-30
7435 2006-09-25
7436 2006-12-17
7437 select * from t3 order by col1;
7438 col1
7439 2006-07-30
7440 2006-09-25
7441 2006-12-17
7442 select * from t4 order by colint;
7443 colint  col1
7444 1       2006-02-03
7445 2       2006-01-17
7446 3       2006-01-25
7447 4       2006-02-05
7448 60      2006-12-17
7449 select * from t5 order by colint;
7450 colint  col1
7451 1       2006-02-03
7452 2       2006-01-17
7453 3       2006-01-25
7454 4       2006-02-05
7455 60      2006-12-17
7456 select * from t6 order by colint;
7457 colint  col1
7458 1       2006-02-03
7459 2       2006-01-17
7460 3       2006-01-25
7461 4       2006-02-05
7462 60      2006-12-17
7463 -------------------------------------------------------------------------
7464 ---  Delete rows and partitions of tables with quarter(col1)
7465 -------------------------------------------------------------------------
7466 delete from t11 where col1='2006-12-17';
7467 delete from t22 where col1='2006-12-17';
7468 delete from t33 where col1='2006-12-17';
7469 delete from t44 where col1='2006-12-17';
7470 delete from t55 where col1='2006-12-17';
7471 delete from t66 where col1='2006-12-17';
7472 select * from t11 order by col1;
7473 col1
7474 2006-07-30
7475 select * from t22 order by col1;
7476 col1
7477 2006-07-30
7478 2006-09-25
7479 select * from t33 order by col1;
7480 col1
7481 2006-07-30
7482 2006-09-25
7483 select * from t44 order by colint;
7484 colint  col1
7485 1       2006-02-03
7486 2       2006-01-17
7487 3       2006-01-25
7488 4       2006-02-05
7489 select * from t55 order by colint;
7490 colint  col1
7491 1       2006-02-03
7492 2       2006-01-17
7493 3       2006-01-25
7494 4       2006-02-05
7495 insert into t11 values ('2006-12-17');
7496 insert into t22 values ('2006-12-17');
7497 insert into t33 values ('2006-12-17');
7498 insert into t44 values (60,'2006-12-17');
7499 insert into t55 values (60,'2006-12-17');
7500 insert into t66 values (60,'2006-12-17');
7501 select * from t11 order by col1;
7502 col1
7503 2006-07-30
7504 2006-12-17
7505 select * from t22 order by col1;
7506 col1
7507 2006-07-30
7508 2006-09-25
7509 2006-12-17
7510 select * from t33 order by col1;
7511 col1
7512 2006-07-30
7513 2006-09-25
7514 2006-12-17
7515 select * from t44 order by colint;
7516 colint  col1
7517 1       2006-02-03
7518 2       2006-01-17
7519 3       2006-01-25
7520 4       2006-02-05
7521 60      2006-12-17
7522 select * from t55 order by colint;
7523 colint  col1
7524 1       2006-02-03
7525 2       2006-01-17
7526 3       2006-01-25
7527 4       2006-02-05
7528 60      2006-12-17
7529 select * from t66 order by colint;
7530 colint  col1
7531 1       2006-02-03
7532 2       2006-01-17
7533 3       2006-01-25
7534 4       2006-02-05
7535 60      2006-12-17
7536 -------------------------
7537 ---- some alter table end
7538 -------------------------
7539 drop table if exists t1 ;
7540 drop table if exists t2 ;
7541 drop table if exists t3 ;
7542 drop table if exists t4 ;
7543 drop table if exists t5 ;
7544 drop table if exists t6 ;
7545 drop table if exists t11 ;
7546 drop table if exists t22 ;
7547 drop table if exists t33 ;
7548 drop table if exists t44 ;
7549 drop table if exists t55 ;
7550 drop table if exists t66 ;
7551 -------------------------------------------------------------------------
7552 ---  time_to_sec(col1)-(time_to_sec(col1)-20)  in partition with coltype  time
7553 -------------------------------------------------------------------------
7554 drop table if exists t1 ;
7555 drop table if exists t2 ;
7556 drop table if exists t3 ;
7557 drop table if exists t4 ;
7558 drop table if exists t5 ;
7559 drop table if exists t6 ;
7560 -------------------------------------------------------------------------
7561 ---  Create tables with time_to_sec(col1)-(time_to_sec(col1)-20)
7562 -------------------------------------------------------------------------
7563 create table t1 (col1 time) engine='NDB' 
7564 partition by range(time_to_sec(col1)-(time_to_sec(col1)-20)) 
7565 (partition p0 values less than (15),
7566 partition p1 values less than maxvalue);
7567 create table t2 (col1 time) engine='NDB' 
7568 partition by list(time_to_sec(col1)-(time_to_sec(col1)-20)) 
7569 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
7570 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
7571 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
7572 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
7573 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
7574 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
7576 create table t3 (col1 time) engine='NDB' 
7577 partition by hash(time_to_sec(col1)-(time_to_sec(col1)-20));
7578 create table t4 (colint int, col1 time) engine='NDB' 
7579 partition by range(colint) 
7580 subpartition by hash(time_to_sec(col1)-(time_to_sec(col1)-20)) subpartitions 2 
7581 (partition p0 values less than (15),
7582 partition p1 values less than maxvalue);
7583 create table t5 (colint int, col1 time) engine='NDB' 
7584 partition by list(colint) 
7585 subpartition by hash(time_to_sec(col1)-(time_to_sec(col1)-20)) subpartitions 2 
7586 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15),
7587 partition p1 values in (16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
7588 partition p2 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45),
7589 partition p3 values in (46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
7591 create table t6 (colint int, col1 time) engine='NDB' 
7592 partition by range(colint) 
7593 (partition p0 values less than (time_to_sec('18:30:14')-(time_to_sec('17:59:59'))),
7594 partition p1 values less than maxvalue);
7595 -------------------------------------------------------------------------
7596 ---  Access tables with time_to_sec(col1)-(time_to_sec(col1)-20) 
7597 -------------------------------------------------------------------------
7598 insert into t1 values ('09:09:15');
7599 insert into t1 values ('14:30:45');
7600 insert into t2 values ('09:09:15');
7601 insert into t2 values ('14:30:45');
7602 insert into t2 values ('21:59:22');
7603 insert into t3 values ('09:09:15');
7604 insert into t3 values ('14:30:45');
7605 insert into t3 values ('21:59:22');
7606 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t4;
7607 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t5;
7608 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t6;
7609 select time_to_sec(col1)-(time_to_sec(col1)-20) from t1 order by col1;
7610 time_to_sec(col1)-(time_to_sec(col1)-20)
7613 select * from t1 order by col1;
7614 col1
7615 09:09:15
7616 14:30:45
7617 select * from t2 order by col1;
7618 col1
7619 09:09:15
7620 14:30:45
7621 21:59:22
7622 select * from t3 order by col1;
7623 col1
7624 09:09:15
7625 14:30:45
7626 21:59:22
7627 select * from t4 order by colint;
7628 colint  col1
7629 1       09:09:15
7630 2       04:30:01
7631 3       00:59:22
7632 4       05:30:34
7633 select * from t5 order by colint;
7634 colint  col1
7635 1       09:09:15
7636 2       04:30:01
7637 3       00:59:22
7638 4       05:30:34
7639 select * from t6 order by colint;
7640 colint  col1
7641 1       09:09:15
7642 2       04:30:01
7643 3       00:59:22
7644 4       05:30:34
7645 update t1 set col1='10:33:11' where col1='09:09:15';
7646 update t2 set col1='10:33:11' where col1='09:09:15';
7647 update t3 set col1='10:33:11' where col1='09:09:15';
7648 update t4 set col1='10:33:11' where col1='09:09:15';
7649 update t5 set col1='10:33:11' where col1='09:09:15';
7650 update t6 set col1='10:33:11' where col1='09:09:15';
7651 select * from t1 order by col1;
7652 col1
7653 10:33:11
7654 14:30:45
7655 select * from t2 order by col1;
7656 col1
7657 10:33:11
7658 14:30:45
7659 21:59:22
7660 select * from t3 order by col1;
7661 col1
7662 10:33:11
7663 14:30:45
7664 21:59:22
7665 select * from t4 order by colint;
7666 colint  col1
7667 1       10:33:11
7668 2       04:30:01
7669 3       00:59:22
7670 4       05:30:34
7671 select * from t5 order by colint;
7672 colint  col1
7673 1       10:33:11
7674 2       04:30:01
7675 3       00:59:22
7676 4       05:30:34
7677 select * from t6 order by colint;
7678 colint  col1
7679 1       10:33:11
7680 2       04:30:01
7681 3       00:59:22
7682 4       05:30:34
7683 -------------------------------------------------------------------------
7684 ---  Alter tables with time_to_sec(col1)-(time_to_sec(col1)-20)
7685 -------------------------------------------------------------------------
7686 drop table if exists t11 ;
7687 drop table if exists t22 ;
7688 drop table if exists t33 ;
7689 drop table if exists t44 ;
7690 drop table if exists t55 ;
7691 drop table if exists t66 ;
7692 create table t11 engine='NDB' as select * from t1;
7693 create table t22 engine='NDB' as select * from t2;
7694 create table t33 engine='NDB' as select * from t3;
7695 create table t44 engine='NDB' as select * from t4;
7696 create table t55 engine='NDB' as select * from t5;
7697 create table t66 engine='NDB' as select * from t6;
7698 alter table t11
7699 partition by range(time_to_sec(col1)-(time_to_sec(col1)-20)) 
7700 (partition p0 values less than (15),
7701 partition p1 values less than maxvalue);
7702 alter table t22
7703 partition by list(time_to_sec(col1)-(time_to_sec(col1)-20)) 
7704 (partition p0 values in (0,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)
7711 alter table t33
7712 partition by hash(time_to_sec(col1)-(time_to_sec(col1)-20));
7713 alter table t44
7714 partition by range(colint) 
7715 subpartition by hash(time_to_sec(col1)-(time_to_sec(col1)-20)) subpartitions 2 
7716 (partition p0 values less than (15),
7717 partition p1 values less than maxvalue);
7718 alter table t55
7719 partition by list(colint) 
7720 subpartition by hash(time_to_sec(col1)-(time_to_sec(col1)-20)) subpartitions 2 
7721 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15),
7722 partition p1 values in (16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
7723 partition p2 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45),
7724 partition p3 values in (46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
7726 alter table t66
7727 partition by range(colint) 
7728 (partition p0 values less than (time_to_sec('18:30:14')-(time_to_sec('17:59:59'))),
7729 partition p1 values less than maxvalue);
7730 select * from t11 order by col1;
7731 col1
7732 10:33:11
7733 14:30:45
7734 select * from t22 order by col1;
7735 col1
7736 10:33:11
7737 14:30:45
7738 21:59:22
7739 select * from t33 order by col1;
7740 col1
7741 10:33:11
7742 14:30:45
7743 21:59:22
7744 select * from t44 order by colint;
7745 colint  col1
7746 1       10:33:11
7747 2       04:30:01
7748 3       00:59:22
7749 4       05:30:34
7750 select * from t55 order by colint;
7751 colint  col1
7752 1       10:33:11
7753 2       04:30:01
7754 3       00:59:22
7755 4       05:30:34
7756 select * from t66 order by colint;
7757 colint  col1
7758 1       10:33:11
7759 2       04:30:01
7760 3       00:59:22
7761 4       05:30:34
7762 ---------------------------
7763 ---- some alter table begin
7764 ---------------------------
7765 alter table t55
7766 partition by list(colint) 
7767 subpartition by hash(time_to_sec(col1)-(time_to_sec(col1)-20)) subpartitions 4 
7768 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
7769 partition p1 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
7771 show create table t55;
7772 Table   Create Table
7773 t55     CREATE TABLE `t55` (
7774   `colint` int(11) DEFAULT NULL,
7775   `col1` time DEFAULT NULL
7776 ) ENGINE=ndbcluster DEFAULT CHARSET=latin1
7777 /*!50100 PARTITION BY LIST (colint)
7778 SUBPARTITION BY HASH (time_to_sec(col1)-(time_to_sec(col1)-20))
7779 SUBPARTITIONS 4
7780 (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30) ENGINE = ndbcluster,
7781  PARTITION p1 VALUES IN (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60) ENGINE = ndbcluster) */
7782 select * from t55 order by colint;
7783 colint  col1
7784 1       10:33:11
7785 2       04:30:01
7786 3       00:59:22
7787 4       05:30:34
7788 -------------------------------------------------------------------------
7789 ---  Delete rows and partitions of tables with time_to_sec(col1)-(time_to_sec(col1)-20)
7790 -------------------------------------------------------------------------
7791 delete from t1 where col1='14:30:45';
7792 delete from t2 where col1='14:30:45';
7793 delete from t3 where col1='14:30:45';
7794 delete from t4 where col1='14:30:45';
7795 delete from t5 where col1='14:30:45';
7796 delete from t6 where col1='14:30:45';
7797 select * from t1 order by col1;
7798 col1
7799 10:33:11
7800 select * from t2 order by col1;
7801 col1
7802 10:33:11
7803 21:59:22
7804 select * from t3 order by col1;
7805 col1
7806 10:33:11
7807 21:59:22
7808 select * from t4 order by colint;
7809 colint  col1
7810 1       10:33:11
7811 2       04:30:01
7812 3       00:59:22
7813 4       05:30:34
7814 select * from t5 order by colint;
7815 colint  col1
7816 1       10:33:11
7817 2       04:30:01
7818 3       00:59:22
7819 4       05:30:34
7820 insert into t1 values ('14:30:45');
7821 insert into t2 values ('14:30:45');
7822 insert into t3 values ('14:30:45');
7823 insert into t4 values (60,'14:30:45');
7824 insert into t5 values (60,'14:30:45');
7825 insert into t6 values (60,'14:30:45');
7826 select * from t1 order by col1;
7827 col1
7828 10:33:11
7829 14:30:45
7830 select * from t2 order by col1;
7831 col1
7832 10:33:11
7833 14:30:45
7834 21:59:22
7835 select * from t3 order by col1;
7836 col1
7837 10:33:11
7838 14:30:45
7839 21:59:22
7840 select * from t4 order by colint;
7841 colint  col1
7842 1       10:33:11
7843 2       04:30:01
7844 3       00:59:22
7845 4       05:30:34
7846 60      14:30:45
7847 select * from t5 order by colint;
7848 colint  col1
7849 1       10:33:11
7850 2       04:30:01
7851 3       00:59:22
7852 4       05:30:34
7853 60      14:30:45
7854 select * from t6 order by colint;
7855 colint  col1
7856 1       10:33:11
7857 2       04:30:01
7858 3       00:59:22
7859 4       05:30:34
7860 60      14:30:45
7861 -------------------------------------------------------------------------
7862 ---  Delete rows and partitions of tables with time_to_sec(col1)-(time_to_sec(col1)-20)
7863 -------------------------------------------------------------------------
7864 delete from t11 where col1='14:30:45';
7865 delete from t22 where col1='14:30:45';
7866 delete from t33 where col1='14:30:45';
7867 delete from t44 where col1='14:30:45';
7868 delete from t55 where col1='14:30:45';
7869 delete from t66 where col1='14:30:45';
7870 select * from t11 order by col1;
7871 col1
7872 10:33:11
7873 select * from t22 order by col1;
7874 col1
7875 10:33:11
7876 21:59:22
7877 select * from t33 order by col1;
7878 col1
7879 10:33:11
7880 21:59:22
7881 select * from t44 order by colint;
7882 colint  col1
7883 1       10:33:11
7884 2       04:30:01
7885 3       00:59:22
7886 4       05:30:34
7887 select * from t55 order by colint;
7888 colint  col1
7889 1       10:33:11
7890 2       04:30:01
7891 3       00:59:22
7892 4       05:30:34
7893 insert into t11 values ('14:30:45');
7894 insert into t22 values ('14:30:45');
7895 insert into t33 values ('14:30:45');
7896 insert into t44 values (60,'14:30:45');
7897 insert into t55 values (60,'14:30:45');
7898 insert into t66 values (60,'14:30:45');
7899 select * from t11 order by col1;
7900 col1
7901 10:33:11
7902 14:30:45
7903 select * from t22 order by col1;
7904 col1
7905 10:33:11
7906 14:30:45
7907 21:59:22
7908 select * from t33 order by col1;
7909 col1
7910 10:33:11
7911 14:30:45
7912 21:59:22
7913 select * from t44 order by colint;
7914 colint  col1
7915 1       10:33:11
7916 2       04:30:01
7917 3       00:59:22
7918 4       05:30:34
7919 60      14:30:45
7920 select * from t55 order by colint;
7921 colint  col1
7922 1       10:33:11
7923 2       04:30:01
7924 3       00:59:22
7925 4       05:30:34
7926 60      14:30:45
7927 select * from t66 order by colint;
7928 colint  col1
7929 1       10:33:11
7930 2       04:30:01
7931 3       00:59:22
7932 4       05:30:34
7933 60      14:30:45
7934 -------------------------
7935 ---- some alter table end
7936 -------------------------
7937 drop table if exists t1 ;
7938 drop table if exists t2 ;
7939 drop table if exists t3 ;
7940 drop table if exists t4 ;
7941 drop table if exists t5 ;
7942 drop table if exists t6 ;
7943 drop table if exists t11 ;
7944 drop table if exists t22 ;
7945 drop table if exists t33 ;
7946 drop table if exists t44 ;
7947 drop table if exists t55 ;
7948 drop table if exists t66 ;
7949 -------------------------------------------------------------------------
7950 ---  to_days(col1)-to_days('2006-01-01')  in partition with coltype  date
7951 -------------------------------------------------------------------------
7952 drop table if exists t1 ;
7953 drop table if exists t2 ;
7954 drop table if exists t3 ;
7955 drop table if exists t4 ;
7956 drop table if exists t5 ;
7957 drop table if exists t6 ;
7958 -------------------------------------------------------------------------
7959 ---  Create tables with to_days(col1)-to_days('2006-01-01')
7960 -------------------------------------------------------------------------
7961 create table t1 (col1 date) engine='NDB' 
7962 partition by range(to_days(col1)-to_days('2006-01-01')) 
7963 (partition p0 values less than (15),
7964 partition p1 values less than maxvalue);
7965 create table t2 (col1 date) engine='NDB' 
7966 partition by list(to_days(col1)-to_days('2006-01-01')) 
7967 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
7968 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
7969 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
7970 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
7971 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
7972 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
7974 create table t3 (col1 date) engine='NDB' 
7975 partition by hash(to_days(col1)-to_days('2006-01-01'));
7976 create table t4 (colint int, col1 date) engine='NDB' 
7977 partition by range(colint) 
7978 subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 2 
7979 (partition p0 values less than (15),
7980 partition p1 values less than maxvalue);
7981 create table t5 (colint int, col1 date) engine='NDB' 
7982 partition by list(colint) 
7983 subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 2 
7984 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15),
7985 partition p1 values in (16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
7986 partition p2 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45),
7987 partition p3 values in (46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
7989 create table t6 (colint int, col1 date) engine='NDB' 
7990 partition by range(colint) 
7991 (partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')),
7992 partition p1 values less than maxvalue);
7993 -------------------------------------------------------------------------
7994 ---  Access tables with to_days(col1)-to_days('2006-01-01') 
7995 -------------------------------------------------------------------------
7996 insert into t1 values ('2006-02-03');
7997 insert into t1 values ('2006-01-17');
7998 insert into t2 values ('2006-02-03');
7999 insert into t2 values ('2006-01-17');
8000 insert into t2 values ('2006-01-25');
8001 insert into t3 values ('2006-02-03');
8002 insert into t3 values ('2006-01-17');
8003 insert into t3 values ('2006-01-25');
8004 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4;
8005 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5;
8006 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6;
8007 select to_days(col1)-to_days('2006-01-01') from t1 order by col1;
8008 to_days(col1)-to_days('2006-01-01')
8011 select * from t1 order by col1;
8012 col1
8013 2006-01-17
8014 2006-02-03
8015 select * from t2 order by col1;
8016 col1
8017 2006-01-17
8018 2006-01-25
8019 2006-02-03
8020 select * from t3 order by col1;
8021 col1
8022 2006-01-17
8023 2006-01-25
8024 2006-02-03
8025 select * from t4 order by colint;
8026 colint  col1
8027 1       2006-02-03
8028 2       2006-01-17
8029 3       2006-01-25
8030 4       2006-02-05
8031 select * from t5 order by colint;
8032 colint  col1
8033 1       2006-02-03
8034 2       2006-01-17
8035 3       2006-01-25
8036 4       2006-02-05
8037 select * from t6 order by colint;
8038 colint  col1
8039 1       2006-02-03
8040 2       2006-01-17
8041 3       2006-01-25
8042 4       2006-02-05
8043 update t1 set col1='2006-02-06' where col1='2006-02-03';
8044 update t2 set col1='2006-02-06' where col1='2006-02-03';
8045 update t3 set col1='2006-02-06' where col1='2006-02-03';
8046 update t4 set col1='2006-02-06' where col1='2006-02-03';
8047 update t5 set col1='2006-02-06' where col1='2006-02-03';
8048 update t6 set col1='2006-02-06' where col1='2006-02-03';
8049 select * from t1 order by col1;
8050 col1
8051 2006-01-17
8052 2006-02-06
8053 select * from t2 order by col1;
8054 col1
8055 2006-01-17
8056 2006-01-25
8057 2006-02-06
8058 select * from t3 order by col1;
8059 col1
8060 2006-01-17
8061 2006-01-25
8062 2006-02-06
8063 select * from t4 order by colint;
8064 colint  col1
8065 1       2006-02-06
8066 2       2006-01-17
8067 3       2006-01-25
8068 4       2006-02-05
8069 select * from t5 order by colint;
8070 colint  col1
8071 1       2006-02-06
8072 2       2006-01-17
8073 3       2006-01-25
8074 4       2006-02-05
8075 select * from t6 order by colint;
8076 colint  col1
8077 1       2006-02-06
8078 2       2006-01-17
8079 3       2006-01-25
8080 4       2006-02-05
8081 -------------------------------------------------------------------------
8082 ---  Alter tables with to_days(col1)-to_days('2006-01-01')
8083 -------------------------------------------------------------------------
8084 drop table if exists t11 ;
8085 drop table if exists t22 ;
8086 drop table if exists t33 ;
8087 drop table if exists t44 ;
8088 drop table if exists t55 ;
8089 drop table if exists t66 ;
8090 create table t11 engine='NDB' as select * from t1;
8091 create table t22 engine='NDB' as select * from t2;
8092 create table t33 engine='NDB' as select * from t3;
8093 create table t44 engine='NDB' as select * from t4;
8094 create table t55 engine='NDB' as select * from t5;
8095 create table t66 engine='NDB' as select * from t6;
8096 alter table t11
8097 partition by range(to_days(col1)-to_days('2006-01-01')) 
8098 (partition p0 values less than (15),
8099 partition p1 values less than maxvalue);
8100 alter table t22
8101 partition by list(to_days(col1)-to_days('2006-01-01')) 
8102 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
8103 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
8104 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
8105 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
8106 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
8107 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
8109 alter table t33
8110 partition by hash(to_days(col1)-to_days('2006-01-01'));
8111 alter table t44
8112 partition by range(colint) 
8113 subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 2 
8114 (partition p0 values less than (15),
8115 partition p1 values less than maxvalue);
8116 alter table t55
8117 partition by list(colint) 
8118 subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 2 
8119 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15),
8120 partition p1 values in (16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
8121 partition p2 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45),
8122 partition p3 values in (46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
8124 alter table t66
8125 partition by range(colint) 
8126 (partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')),
8127 partition p1 values less than maxvalue);
8128 select * from t11 order by col1;
8129 col1
8130 2006-01-17
8131 2006-02-06
8132 select * from t22 order by col1;
8133 col1
8134 2006-01-17
8135 2006-01-25
8136 2006-02-06
8137 select * from t33 order by col1;
8138 col1
8139 2006-01-17
8140 2006-01-25
8141 2006-02-06
8142 select * from t44 order by colint;
8143 colint  col1
8144 1       2006-02-06
8145 2       2006-01-17
8146 3       2006-01-25
8147 4       2006-02-05
8148 select * from t55 order by colint;
8149 colint  col1
8150 1       2006-02-06
8151 2       2006-01-17
8152 3       2006-01-25
8153 4       2006-02-05
8154 select * from t66 order by colint;
8155 colint  col1
8156 1       2006-02-06
8157 2       2006-01-17
8158 3       2006-01-25
8159 4       2006-02-05
8160 ---------------------------
8161 ---- some alter table begin
8162 ---------------------------
8163 alter table t55
8164 partition by list(colint) 
8165 subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 4 
8166 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
8167 partition p1 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
8169 show create table t55;
8170 Table   Create Table
8171 t55     CREATE TABLE `t55` (
8172   `colint` int(11) DEFAULT NULL,
8173   `col1` date DEFAULT NULL
8174 ) ENGINE=ndbcluster DEFAULT CHARSET=latin1
8175 /*!50100 PARTITION BY LIST (colint)
8176 SUBPARTITION BY HASH (to_days(col1)-to_days('2006-01-01'))
8177 SUBPARTITIONS 4
8178 (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30) ENGINE = ndbcluster,
8179  PARTITION p1 VALUES IN (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60) ENGINE = ndbcluster) */
8180 select * from t55 order by colint;
8181 colint  col1
8182 1       2006-02-06
8183 2       2006-01-17
8184 3       2006-01-25
8185 4       2006-02-05
8186 -------------------------------------------------------------------------
8187 ---  Delete rows and partitions of tables with to_days(col1)-to_days('2006-01-01')
8188 -------------------------------------------------------------------------
8189 delete from t1 where col1='2006-01-17';
8190 delete from t2 where col1='2006-01-17';
8191 delete from t3 where col1='2006-01-17';
8192 delete from t4 where col1='2006-01-17';
8193 delete from t5 where col1='2006-01-17';
8194 delete from t6 where col1='2006-01-17';
8195 select * from t1 order by col1;
8196 col1
8197 2006-02-06
8198 select * from t2 order by col1;
8199 col1
8200 2006-01-25
8201 2006-02-06
8202 select * from t3 order by col1;
8203 col1
8204 2006-01-25
8205 2006-02-06
8206 select * from t4 order by colint;
8207 colint  col1
8208 1       2006-02-06
8209 3       2006-01-25
8210 4       2006-02-05
8211 select * from t5 order by colint;
8212 colint  col1
8213 1       2006-02-06
8214 3       2006-01-25
8215 4       2006-02-05
8216 insert into t1 values ('2006-01-17');
8217 insert into t2 values ('2006-01-17');
8218 insert into t3 values ('2006-01-17');
8219 insert into t4 values (60,'2006-01-17');
8220 insert into t5 values (60,'2006-01-17');
8221 insert into t6 values (60,'2006-01-17');
8222 select * from t1 order by col1;
8223 col1
8224 2006-01-17
8225 2006-02-06
8226 select * from t2 order by col1;
8227 col1
8228 2006-01-17
8229 2006-01-25
8230 2006-02-06
8231 select * from t3 order by col1;
8232 col1
8233 2006-01-17
8234 2006-01-25
8235 2006-02-06
8236 select * from t4 order by colint;
8237 colint  col1
8238 1       2006-02-06
8239 3       2006-01-25
8240 4       2006-02-05
8241 60      2006-01-17
8242 select * from t5 order by colint;
8243 colint  col1
8244 1       2006-02-06
8245 3       2006-01-25
8246 4       2006-02-05
8247 60      2006-01-17
8248 select * from t6 order by colint;
8249 colint  col1
8250 1       2006-02-06
8251 3       2006-01-25
8252 4       2006-02-05
8253 60      2006-01-17
8254 -------------------------------------------------------------------------
8255 ---  Delete rows and partitions of tables with to_days(col1)-to_days('2006-01-01')
8256 -------------------------------------------------------------------------
8257 delete from t11 where col1='2006-01-17';
8258 delete from t22 where col1='2006-01-17';
8259 delete from t33 where col1='2006-01-17';
8260 delete from t44 where col1='2006-01-17';
8261 delete from t55 where col1='2006-01-17';
8262 delete from t66 where col1='2006-01-17';
8263 select * from t11 order by col1;
8264 col1
8265 2006-02-06
8266 select * from t22 order by col1;
8267 col1
8268 2006-01-25
8269 2006-02-06
8270 select * from t33 order by col1;
8271 col1
8272 2006-01-25
8273 2006-02-06
8274 select * from t44 order by colint;
8275 colint  col1
8276 1       2006-02-06
8277 3       2006-01-25
8278 4       2006-02-05
8279 select * from t55 order by colint;
8280 colint  col1
8281 1       2006-02-06
8282 3       2006-01-25
8283 4       2006-02-05
8284 insert into t11 values ('2006-01-17');
8285 insert into t22 values ('2006-01-17');
8286 insert into t33 values ('2006-01-17');
8287 insert into t44 values (60,'2006-01-17');
8288 insert into t55 values (60,'2006-01-17');
8289 insert into t66 values (60,'2006-01-17');
8290 select * from t11 order by col1;
8291 col1
8292 2006-01-17
8293 2006-02-06
8294 select * from t22 order by col1;
8295 col1
8296 2006-01-17
8297 2006-01-25
8298 2006-02-06
8299 select * from t33 order by col1;
8300 col1
8301 2006-01-17
8302 2006-01-25
8303 2006-02-06
8304 select * from t44 order by colint;
8305 colint  col1
8306 1       2006-02-06
8307 3       2006-01-25
8308 4       2006-02-05
8309 60      2006-01-17
8310 select * from t55 order by colint;
8311 colint  col1
8312 1       2006-02-06
8313 3       2006-01-25
8314 4       2006-02-05
8315 60      2006-01-17
8316 select * from t66 order by colint;
8317 colint  col1
8318 1       2006-02-06
8319 3       2006-01-25
8320 4       2006-02-05
8321 60      2006-01-17
8322 -------------------------
8323 ---- some alter table end
8324 -------------------------
8325 drop table if exists t1 ;
8326 drop table if exists t2 ;
8327 drop table if exists t3 ;
8328 drop table if exists t4 ;
8329 drop table if exists t5 ;
8330 drop table if exists t6 ;
8331 drop table if exists t11 ;
8332 drop table if exists t22 ;
8333 drop table if exists t33 ;
8334 drop table if exists t44 ;
8335 drop table if exists t55 ;
8336 drop table if exists t66 ;
8337 -------------------------------------------------------------------------
8338 ---  datediff(col1, '2006-01-01')  in partition with coltype  date
8339 -------------------------------------------------------------------------
8340 drop table if exists t1 ;
8341 drop table if exists t2 ;
8342 drop table if exists t3 ;
8343 drop table if exists t4 ;
8344 drop table if exists t5 ;
8345 drop table if exists t6 ;
8346 -------------------------------------------------------------------------
8347 ---  Create tables with datediff(col1, '2006-01-01')
8348 -------------------------------------------------------------------------
8349 create table t1 (col1 date) engine='NDB' 
8350 partition by range(datediff(col1, '2006-01-01')) 
8351 (partition p0 values less than (15),
8352 partition p1 values less than maxvalue);
8353 create table t2 (col1 date) engine='NDB' 
8354 partition by list(datediff(col1, '2006-01-01')) 
8355 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
8356 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
8357 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
8358 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
8359 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
8360 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
8362 create table t3 (col1 date) engine='NDB' 
8363 partition by hash(datediff(col1, '2006-01-01'));
8364 create table t4 (colint int, col1 date) engine='NDB' 
8365 partition by range(colint) 
8366 subpartition by hash(datediff(col1, '2006-01-01')) subpartitions 2 
8367 (partition p0 values less than (15),
8368 partition p1 values less than maxvalue);
8369 create table t5 (colint int, col1 date) engine='NDB' 
8370 partition by list(colint) 
8371 subpartition by hash(datediff(col1, '2006-01-01')) subpartitions 2 
8372 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15),
8373 partition p1 values in (16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
8374 partition p2 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45),
8375 partition p3 values in (46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
8377 create table t6 (colint int, col1 date) engine='NDB' 
8378 partition by range(colint) 
8379 (partition p0 values less than (datediff('2006-02-02', '2006-01-01')),
8380 partition p1 values less than maxvalue);
8381 -------------------------------------------------------------------------
8382 ---  Access tables with datediff(col1, '2006-01-01') 
8383 -------------------------------------------------------------------------
8384 insert into t1 values ('2006-02-03');
8385 insert into t1 values ('2006-01-17');
8386 insert into t2 values ('2006-02-03');
8387 insert into t2 values ('2006-01-17');
8388 insert into t2 values ('2006-01-25');
8389 insert into t3 values ('2006-02-03');
8390 insert into t3 values ('2006-01-17');
8391 insert into t3 values ('2006-01-25');
8392 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4;
8393 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5;
8394 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6;
8395 select datediff(col1, '2006-01-01') from t1 order by col1;
8396 datediff(col1, '2006-01-01')
8399 select * from t1 order by col1;
8400 col1
8401 2006-01-17
8402 2006-02-03
8403 select * from t2 order by col1;
8404 col1
8405 2006-01-17
8406 2006-01-25
8407 2006-02-03
8408 select * from t3 order by col1;
8409 col1
8410 2006-01-17
8411 2006-01-25
8412 2006-02-03
8413 select * from t4 order by colint;
8414 colint  col1
8415 1       2006-02-03
8416 2       2006-01-17
8417 3       2006-01-25
8418 4       2006-02-05
8419 select * from t5 order by colint;
8420 colint  col1
8421 1       2006-02-03
8422 2       2006-01-17
8423 3       2006-01-25
8424 4       2006-02-05
8425 select * from t6 order by colint;
8426 colint  col1
8427 1       2006-02-03
8428 2       2006-01-17
8429 3       2006-01-25
8430 4       2006-02-05
8431 update t1 set col1='2006-02-06' where col1='2006-02-03';
8432 update t2 set col1='2006-02-06' where col1='2006-02-03';
8433 update t3 set col1='2006-02-06' where col1='2006-02-03';
8434 update t4 set col1='2006-02-06' where col1='2006-02-03';
8435 update t5 set col1='2006-02-06' where col1='2006-02-03';
8436 update t6 set col1='2006-02-06' where col1='2006-02-03';
8437 select * from t1 order by col1;
8438 col1
8439 2006-01-17
8440 2006-02-06
8441 select * from t2 order by col1;
8442 col1
8443 2006-01-17
8444 2006-01-25
8445 2006-02-06
8446 select * from t3 order by col1;
8447 col1
8448 2006-01-17
8449 2006-01-25
8450 2006-02-06
8451 select * from t4 order by colint;
8452 colint  col1
8453 1       2006-02-06
8454 2       2006-01-17
8455 3       2006-01-25
8456 4       2006-02-05
8457 select * from t5 order by colint;
8458 colint  col1
8459 1       2006-02-06
8460 2       2006-01-17
8461 3       2006-01-25
8462 4       2006-02-05
8463 select * from t6 order by colint;
8464 colint  col1
8465 1       2006-02-06
8466 2       2006-01-17
8467 3       2006-01-25
8468 4       2006-02-05
8469 -------------------------------------------------------------------------
8470 ---  Alter tables with datediff(col1, '2006-01-01')
8471 -------------------------------------------------------------------------
8472 drop table if exists t11 ;
8473 drop table if exists t22 ;
8474 drop table if exists t33 ;
8475 drop table if exists t44 ;
8476 drop table if exists t55 ;
8477 drop table if exists t66 ;
8478 create table t11 engine='NDB' as select * from t1;
8479 create table t22 engine='NDB' as select * from t2;
8480 create table t33 engine='NDB' as select * from t3;
8481 create table t44 engine='NDB' as select * from t4;
8482 create table t55 engine='NDB' as select * from t5;
8483 create table t66 engine='NDB' as select * from t6;
8484 alter table t11
8485 partition by range(datediff(col1, '2006-01-01')) 
8486 (partition p0 values less than (15),
8487 partition p1 values less than maxvalue);
8488 alter table t22
8489 partition by list(datediff(col1, '2006-01-01')) 
8490 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
8491 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
8492 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
8493 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
8494 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
8495 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
8497 alter table t33
8498 partition by hash(datediff(col1, '2006-01-01'));
8499 alter table t44
8500 partition by range(colint) 
8501 subpartition by hash(datediff(col1, '2006-01-01')) subpartitions 2 
8502 (partition p0 values less than (15),
8503 partition p1 values less than maxvalue);
8504 alter table t55
8505 partition by list(colint) 
8506 subpartition by hash(datediff(col1, '2006-01-01')) subpartitions 2 
8507 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15),
8508 partition p1 values in (16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
8509 partition p2 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45),
8510 partition p3 values in (46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
8512 alter table t66
8513 partition by range(colint) 
8514 (partition p0 values less than (datediff('2006-02-02', '2006-01-01')),
8515 partition p1 values less than maxvalue);
8516 select * from t11 order by col1;
8517 col1
8518 2006-01-17
8519 2006-02-06
8520 select * from t22 order by col1;
8521 col1
8522 2006-01-17
8523 2006-01-25
8524 2006-02-06
8525 select * from t33 order by col1;
8526 col1
8527 2006-01-17
8528 2006-01-25
8529 2006-02-06
8530 select * from t44 order by colint;
8531 colint  col1
8532 1       2006-02-06
8533 2       2006-01-17
8534 3       2006-01-25
8535 4       2006-02-05
8536 select * from t55 order by colint;
8537 colint  col1
8538 1       2006-02-06
8539 2       2006-01-17
8540 3       2006-01-25
8541 4       2006-02-05
8542 select * from t66 order by colint;
8543 colint  col1
8544 1       2006-02-06
8545 2       2006-01-17
8546 3       2006-01-25
8547 4       2006-02-05
8548 ---------------------------
8549 ---- some alter table begin
8550 ---------------------------
8551 alter table t55
8552 partition by list(colint) 
8553 subpartition by hash(datediff(col1, '2006-01-01')) subpartitions 4 
8554 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
8555 partition p1 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
8557 show create table t55;
8558 Table   Create Table
8559 t55     CREATE TABLE `t55` (
8560   `colint` int(11) DEFAULT NULL,
8561   `col1` date DEFAULT NULL
8562 ) ENGINE=ndbcluster DEFAULT CHARSET=latin1
8563 /*!50100 PARTITION BY LIST (colint)
8564 SUBPARTITION BY HASH (datediff(col1, '2006-01-01'))
8565 SUBPARTITIONS 4
8566 (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30) ENGINE = ndbcluster,
8567  PARTITION p1 VALUES IN (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60) ENGINE = ndbcluster) */
8568 select * from t55 order by colint;
8569 colint  col1
8570 1       2006-02-06
8571 2       2006-01-17
8572 3       2006-01-25
8573 4       2006-02-05
8574 -------------------------------------------------------------------------
8575 ---  Delete rows and partitions of tables with datediff(col1, '2006-01-01')
8576 -------------------------------------------------------------------------
8577 delete from t1 where col1='2006-01-17';
8578 delete from t2 where col1='2006-01-17';
8579 delete from t3 where col1='2006-01-17';
8580 delete from t4 where col1='2006-01-17';
8581 delete from t5 where col1='2006-01-17';
8582 delete from t6 where col1='2006-01-17';
8583 select * from t1 order by col1;
8584 col1
8585 2006-02-06
8586 select * from t2 order by col1;
8587 col1
8588 2006-01-25
8589 2006-02-06
8590 select * from t3 order by col1;
8591 col1
8592 2006-01-25
8593 2006-02-06
8594 select * from t4 order by colint;
8595 colint  col1
8596 1       2006-02-06
8597 3       2006-01-25
8598 4       2006-02-05
8599 select * from t5 order by colint;
8600 colint  col1
8601 1       2006-02-06
8602 3       2006-01-25
8603 4       2006-02-05
8604 insert into t1 values ('2006-01-17');
8605 insert into t2 values ('2006-01-17');
8606 insert into t3 values ('2006-01-17');
8607 insert into t4 values (60,'2006-01-17');
8608 insert into t5 values (60,'2006-01-17');
8609 insert into t6 values (60,'2006-01-17');
8610 select * from t1 order by col1;
8611 col1
8612 2006-01-17
8613 2006-02-06
8614 select * from t2 order by col1;
8615 col1
8616 2006-01-17
8617 2006-01-25
8618 2006-02-06
8619 select * from t3 order by col1;
8620 col1
8621 2006-01-17
8622 2006-01-25
8623 2006-02-06
8624 select * from t4 order by colint;
8625 colint  col1
8626 1       2006-02-06
8627 3       2006-01-25
8628 4       2006-02-05
8629 60      2006-01-17
8630 select * from t5 order by colint;
8631 colint  col1
8632 1       2006-02-06
8633 3       2006-01-25
8634 4       2006-02-05
8635 60      2006-01-17
8636 select * from t6 order by colint;
8637 colint  col1
8638 1       2006-02-06
8639 3       2006-01-25
8640 4       2006-02-05
8641 60      2006-01-17
8642 -------------------------------------------------------------------------
8643 ---  Delete rows and partitions of tables with datediff(col1, '2006-01-01')
8644 -------------------------------------------------------------------------
8645 delete from t11 where col1='2006-01-17';
8646 delete from t22 where col1='2006-01-17';
8647 delete from t33 where col1='2006-01-17';
8648 delete from t44 where col1='2006-01-17';
8649 delete from t55 where col1='2006-01-17';
8650 delete from t66 where col1='2006-01-17';
8651 select * from t11 order by col1;
8652 col1
8653 2006-02-06
8654 select * from t22 order by col1;
8655 col1
8656 2006-01-25
8657 2006-02-06
8658 select * from t33 order by col1;
8659 col1
8660 2006-01-25
8661 2006-02-06
8662 select * from t44 order by colint;
8663 colint  col1
8664 1       2006-02-06
8665 3       2006-01-25
8666 4       2006-02-05
8667 select * from t55 order by colint;
8668 colint  col1
8669 1       2006-02-06
8670 3       2006-01-25
8671 4       2006-02-05
8672 insert into t11 values ('2006-01-17');
8673 insert into t22 values ('2006-01-17');
8674 insert into t33 values ('2006-01-17');
8675 insert into t44 values (60,'2006-01-17');
8676 insert into t55 values (60,'2006-01-17');
8677 insert into t66 values (60,'2006-01-17');
8678 select * from t11 order by col1;
8679 col1
8680 2006-01-17
8681 2006-02-06
8682 select * from t22 order by col1;
8683 col1
8684 2006-01-17
8685 2006-01-25
8686 2006-02-06
8687 select * from t33 order by col1;
8688 col1
8689 2006-01-17
8690 2006-01-25
8691 2006-02-06
8692 select * from t44 order by colint;
8693 colint  col1
8694 1       2006-02-06
8695 3       2006-01-25
8696 4       2006-02-05
8697 60      2006-01-17
8698 select * from t55 order by colint;
8699 colint  col1
8700 1       2006-02-06
8701 3       2006-01-25
8702 4       2006-02-05
8703 60      2006-01-17
8704 select * from t66 order by colint;
8705 colint  col1
8706 1       2006-02-06
8707 3       2006-01-25
8708 4       2006-02-05
8709 60      2006-01-17
8710 -------------------------
8711 ---- some alter table end
8712 -------------------------
8713 drop table if exists t1 ;
8714 drop table if exists t2 ;
8715 drop table if exists t3 ;
8716 drop table if exists t4 ;
8717 drop table if exists t5 ;
8718 drop table if exists t6 ;
8719 drop table if exists t11 ;
8720 drop table if exists t22 ;
8721 drop table if exists t33 ;
8722 drop table if exists t44 ;
8723 drop table if exists t55 ;
8724 drop table if exists t66 ;
8725 -------------------------------------------------------------------------
8726 ---  weekday(col1)  in partition with coltype  date
8727 -------------------------------------------------------------------------
8728 drop table if exists t1 ;
8729 drop table if exists t2 ;
8730 drop table if exists t3 ;
8731 drop table if exists t4 ;
8732 drop table if exists t5 ;
8733 drop table if exists t6 ;
8734 -------------------------------------------------------------------------
8735 ---  Create tables with weekday(col1)
8736 -------------------------------------------------------------------------
8737 create table t1 (col1 date) engine='NDB' 
8738 partition by range(weekday(col1)) 
8739 (partition p0 values less than (15),
8740 partition p1 values less than maxvalue);
8741 create table t2 (col1 date) engine='NDB' 
8742 partition by list(weekday(col1)) 
8743 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
8744 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
8745 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
8746 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
8747 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
8748 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
8750 create table t3 (col1 date) engine='NDB' 
8751 partition by hash(weekday(col1));
8752 create table t4 (colint int, col1 date) engine='NDB' 
8753 partition by range(colint) 
8754 subpartition by hash(weekday(col1)) subpartitions 2 
8755 (partition p0 values less than (15),
8756 partition p1 values less than maxvalue);
8757 create table t5 (colint int, col1 date) engine='NDB' 
8758 partition by list(colint) 
8759 subpartition by hash(weekday(col1)) subpartitions 2 
8760 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15),
8761 partition p1 values in (16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
8762 partition p2 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45),
8763 partition p3 values in (46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
8765 create table t6 (colint int, col1 date) engine='NDB' 
8766 partition by range(colint) 
8767 (partition p0 values less than (weekday('2006-10-14')),
8768 partition p1 values less than maxvalue);
8769 -------------------------------------------------------------------------
8770 ---  Access tables with weekday(col1) 
8771 -------------------------------------------------------------------------
8772 insert into t1 values ('2006-12-03');
8773 insert into t1 values ('2006-11-17');
8774 insert into t2 values ('2006-12-03');
8775 insert into t2 values ('2006-11-17');
8776 insert into t2 values ('2006-05-25');
8777 insert into t3 values ('2006-12-03');
8778 insert into t3 values ('2006-11-17');
8779 insert into t3 values ('2006-05-25');
8780 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4;
8781 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5;
8782 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6;
8783 select weekday(col1) from t1 order by col1;
8784 weekday(col1)
8787 select * from t1 order by col1;
8788 col1
8789 2006-11-17
8790 2006-12-03
8791 select * from t2 order by col1;
8792 col1
8793 2006-05-25
8794 2006-11-17
8795 2006-12-03
8796 select * from t3 order by col1;
8797 col1
8798 2006-05-25
8799 2006-11-17
8800 2006-12-03
8801 select * from t4 order by colint;
8802 colint  col1
8803 1       2006-02-03
8804 2       2006-01-17
8805 3       2006-01-25
8806 4       2006-02-05
8807 select * from t5 order by colint;
8808 colint  col1
8809 1       2006-02-03
8810 2       2006-01-17
8811 3       2006-01-25
8812 4       2006-02-05
8813 select * from t6 order by colint;
8814 colint  col1
8815 1       2006-02-03
8816 2       2006-01-17
8817 3       2006-01-25
8818 4       2006-02-05
8819 update t1 set col1='2006-02-06' where col1='2006-12-03';
8820 update t2 set col1='2006-02-06' where col1='2006-12-03';
8821 update t3 set col1='2006-02-06' where col1='2006-12-03';
8822 update t4 set col1='2006-02-06' where col1='2006-12-03';
8823 update t5 set col1='2006-02-06' where col1='2006-12-03';
8824 update t6 set col1='2006-02-06' where col1='2006-12-03';
8825 select * from t1 order by col1;
8826 col1
8827 2006-02-06
8828 2006-11-17
8829 select * from t2 order by col1;
8830 col1
8831 2006-02-06
8832 2006-05-25
8833 2006-11-17
8834 select * from t3 order by col1;
8835 col1
8836 2006-02-06
8837 2006-05-25
8838 2006-11-17
8839 select * from t4 order by colint;
8840 colint  col1
8841 1       2006-02-03
8842 2       2006-01-17
8843 3       2006-01-25
8844 4       2006-02-05
8845 select * from t5 order by colint;
8846 colint  col1
8847 1       2006-02-03
8848 2       2006-01-17
8849 3       2006-01-25
8850 4       2006-02-05
8851 select * from t6 order by colint;
8852 colint  col1
8853 1       2006-02-03
8854 2       2006-01-17
8855 3       2006-01-25
8856 4       2006-02-05
8857 -------------------------------------------------------------------------
8858 ---  Alter tables with weekday(col1)
8859 -------------------------------------------------------------------------
8860 drop table if exists t11 ;
8861 drop table if exists t22 ;
8862 drop table if exists t33 ;
8863 drop table if exists t44 ;
8864 drop table if exists t55 ;
8865 drop table if exists t66 ;
8866 create table t11 engine='NDB' as select * from t1;
8867 create table t22 engine='NDB' as select * from t2;
8868 create table t33 engine='NDB' as select * from t3;
8869 create table t44 engine='NDB' as select * from t4;
8870 create table t55 engine='NDB' as select * from t5;
8871 create table t66 engine='NDB' as select * from t6;
8872 alter table t11
8873 partition by range(weekday(col1)) 
8874 (partition p0 values less than (15),
8875 partition p1 values less than maxvalue);
8876 alter table t22
8877 partition by list(weekday(col1)) 
8878 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
8879 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
8880 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
8881 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
8882 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
8883 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
8885 alter table t33
8886 partition by hash(weekday(col1));
8887 alter table t44
8888 partition by range(colint) 
8889 subpartition by hash(weekday(col1)) subpartitions 2 
8890 (partition p0 values less than (15),
8891 partition p1 values less than maxvalue);
8892 alter table t55
8893 partition by list(colint) 
8894 subpartition by hash(weekday(col1)) subpartitions 2 
8895 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15),
8896 partition p1 values in (16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
8897 partition p2 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45),
8898 partition p3 values in (46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
8900 alter table t66
8901 partition by range(colint) 
8902 (partition p0 values less than (weekday('2006-10-14')),
8903 partition p1 values less than maxvalue);
8904 select * from t11 order by col1;
8905 col1
8906 2006-02-06
8907 2006-11-17
8908 select * from t22 order by col1;
8909 col1
8910 2006-02-06
8911 2006-05-25
8912 2006-11-17
8913 select * from t33 order by col1;
8914 col1
8915 2006-02-06
8916 2006-05-25
8917 2006-11-17
8918 select * from t44 order by colint;
8919 colint  col1
8920 1       2006-02-03
8921 2       2006-01-17
8922 3       2006-01-25
8923 4       2006-02-05
8924 select * from t55 order by colint;
8925 colint  col1
8926 1       2006-02-03
8927 2       2006-01-17
8928 3       2006-01-25
8929 4       2006-02-05
8930 select * from t66 order by colint;
8931 colint  col1
8932 1       2006-02-03
8933 2       2006-01-17
8934 3       2006-01-25
8935 4       2006-02-05
8936 ---------------------------
8937 ---- some alter table begin
8938 ---------------------------
8939 alter table t55
8940 partition by list(colint) 
8941 subpartition by hash(weekday(col1)) subpartitions 4 
8942 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
8943 partition p1 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
8945 show create table t55;
8946 Table   Create Table
8947 t55     CREATE TABLE `t55` (
8948   `colint` int(11) DEFAULT NULL,
8949   `col1` date DEFAULT NULL
8950 ) ENGINE=ndbcluster DEFAULT CHARSET=latin1
8951 /*!50100 PARTITION BY LIST (colint)
8952 SUBPARTITION BY HASH (weekday(col1))
8953 SUBPARTITIONS 4
8954 (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30) ENGINE = ndbcluster,
8955  PARTITION p1 VALUES IN (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60) ENGINE = ndbcluster) */
8956 select * from t55 order by colint;
8957 colint  col1
8958 1       2006-02-03
8959 2       2006-01-17
8960 3       2006-01-25
8961 4       2006-02-05
8962 -------------------------------------------------------------------------
8963 ---  Delete rows and partitions of tables with weekday(col1)
8964 -------------------------------------------------------------------------
8965 delete from t1 where col1='2006-11-17';
8966 delete from t2 where col1='2006-11-17';
8967 delete from t3 where col1='2006-11-17';
8968 delete from t4 where col1='2006-11-17';
8969 delete from t5 where col1='2006-11-17';
8970 delete from t6 where col1='2006-11-17';
8971 select * from t1 order by col1;
8972 col1
8973 2006-02-06
8974 select * from t2 order by col1;
8975 col1
8976 2006-02-06
8977 2006-05-25
8978 select * from t3 order by col1;
8979 col1
8980 2006-02-06
8981 2006-05-25
8982 select * from t4 order by colint;
8983 colint  col1
8984 1       2006-02-03
8985 2       2006-01-17
8986 3       2006-01-25
8987 4       2006-02-05
8988 select * from t5 order by colint;
8989 colint  col1
8990 1       2006-02-03
8991 2       2006-01-17
8992 3       2006-01-25
8993 4       2006-02-05
8994 insert into t1 values ('2006-11-17');
8995 insert into t2 values ('2006-11-17');
8996 insert into t3 values ('2006-11-17');
8997 insert into t4 values (60,'2006-11-17');
8998 insert into t5 values (60,'2006-11-17');
8999 insert into t6 values (60,'2006-11-17');
9000 select * from t1 order by col1;
9001 col1
9002 2006-02-06
9003 2006-11-17
9004 select * from t2 order by col1;
9005 col1
9006 2006-02-06
9007 2006-05-25
9008 2006-11-17
9009 select * from t3 order by col1;
9010 col1
9011 2006-02-06
9012 2006-05-25
9013 2006-11-17
9014 select * from t4 order by colint;
9015 colint  col1
9016 1       2006-02-03
9017 2       2006-01-17
9018 3       2006-01-25
9019 4       2006-02-05
9020 60      2006-11-17
9021 select * from t5 order by colint;
9022 colint  col1
9023 1       2006-02-03
9024 2       2006-01-17
9025 3       2006-01-25
9026 4       2006-02-05
9027 60      2006-11-17
9028 select * from t6 order by colint;
9029 colint  col1
9030 1       2006-02-03
9031 2       2006-01-17
9032 3       2006-01-25
9033 4       2006-02-05
9034 60      2006-11-17
9035 -------------------------------------------------------------------------
9036 ---  Delete rows and partitions of tables with weekday(col1)
9037 -------------------------------------------------------------------------
9038 delete from t11 where col1='2006-11-17';
9039 delete from t22 where col1='2006-11-17';
9040 delete from t33 where col1='2006-11-17';
9041 delete from t44 where col1='2006-11-17';
9042 delete from t55 where col1='2006-11-17';
9043 delete from t66 where col1='2006-11-17';
9044 select * from t11 order by col1;
9045 col1
9046 2006-02-06
9047 select * from t22 order by col1;
9048 col1
9049 2006-02-06
9050 2006-05-25
9051 select * from t33 order by col1;
9052 col1
9053 2006-02-06
9054 2006-05-25
9055 select * from t44 order by colint;
9056 colint  col1
9057 1       2006-02-03
9058 2       2006-01-17
9059 3       2006-01-25
9060 4       2006-02-05
9061 select * from t55 order by colint;
9062 colint  col1
9063 1       2006-02-03
9064 2       2006-01-17
9065 3       2006-01-25
9066 4       2006-02-05
9067 insert into t11 values ('2006-11-17');
9068 insert into t22 values ('2006-11-17');
9069 insert into t33 values ('2006-11-17');
9070 insert into t44 values (60,'2006-11-17');
9071 insert into t55 values (60,'2006-11-17');
9072 insert into t66 values (60,'2006-11-17');
9073 select * from t11 order by col1;
9074 col1
9075 2006-02-06
9076 2006-11-17
9077 select * from t22 order by col1;
9078 col1
9079 2006-02-06
9080 2006-05-25
9081 2006-11-17
9082 select * from t33 order by col1;
9083 col1
9084 2006-02-06
9085 2006-05-25
9086 2006-11-17
9087 select * from t44 order by colint;
9088 colint  col1
9089 1       2006-02-03
9090 2       2006-01-17
9091 3       2006-01-25
9092 4       2006-02-05
9093 60      2006-11-17
9094 select * from t55 order by colint;
9095 colint  col1
9096 1       2006-02-03
9097 2       2006-01-17
9098 3       2006-01-25
9099 4       2006-02-05
9100 60      2006-11-17
9101 select * from t66 order by colint;
9102 colint  col1
9103 1       2006-02-03
9104 2       2006-01-17
9105 3       2006-01-25
9106 4       2006-02-05
9107 60      2006-11-17
9108 -------------------------
9109 ---- some alter table end
9110 -------------------------
9111 drop table if exists t1 ;
9112 drop table if exists t2 ;
9113 drop table if exists t3 ;
9114 drop table if exists t4 ;
9115 drop table if exists t5 ;
9116 drop table if exists t6 ;
9117 drop table if exists t11 ;
9118 drop table if exists t22 ;
9119 drop table if exists t33 ;
9120 drop table if exists t44 ;
9121 drop table if exists t55 ;
9122 drop table if exists t66 ;
9123 -------------------------------------------------------------------------
9124 ---  year(col1)-1990  in partition with coltype  date
9125 -------------------------------------------------------------------------
9126 drop table if exists t1 ;
9127 drop table if exists t2 ;
9128 drop table if exists t3 ;
9129 drop table if exists t4 ;
9130 drop table if exists t5 ;
9131 drop table if exists t6 ;
9132 -------------------------------------------------------------------------
9133 ---  Create tables with year(col1)-1990
9134 -------------------------------------------------------------------------
9135 create table t1 (col1 date) engine='NDB' 
9136 partition by range(year(col1)-1990) 
9137 (partition p0 values less than (15),
9138 partition p1 values less than maxvalue);
9139 create table t2 (col1 date) engine='NDB' 
9140 partition by list(year(col1)-1990) 
9141 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
9142 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
9143 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
9144 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
9145 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
9146 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
9148 create table t3 (col1 date) engine='NDB' 
9149 partition by hash(year(col1)-1990);
9150 create table t4 (colint int, col1 date) engine='NDB' 
9151 partition by range(colint) 
9152 subpartition by hash(year(col1)-1990) subpartitions 2 
9153 (partition p0 values less than (15),
9154 partition p1 values less than maxvalue);
9155 create table t5 (colint int, col1 date) engine='NDB' 
9156 partition by list(colint) 
9157 subpartition by hash(year(col1)-1990) subpartitions 2 
9158 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15),
9159 partition p1 values in (16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
9160 partition p2 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45),
9161 partition p3 values in (46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
9163 create table t6 (colint int, col1 date) engine='NDB' 
9164 partition by range(colint) 
9165 (partition p0 values less than (year('2005-10-14')-1990),
9166 partition p1 values less than maxvalue);
9167 -------------------------------------------------------------------------
9168 ---  Access tables with year(col1)-1990 
9169 -------------------------------------------------------------------------
9170 insert into t1 values ('1996-01-03');
9171 insert into t1 values ('2000-02-17');
9172 insert into t2 values ('1996-01-03');
9173 insert into t2 values ('2000-02-17');
9174 insert into t2 values ('2004-05-25');
9175 insert into t3 values ('1996-01-03');
9176 insert into t3 values ('2000-02-17');
9177 insert into t3 values ('2004-05-25');
9178 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4;
9179 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5;
9180 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6;
9181 select year(col1)-1990 from t1 order by col1;
9182 year(col1)-1990
9185 select * from t1 order by col1;
9186 col1
9187 1996-01-03
9188 2000-02-17
9189 select * from t2 order by col1;
9190 col1
9191 1996-01-03
9192 2000-02-17
9193 2004-05-25
9194 select * from t3 order by col1;
9195 col1
9196 1996-01-03
9197 2000-02-17
9198 2004-05-25
9199 select * from t4 order by colint;
9200 colint  col1
9201 1       2006-02-03
9202 2       2006-01-17
9203 3       2006-01-25
9204 4       2006-02-05
9205 select * from t5 order by colint;
9206 colint  col1
9207 1       2006-02-03
9208 2       2006-01-17
9209 3       2006-01-25
9210 4       2006-02-05
9211 select * from t6 order by colint;
9212 colint  col1
9213 1       2006-02-03
9214 2       2006-01-17
9215 3       2006-01-25
9216 4       2006-02-05
9217 update t1 set col1='2002-02-15' where col1='1996-01-03';
9218 update t2 set col1='2002-02-15' where col1='1996-01-03';
9219 update t3 set col1='2002-02-15' where col1='1996-01-03';
9220 update t4 set col1='2002-02-15' where col1='1996-01-03';
9221 update t5 set col1='2002-02-15' where col1='1996-01-03';
9222 update t6 set col1='2002-02-15' where col1='1996-01-03';
9223 select * from t1 order by col1;
9224 col1
9225 2000-02-17
9226 2002-02-15
9227 select * from t2 order by col1;
9228 col1
9229 2000-02-17
9230 2002-02-15
9231 2004-05-25
9232 select * from t3 order by col1;
9233 col1
9234 2000-02-17
9235 2002-02-15
9236 2004-05-25
9237 select * from t4 order by colint;
9238 colint  col1
9239 1       2006-02-03
9240 2       2006-01-17
9241 3       2006-01-25
9242 4       2006-02-05
9243 select * from t5 order by colint;
9244 colint  col1
9245 1       2006-02-03
9246 2       2006-01-17
9247 3       2006-01-25
9248 4       2006-02-05
9249 select * from t6 order by colint;
9250 colint  col1
9251 1       2006-02-03
9252 2       2006-01-17
9253 3       2006-01-25
9254 4       2006-02-05
9255 -------------------------------------------------------------------------
9256 ---  Alter tables with year(col1)-1990
9257 -------------------------------------------------------------------------
9258 drop table if exists t11 ;
9259 drop table if exists t22 ;
9260 drop table if exists t33 ;
9261 drop table if exists t44 ;
9262 drop table if exists t55 ;
9263 drop table if exists t66 ;
9264 create table t11 engine='NDB' as select * from t1;
9265 create table t22 engine='NDB' as select * from t2;
9266 create table t33 engine='NDB' as select * from t3;
9267 create table t44 engine='NDB' as select * from t4;
9268 create table t55 engine='NDB' as select * from t5;
9269 create table t66 engine='NDB' as select * from t6;
9270 alter table t11
9271 partition by range(year(col1)-1990) 
9272 (partition p0 values less than (15),
9273 partition p1 values less than maxvalue);
9274 alter table t22
9275 partition by list(year(col1)-1990) 
9276 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
9277 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
9278 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
9279 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
9280 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
9281 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
9283 alter table t33
9284 partition by hash(year(col1)-1990);
9285 alter table t44
9286 partition by range(colint) 
9287 subpartition by hash(year(col1)-1990) subpartitions 2 
9288 (partition p0 values less than (15),
9289 partition p1 values less than maxvalue);
9290 alter table t55
9291 partition by list(colint) 
9292 subpartition by hash(year(col1)-1990) subpartitions 2 
9293 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15),
9294 partition p1 values in (16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
9295 partition p2 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45),
9296 partition p3 values in (46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
9298 alter table t66
9299 partition by range(colint) 
9300 (partition p0 values less than (year('2005-10-14')-1990),
9301 partition p1 values less than maxvalue);
9302 select * from t11 order by col1;
9303 col1
9304 2000-02-17
9305 2002-02-15
9306 select * from t22 order by col1;
9307 col1
9308 2000-02-17
9309 2002-02-15
9310 2004-05-25
9311 select * from t33 order by col1;
9312 col1
9313 2000-02-17
9314 2002-02-15
9315 2004-05-25
9316 select * from t44 order by colint;
9317 colint  col1
9318 1       2006-02-03
9319 2       2006-01-17
9320 3       2006-01-25
9321 4       2006-02-05
9322 select * from t55 order by colint;
9323 colint  col1
9324 1       2006-02-03
9325 2       2006-01-17
9326 3       2006-01-25
9327 4       2006-02-05
9328 select * from t66 order by colint;
9329 colint  col1
9330 1       2006-02-03
9331 2       2006-01-17
9332 3       2006-01-25
9333 4       2006-02-05
9334 ---------------------------
9335 ---- some alter table begin
9336 ---------------------------
9337 alter table t55
9338 partition by list(colint) 
9339 subpartition by hash(year(col1)-1990) subpartitions 4 
9340 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
9341 partition p1 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
9343 show create table t55;
9344 Table   Create Table
9345 t55     CREATE TABLE `t55` (
9346   `colint` int(11) DEFAULT NULL,
9347   `col1` date DEFAULT NULL
9348 ) ENGINE=ndbcluster DEFAULT CHARSET=latin1
9349 /*!50100 PARTITION BY LIST (colint)
9350 SUBPARTITION BY HASH (year(col1)-1990)
9351 SUBPARTITIONS 4
9352 (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30) ENGINE = ndbcluster,
9353  PARTITION p1 VALUES IN (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60) ENGINE = ndbcluster) */
9354 select * from t55 order by colint;
9355 colint  col1
9356 1       2006-02-03
9357 2       2006-01-17
9358 3       2006-01-25
9359 4       2006-02-05
9360 -------------------------------------------------------------------------
9361 ---  Delete rows and partitions of tables with year(col1)-1990
9362 -------------------------------------------------------------------------
9363 delete from t1 where col1='2000-02-17';
9364 delete from t2 where col1='2000-02-17';
9365 delete from t3 where col1='2000-02-17';
9366 delete from t4 where col1='2000-02-17';
9367 delete from t5 where col1='2000-02-17';
9368 delete from t6 where col1='2000-02-17';
9369 select * from t1 order by col1;
9370 col1
9371 2002-02-15
9372 select * from t2 order by col1;
9373 col1
9374 2002-02-15
9375 2004-05-25
9376 select * from t3 order by col1;
9377 col1
9378 2002-02-15
9379 2004-05-25
9380 select * from t4 order by colint;
9381 colint  col1
9382 1       2006-02-03
9383 2       2006-01-17
9384 3       2006-01-25
9385 4       2006-02-05
9386 select * from t5 order by colint;
9387 colint  col1
9388 1       2006-02-03
9389 2       2006-01-17
9390 3       2006-01-25
9391 4       2006-02-05
9392 insert into t1 values ('2000-02-17');
9393 insert into t2 values ('2000-02-17');
9394 insert into t3 values ('2000-02-17');
9395 insert into t4 values (60,'2000-02-17');
9396 insert into t5 values (60,'2000-02-17');
9397 insert into t6 values (60,'2000-02-17');
9398 select * from t1 order by col1;
9399 col1
9400 2000-02-17
9401 2002-02-15
9402 select * from t2 order by col1;
9403 col1
9404 2000-02-17
9405 2002-02-15
9406 2004-05-25
9407 select * from t3 order by col1;
9408 col1
9409 2000-02-17
9410 2002-02-15
9411 2004-05-25
9412 select * from t4 order by colint;
9413 colint  col1
9414 1       2006-02-03
9415 2       2006-01-17
9416 3       2006-01-25
9417 4       2006-02-05
9418 60      2000-02-17
9419 select * from t5 order by colint;
9420 colint  col1
9421 1       2006-02-03
9422 2       2006-01-17
9423 3       2006-01-25
9424 4       2006-02-05
9425 60      2000-02-17
9426 select * from t6 order by colint;
9427 colint  col1
9428 1       2006-02-03
9429 2       2006-01-17
9430 3       2006-01-25
9431 4       2006-02-05
9432 60      2000-02-17
9433 -------------------------------------------------------------------------
9434 ---  Delete rows and partitions of tables with year(col1)-1990
9435 -------------------------------------------------------------------------
9436 delete from t11 where col1='2000-02-17';
9437 delete from t22 where col1='2000-02-17';
9438 delete from t33 where col1='2000-02-17';
9439 delete from t44 where col1='2000-02-17';
9440 delete from t55 where col1='2000-02-17';
9441 delete from t66 where col1='2000-02-17';
9442 select * from t11 order by col1;
9443 col1
9444 2002-02-15
9445 select * from t22 order by col1;
9446 col1
9447 2002-02-15
9448 2004-05-25
9449 select * from t33 order by col1;
9450 col1
9451 2002-02-15
9452 2004-05-25
9453 select * from t44 order by colint;
9454 colint  col1
9455 1       2006-02-03
9456 2       2006-01-17
9457 3       2006-01-25
9458 4       2006-02-05
9459 select * from t55 order by colint;
9460 colint  col1
9461 1       2006-02-03
9462 2       2006-01-17
9463 3       2006-01-25
9464 4       2006-02-05
9465 insert into t11 values ('2000-02-17');
9466 insert into t22 values ('2000-02-17');
9467 insert into t33 values ('2000-02-17');
9468 insert into t44 values (60,'2000-02-17');
9469 insert into t55 values (60,'2000-02-17');
9470 insert into t66 values (60,'2000-02-17');
9471 select * from t11 order by col1;
9472 col1
9473 2000-02-17
9474 2002-02-15
9475 select * from t22 order by col1;
9476 col1
9477 2000-02-17
9478 2002-02-15
9479 2004-05-25
9480 select * from t33 order by col1;
9481 col1
9482 2000-02-17
9483 2002-02-15
9484 2004-05-25
9485 select * from t44 order by colint;
9486 colint  col1
9487 1       2006-02-03
9488 2       2006-01-17
9489 3       2006-01-25
9490 4       2006-02-05
9491 60      2000-02-17
9492 select * from t55 order by colint;
9493 colint  col1
9494 1       2006-02-03
9495 2       2006-01-17
9496 3       2006-01-25
9497 4       2006-02-05
9498 60      2000-02-17
9499 select * from t66 order by colint;
9500 colint  col1
9501 1       2006-02-03
9502 2       2006-01-17
9503 3       2006-01-25
9504 4       2006-02-05
9505 60      2000-02-17
9506 -------------------------
9507 ---- some alter table end
9508 -------------------------
9509 drop table if exists t1 ;
9510 drop table if exists t2 ;
9511 drop table if exists t3 ;
9512 drop table if exists t4 ;
9513 drop table if exists t5 ;
9514 drop table if exists t6 ;
9515 drop table if exists t11 ;
9516 drop table if exists t22 ;
9517 drop table if exists t33 ;
9518 drop table if exists t44 ;
9519 drop table if exists t55 ;
9520 drop table if exists t66 ;
9521 -------------------------------------------------------------------------
9522 ---  yearweek(col1)-200600  in partition with coltype  date
9523 -------------------------------------------------------------------------
9524 drop table if exists t1 ;
9525 drop table if exists t2 ;
9526 drop table if exists t3 ;
9527 drop table if exists t4 ;
9528 drop table if exists t5 ;
9529 drop table if exists t6 ;
9530 -------------------------------------------------------------------------
9531 ---  Create tables with yearweek(col1)-200600
9532 -------------------------------------------------------------------------
9533 create table t1 (col1 date) engine='NDB' 
9534 partition by range(yearweek(col1)-200600) 
9535 (partition p0 values less than (15),
9536 partition p1 values less than maxvalue);
9537 create table t2 (col1 date) engine='NDB' 
9538 partition by list(yearweek(col1)-200600) 
9539 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
9540 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
9541 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
9542 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
9543 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
9544 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
9546 create table t3 (col1 date) engine='NDB' 
9547 partition by hash(yearweek(col1)-200600);
9548 create table t4 (colint int, col1 date) engine='NDB' 
9549 partition by range(colint) 
9550 subpartition by hash(yearweek(col1)-200600) subpartitions 2 
9551 (partition p0 values less than (15),
9552 partition p1 values less than maxvalue);
9553 create table t5 (colint int, col1 date) engine='NDB' 
9554 partition by list(colint) 
9555 subpartition by hash(yearweek(col1)-200600) subpartitions 2 
9556 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15),
9557 partition p1 values in (16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
9558 partition p2 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45),
9559 partition p3 values in (46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
9561 create table t6 (colint int, col1 date) engine='NDB' 
9562 partition by range(colint) 
9563 (partition p0 values less than (yearweek('2006-10-14')-200600),
9564 partition p1 values less than maxvalue);
9565 -------------------------------------------------------------------------
9566 ---  Access tables with yearweek(col1)-200600 
9567 -------------------------------------------------------------------------
9568 insert into t1 values ('2006-01-03');
9569 insert into t1 values ('2006-08-17');
9570 insert into t2 values ('2006-01-03');
9571 insert into t2 values ('2006-08-17');
9572 insert into t2 values ('2006-03-25');
9573 insert into t3 values ('2006-01-03');
9574 insert into t3 values ('2006-08-17');
9575 insert into t3 values ('2006-03-25');
9576 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4;
9577 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5;
9578 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6;
9579 select yearweek(col1)-200600 from t1 order by col1;
9580 yearweek(col1)-200600
9583 select * from t1 order by col1;
9584 col1
9585 2006-01-03
9586 2006-08-17
9587 select * from t2 order by col1;
9588 col1
9589 2006-01-03
9590 2006-03-25
9591 2006-08-17
9592 select * from t3 order by col1;
9593 col1
9594 2006-01-03
9595 2006-03-25
9596 2006-08-17
9597 select * from t4 order by colint;
9598 colint  col1
9599 1       2006-02-03
9600 2       2006-01-17
9601 3       2006-01-25
9602 4       2006-02-05
9603 select * from t5 order by colint;
9604 colint  col1
9605 1       2006-02-03
9606 2       2006-01-17
9607 3       2006-01-25
9608 4       2006-02-05
9609 select * from t6 order by colint;
9610 colint  col1
9611 1       2006-02-03
9612 2       2006-01-17
9613 3       2006-01-25
9614 4       2006-02-05
9615 update t1 set col1='2006-11-15' where col1='2006-01-03';
9616 update t2 set col1='2006-11-15' where col1='2006-01-03';
9617 update t3 set col1='2006-11-15' where col1='2006-01-03';
9618 update t4 set col1='2006-11-15' where col1='2006-01-03';
9619 update t5 set col1='2006-11-15' where col1='2006-01-03';
9620 update t6 set col1='2006-11-15' where col1='2006-01-03';
9621 select * from t1 order by col1;
9622 col1
9623 2006-08-17
9624 2006-11-15
9625 select * from t2 order by col1;
9626 col1
9627 2006-03-25
9628 2006-08-17
9629 2006-11-15
9630 select * from t3 order by col1;
9631 col1
9632 2006-03-25
9633 2006-08-17
9634 2006-11-15
9635 select * from t4 order by colint;
9636 colint  col1
9637 1       2006-02-03
9638 2       2006-01-17
9639 3       2006-01-25
9640 4       2006-02-05
9641 select * from t5 order by colint;
9642 colint  col1
9643 1       2006-02-03
9644 2       2006-01-17
9645 3       2006-01-25
9646 4       2006-02-05
9647 select * from t6 order by colint;
9648 colint  col1
9649 1       2006-02-03
9650 2       2006-01-17
9651 3       2006-01-25
9652 4       2006-02-05
9653 -------------------------------------------------------------------------
9654 ---  Alter tables with yearweek(col1)-200600
9655 -------------------------------------------------------------------------
9656 drop table if exists t11 ;
9657 drop table if exists t22 ;
9658 drop table if exists t33 ;
9659 drop table if exists t44 ;
9660 drop table if exists t55 ;
9661 drop table if exists t66 ;
9662 create table t11 engine='NDB' as select * from t1;
9663 create table t22 engine='NDB' as select * from t2;
9664 create table t33 engine='NDB' as select * from t3;
9665 create table t44 engine='NDB' as select * from t4;
9666 create table t55 engine='NDB' as select * from t5;
9667 create table t66 engine='NDB' as select * from t6;
9668 alter table t11
9669 partition by range(yearweek(col1)-200600) 
9670 (partition p0 values less than (15),
9671 partition p1 values less than maxvalue);
9672 alter table t22
9673 partition by list(yearweek(col1)-200600) 
9674 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
9675 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
9676 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
9677 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
9678 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
9679 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
9681 alter table t33
9682 partition by hash(yearweek(col1)-200600);
9683 alter table t44
9684 partition by range(colint) 
9685 subpartition by hash(yearweek(col1)-200600) subpartitions 2 
9686 (partition p0 values less than (15),
9687 partition p1 values less than maxvalue);
9688 alter table t55
9689 partition by list(colint) 
9690 subpartition by hash(yearweek(col1)-200600) subpartitions 2 
9691 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15),
9692 partition p1 values in (16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
9693 partition p2 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45),
9694 partition p3 values in (46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
9696 alter table t66
9697 partition by range(colint) 
9698 (partition p0 values less than (yearweek('2006-10-14')-200600),
9699 partition p1 values less than maxvalue);
9700 select * from t11 order by col1;
9701 col1
9702 2006-08-17
9703 2006-11-15
9704 select * from t22 order by col1;
9705 col1
9706 2006-03-25
9707 2006-08-17
9708 2006-11-15
9709 select * from t33 order by col1;
9710 col1
9711 2006-03-25
9712 2006-08-17
9713 2006-11-15
9714 select * from t44 order by colint;
9715 colint  col1
9716 1       2006-02-03
9717 2       2006-01-17
9718 3       2006-01-25
9719 4       2006-02-05
9720 select * from t55 order by colint;
9721 colint  col1
9722 1       2006-02-03
9723 2       2006-01-17
9724 3       2006-01-25
9725 4       2006-02-05
9726 select * from t66 order by colint;
9727 colint  col1
9728 1       2006-02-03
9729 2       2006-01-17
9730 3       2006-01-25
9731 4       2006-02-05
9732 ---------------------------
9733 ---- some alter table begin
9734 ---------------------------
9735 alter table t55
9736 partition by list(colint) 
9737 subpartition by hash(yearweek(col1)-200600) subpartitions 4 
9738 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30),
9739 partition p1 values in (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
9741 show create table t55;
9742 Table   Create Table
9743 t55     CREATE TABLE `t55` (
9744   `colint` int(11) DEFAULT NULL,
9745   `col1` date DEFAULT NULL
9746 ) ENGINE=ndbcluster DEFAULT CHARSET=latin1
9747 /*!50100 PARTITION BY LIST (colint)
9748 SUBPARTITION BY HASH (yearweek(col1)-200600)
9749 SUBPARTITIONS 4
9750 (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30) ENGINE = ndbcluster,
9751  PARTITION p1 VALUES IN (31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60) ENGINE = ndbcluster) */
9752 select * from t55 order by colint;
9753 colint  col1
9754 1       2006-02-03
9755 2       2006-01-17
9756 3       2006-01-25
9757 4       2006-02-05
9758 -------------------------------------------------------------------------
9759 ---  Delete rows and partitions of tables with yearweek(col1)-200600
9760 -------------------------------------------------------------------------
9761 delete from t1 where col1='2006-08-17';
9762 delete from t2 where col1='2006-08-17';
9763 delete from t3 where col1='2006-08-17';
9764 delete from t4 where col1='2006-08-17';
9765 delete from t5 where col1='2006-08-17';
9766 delete from t6 where col1='2006-08-17';
9767 select * from t1 order by col1;
9768 col1
9769 2006-11-15
9770 select * from t2 order by col1;
9771 col1
9772 2006-03-25
9773 2006-11-15
9774 select * from t3 order by col1;
9775 col1
9776 2006-03-25
9777 2006-11-15
9778 select * from t4 order by colint;
9779 colint  col1
9780 1       2006-02-03
9781 2       2006-01-17
9782 3       2006-01-25
9783 4       2006-02-05
9784 select * from t5 order by colint;
9785 colint  col1
9786 1       2006-02-03
9787 2       2006-01-17
9788 3       2006-01-25
9789 4       2006-02-05
9790 insert into t1 values ('2006-08-17');
9791 insert into t2 values ('2006-08-17');
9792 insert into t3 values ('2006-08-17');
9793 insert into t4 values (60,'2006-08-17');
9794 insert into t5 values (60,'2006-08-17');
9795 insert into t6 values (60,'2006-08-17');
9796 select * from t1 order by col1;
9797 col1
9798 2006-08-17
9799 2006-11-15
9800 select * from t2 order by col1;
9801 col1
9802 2006-03-25
9803 2006-08-17
9804 2006-11-15
9805 select * from t3 order by col1;
9806 col1
9807 2006-03-25
9808 2006-08-17
9809 2006-11-15
9810 select * from t4 order by colint;
9811 colint  col1
9812 1       2006-02-03
9813 2       2006-01-17
9814 3       2006-01-25
9815 4       2006-02-05
9816 60      2006-08-17
9817 select * from t5 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 60      2006-08-17
9824 select * from t6 order by colint;
9825 colint  col1
9826 1       2006-02-03
9827 2       2006-01-17
9828 3       2006-01-25
9829 4       2006-02-05
9830 60      2006-08-17
9831 -------------------------------------------------------------------------
9832 ---  Delete rows and partitions of tables with yearweek(col1)-200600
9833 -------------------------------------------------------------------------
9834 delete from t11 where col1='2006-08-17';
9835 delete from t22 where col1='2006-08-17';
9836 delete from t33 where col1='2006-08-17';
9837 delete from t44 where col1='2006-08-17';
9838 delete from t55 where col1='2006-08-17';
9839 delete from t66 where col1='2006-08-17';
9840 select * from t11 order by col1;
9841 col1
9842 2006-11-15
9843 select * from t22 order by col1;
9844 col1
9845 2006-03-25
9846 2006-11-15
9847 select * from t33 order by col1;
9848 col1
9849 2006-03-25
9850 2006-11-15
9851 select * from t44 order by colint;
9852 colint  col1
9853 1       2006-02-03
9854 2       2006-01-17
9855 3       2006-01-25
9856 4       2006-02-05
9857 select * from t55 order by colint;
9858 colint  col1
9859 1       2006-02-03
9860 2       2006-01-17
9861 3       2006-01-25
9862 4       2006-02-05
9863 insert into t11 values ('2006-08-17');
9864 insert into t22 values ('2006-08-17');
9865 insert into t33 values ('2006-08-17');
9866 insert into t44 values (60,'2006-08-17');
9867 insert into t55 values (60,'2006-08-17');
9868 insert into t66 values (60,'2006-08-17');
9869 select * from t11 order by col1;
9870 col1
9871 2006-08-17
9872 2006-11-15
9873 select * from t22 order by col1;
9874 col1
9875 2006-03-25
9876 2006-08-17
9877 2006-11-15
9878 select * from t33 order by col1;
9879 col1
9880 2006-03-25
9881 2006-08-17
9882 2006-11-15
9883 select * from t44 order by colint;
9884 colint  col1
9885 1       2006-02-03
9886 2       2006-01-17
9887 3       2006-01-25
9888 4       2006-02-05
9889 60      2006-08-17
9890 select * from t55 order by colint;
9891 colint  col1
9892 1       2006-02-03
9893 2       2006-01-17
9894 3       2006-01-25
9895 4       2006-02-05
9896 60      2006-08-17
9897 select * from t66 order by colint;
9898 colint  col1
9899 1       2006-02-03
9900 2       2006-01-17
9901 3       2006-01-25
9902 4       2006-02-05
9903 60      2006-08-17
9904 -------------------------
9905 ---- some alter table end
9906 -------------------------
9907 drop table if exists t1 ;
9908 drop table if exists t2 ;
9909 drop table if exists t3 ;
9910 drop table if exists t4 ;
9911 drop table if exists t5 ;
9912 drop table if exists t6 ;
9913 drop table if exists t11 ;
9914 drop table if exists t22 ;
9915 drop table if exists t33 ;
9916 drop table if exists t44 ;
9917 drop table if exists t55 ;
9918 drop table if exists t66 ;