Debian Codegraph @

mysql-test/suite/parts/r/part_supported_sql_func_innodb.result

raw
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='INNODB'
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='INNODB'
18 partition by list(abs(col1))
19 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
20 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
21 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
22 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
23 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
24 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
25 );
26 create table t3 (col1 int) engine='INNODB'
27 partition by hash(abs(col1));
28 create table t4 (colint int, col1 int) engine='INNODB'
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='INNODB'
34 partition by list(colint)
35 subpartition by hash(abs(col1)) subpartitions 2
36 (partition p0 values in (1,2,3,4,5,6,7,8,9,10),
37 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
38 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
39 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
40 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
41 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
42 );
43 create table t6 (colint int, col1 int) engine='INNODB'
44 partition by range(colint)
45 (partition p0 values less than (abs(15)),
46 partition p1 values less than maxvalue);
47 -------------------------------------------------------------------------
48 --- Access tables with abs(col1)
49 -------------------------------------------------------------------------
50 begin;
51 insert into t1 values (5 );
52 insert into t1 values (13 );
53 insert into t2 values (5 );
54 insert into t2 values (13 );
55 insert into t2 values (17 );
56 insert into t3 values (5 );
57 insert into t3 values (13 );
58 insert into t3 values (17 );
59 commit;
60 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_int.inc' into table t4;
61 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_int.inc' into table t5;
62 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_int.inc' into table t6;
63 select abs(col1) from t1 order by col1;
64 abs(col1)
65 5
66 13
67 select * from t1 order by col1;
68 col1
69 5
70 13
71 select * from t2 order by col1;
72 col1
73 5
74 13
75 17
76 select * from t3 order by col1;
77 col1
78 5
79 13
80 17
81 select * from t4 order by colint;
82 colint col1
83 1 5
84 2 13
85 3 15
86 4 17
87 5 23
88 6 34
89 7 56
90 8 56
91 9 45
92 10 34
93 11 78
94 12 89
95 13 67
96 14 46
97 15 34
98 16 324
99 17 345
100 18 34
101 19 78
102 20 567
103 21 4
104 22 435
105 23 34
106 24 45
107 25 4565
108 26 4
109 27 3
110 28 2
111 29 3
112 30 5
113 31 6
114 32 8
115 33 9
116 34 745
117 35 34
118 36 34
119 37 324
120 38 67
121 39 78
122 40 89
123 41 90
124 42 78967
125 50 56
126 51 34
127 55 123
128 select * from t5 order by colint;
129 colint col1
130 1 5
131 2 13
132 3 15
133 4 17
134 5 23
135 6 34
136 7 56
137 8 56
138 9 45
139 10 34
140 11 78
141 12 89
142 13 67
143 14 46
144 15 34
145 16 324
146 17 345
147 18 34
148 19 78
149 20 567
150 21 4
151 22 435
152 23 34
153 24 45
154 25 4565
155 26 4
156 27 3
157 28 2
158 29 3
159 30 5
160 31 6
161 32 8
162 33 9
163 34 745
164 35 34
165 36 34
166 37 324
167 38 67
168 39 78
169 40 89
170 41 90
171 42 78967
172 50 56
173 51 34
174 55 123
175 select * from t6 order by colint;
176 colint col1
177 1 5
178 2 13
179 3 15
180 4 17
181 5 23
182 6 34
183 7 56
184 8 56
185 9 45
186 10 34
187 11 78
188 12 89
189 13 67
190 14 46
191 15 34
192 16 324
193 17 345
194 18 34
195 19 78
196 20 567
197 21 4
198 22 435
199 23 34
200 24 45
201 25 4565
202 26 4
203 27 3
204 28 2
205 29 3
206 30 5
207 31 6
208 32 8
209 33 9
210 34 745
211 35 34
212 36 34
213 37 324
214 38 67
215 39 78
216 40 89
217 41 90
218 42 78967
219 50 56
220 51 34
221 55 123
222 begin;
223 update t1 set col1=15 where col1=5 ;
224 update t2 set col1=15 where col1=5 ;
225 update t3 set col1=15 where col1=5 ;
226 update t4 set col1=15 where col1=5 ;
227 update t5 set col1=15 where col1=5 ;
228 update t6 set col1=15 where col1=5 ;
229 commit;
230 select * from t1 order by col1;
231 col1
232 13
233 15
234 select * from t2 order by col1;
235 col1
236 13
237 15
238 17
239 select * from t3 order by col1;
240 col1
241 13
242 15
243 17
244 select * from t4 order by colint;
245 colint col1
246 1 15
247 2 13
248 3 15
249 4 17
250 5 23
251 6 34
252 7 56
253 8 56
254 9 45
255 10 34
256 11 78
257 12 89
258 13 67
259 14 46
260 15 34
261 16 324
262 17 345
263 18 34
264 19 78
265 20 567
266 21 4
267 22 435
268 23 34
269 24 45
270 25 4565
271 26 4
272 27 3
273 28 2
274 29 3
275 30 15
276 31 6
277 32 8
278 33 9
279 34 745
280 35 34
281 36 34
282 37 324
283 38 67
284 39 78
285 40 89
286 41 90
287 42 78967
288 50 56
289 51 34
290 55 123
291 select * from t5 order by colint;
292 colint col1
293 1 15
294 2 13
295 3 15
296 4 17
297 5 23
298 6 34
299 7 56
300 8 56
301 9 45
302 10 34
303 11 78
304 12 89
305 13 67
306 14 46
307 15 34
308 16 324
309 17 345
310 18 34
311 19 78
312 20 567
313 21 4
314 22 435
315 23 34
316 24 45
317 25 4565
318 26 4
319 27 3
320 28 2
321 29 3
322 30 15
323 31 6
324 32 8
325 33 9
326 34 745
327 35 34
328 36 34
329 37 324
330 38 67
331 39 78
332 40 89
333 41 90
334 42 78967
335 50 56
336 51 34
337 55 123
338 select * from t6 order by colint;
339 colint col1
340 1 15
341 2 13
342 3 15
343 4 17
344 5 23
345 6 34
346 7 56
347 8 56
348 9 45
349 10 34
350 11 78
351 12 89
352 13 67
353 14 46
354 15 34
355 16 324
356 17 345
357 18 34
358 19 78
359 20 567
360 21 4
361 22 435
362 23 34
363 24 45
364 25 4565
365 26 4
366 27 3
367 28 2
368 29 3
369 30 15
370 31 6
371 32 8
372 33 9
373 34 745
374 35 34
375 36 34
376 37 324
377 38 67
378 39 78
379 40 89
380 41 90
381 42 78967
382 50 56
383 51 34
384 55 123
385 -------------------------------------------------------------------------
386 --- Alter tables with abs(col1)
387 -------------------------------------------------------------------------
388 drop table if exists t11 ;
389 drop table if exists t22 ;
390 drop table if exists t33 ;
391 drop table if exists t44 ;
392 drop table if exists t55 ;
393 drop table if exists t66 ;
394 create table t11 engine='INNODB' as select * from t1;
395 create table t22 engine='INNODB' as select * from t2;
396 create table t33 engine='INNODB' as select * from t3;
397 create table t44 engine='INNODB' as select * from t4;
398 create table t55 engine='INNODB' as select * from t5;
399 create table t66 engine='INNODB' as select * from t6;
400 alter table t11
401 partition by range(abs(col1))
402 (partition p0 values less than (15),
403 partition p1 values less than maxvalue);
404 alter table t22
405 partition by list(abs(col1))
406 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
407 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
408 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
409 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
410 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
411 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
412 );
413 alter table t33
414 partition by hash(abs(col1));
415 alter table t44
416 partition by range(colint)
417 subpartition by hash(abs(col1)) subpartitions 2
418 (partition p0 values less than (15),
419 partition p1 values less than maxvalue);
420 alter table t55
421 partition by list(colint)
422 subpartition by hash(abs(col1)) subpartitions 2
423 (partition p0 values in (1,2,3,4,5,6,7,8,9,10),
424 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
425 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
426 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
427 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
428 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
429 );
430 alter table t66
431 partition by range(colint)
432 (partition p0 values less than (abs(15)),
433 partition p1 values less than maxvalue);
434 select * from t11 order by col1;
435 col1
436 13
437 15
438 select * from t22 order by col1;
439 col1
440 13
441 15
442 17
443 select * from t33 order by col1;
444 col1
445 13
446 15
447 17
448 select * from t44 order by colint;
449 colint col1
450 1 15
451 2 13
452 3 15
453 4 17
454 5 23
455 6 34
456 7 56
457 8 56
458 9 45
459 10 34
460 11 78
461 12 89
462 13 67
463 14 46
464 15 34
465 16 324
466 17 345
467 18 34
468 19 78
469 20 567
470 21 4
471 22 435
472 23 34
473 24 45
474 25 4565
475 26 4
476 27 3
477 28 2
478 29 3
479 30 15
480 31 6
481 32 8
482 33 9
483 34 745
484 35 34
485 36 34
486 37 324
487 38 67
488 39 78
489 40 89
490 41 90
491 42 78967
492 50 56
493 51 34
494 55 123
495 select * from t55 order by colint;
496 colint col1
497 1 15
498 2 13
499 3 15
500 4 17
501 5 23
502 6 34
503 7 56
504 8 56
505 9 45
506 10 34
507 11 78
508 12 89
509 13 67
510 14 46
511 15 34
512 16 324
513 17 345
514 18 34
515 19 78
516 20 567
517 21 4
518 22 435
519 23 34
520 24 45
521 25 4565
522 26 4
523 27 3
524 28 2
525 29 3
526 30 15
527 31 6
528 32 8
529 33 9
530 34 745
531 35 34
532 36 34
533 37 324
534 38 67
535 39 78
536 40 89
537 41 90
538 42 78967
539 50 56
540 51 34
541 55 123
542 select * from t66 order by colint;
543 colint col1
544 1 15
545 2 13
546 3 15
547 4 17
548 5 23
549 6 34
550 7 56
551 8 56
552 9 45
553 10 34
554 11 78
555 12 89
556 13 67
557 14 46
558 15 34
559 16 324
560 17 345
561 18 34
562 19 78
563 20 567
564 21 4
565 22 435
566 23 34
567 24 45
568 25 4565
569 26 4
570 27 3
571 28 2
572 29 3
573 30 15
574 31 6
575 32 8
576 33 9
577 34 745
578 35 34
579 36 34
580 37 324
581 38 67
582 39 78
583 40 89
584 41 90
585 42 78967
586 50 56
587 51 34
588 55 123
589 ---------------------------
590 ---- some alter table begin
591 ---------------------------
592 alter table t11
593 reorganize partition p0,p1 into
594 (partition s1 values less than maxvalue);
595 select * from t11 order by col1;
596 col1
597 13
598 15
599 alter table t11
600 reorganize partition s1 into
601 (partition p0 values less than (15),
602 partition p1 values less than maxvalue);
603 select * from t11 order by col1;
604 col1
605 13
606 15
607 alter table t55
608 partition by list(colint)
609 subpartition by hash(abs(col1)) subpartitions 5
610 (partition p0 values in (1,2,3,4,5,6,7,8,9,10),
611 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
612 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
613 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
614 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
615 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
616 );
617 show create table t55;
618 Table Create Table
619 t55 CREATE TABLE `t55` (
620 `colint` int(11) DEFAULT NULL,
621 `col1` int(11) DEFAULT NULL
622 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
623 PARTITION BY LIST (`colint`)
624 SUBPARTITION BY HASH (abs(`col1`))
625 SUBPARTITIONS 5
626 (PARTITION `p0` VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB,
627 PARTITION `p1` VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB,
628 PARTITION `p2` VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB,
629 PARTITION `p3` VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB,
630 PARTITION `p4` VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB,
631 PARTITION `p5` VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB)
632 select * from t55 order by colint;
633 colint col1
634 1 15
635 2 13
636 3 15
637 4 17
638 5 23
639 6 34
640 7 56
641 8 56
642 9 45
643 10 34
644 11 78
645 12 89
646 13 67
647 14 46
648 15 34
649 16 324
650 17 345
651 18 34
652 19 78
653 20 567
654 21 4
655 22 435
656 23 34
657 24 45
658 25 4565
659 26 4
660 27 3
661 28 2
662 29 3
663 30 15
664 31 6
665 32 8
666 33 9
667 34 745
668 35 34
669 36 34
670 37 324
671 38 67
672 39 78
673 40 89
674 41 90
675 42 78967
676 50 56
677 51 34
678 55 123
679 alter table t66
680 reorganize partition p0,p1 into
681 (partition s1 values less than maxvalue);
682 select * from t66 order by colint;
683 colint col1
684 1 15
685 2 13
686 3 15
687 4 17
688 5 23
689 6 34
690 7 56
691 8 56
692 9 45
693 10 34
694 11 78
695 12 89
696 13 67
697 14 46
698 15 34
699 16 324
700 17 345
701 18 34
702 19 78
703 20 567
704 21 4
705 22 435
706 23 34
707 24 45
708 25 4565
709 26 4
710 27 3
711 28 2
712 29 3
713 30 15
714 31 6
715 32 8
716 33 9
717 34 745
718 35 34
719 36 34
720 37 324
721 38 67
722 39 78
723 40 89
724 41 90
725 42 78967
726 50 56
727 51 34
728 55 123
729 alter table t66
730 reorganize partition s1 into
731 (partition p0 values less than (abs(15)),
732 partition p1 values less than maxvalue);
733 select * from t66 order by colint;
734 colint col1
735 1 15
736 2 13
737 3 15
738 4 17
739 5 23
740 6 34
741 7 56
742 8 56
743 9 45
744 10 34
745 11 78
746 12 89
747 13 67
748 14 46
749 15 34
750 16 324
751 17 345
752 18 34
753 19 78
754 20 567
755 21 4
756 22 435
757 23 34
758 24 45
759 25 4565
760 26 4
761 27 3
762 28 2
763 29 3
764 30 15
765 31 6
766 32 8
767 33 9
768 34 745
769 35 34
770 36 34
771 37 324
772 38 67
773 39 78
774 40 89
775 41 90
776 42 78967
777 50 56
778 51 34
779 55 123
780 alter table t66
781 reorganize partition p0,p1 into
782 (partition s1 values less than maxvalue);
783 select * from t66 order by colint;
784 colint col1
785 1 15
786 2 13
787 3 15
788 4 17
789 5 23
790 6 34
791 7 56
792 8 56
793 9 45
794 10 34
795 11 78
796 12 89
797 13 67
798 14 46
799 15 34
800 16 324
801 17 345
802 18 34
803 19 78
804 20 567
805 21 4
806 22 435
807 23 34
808 24 45
809 25 4565
810 26 4
811 27 3
812 28 2
813 29 3
814 30 15
815 31 6
816 32 8
817 33 9
818 34 745
819 35 34
820 36 34
821 37 324
822 38 67
823 39 78
824 40 89
825 41 90
826 42 78967
827 50 56
828 51 34
829 55 123
830 alter table t66
831 reorganize partition s1 into
832 (partition p0 values less than (abs(15)),
833 partition p1 values less than maxvalue);
834 select * from t66 order by colint;
835 colint col1
836 1 15
837 2 13
838 3 15
839 4 17
840 5 23
841 6 34
842 7 56
843 8 56
844 9 45
845 10 34
846 11 78
847 12 89
848 13 67
849 14 46
850 15 34
851 16 324
852 17 345
853 18 34
854 19 78
855 20 567
856 21 4
857 22 435
858 23 34
859 24 45
860 25 4565
861 26 4
862 27 3
863 28 2
864 29 3
865 30 15
866 31 6
867 32 8
868 33 9
869 34 745
870 35 34
871 36 34
872 37 324
873 38 67
874 39 78
875 40 89
876 41 90
877 42 78967
878 50 56
879 51 34
880 55 123
881 -------------------------------------------------------------------------
882 --- Delete rows and partitions of tables with abs(col1)
883 -------------------------------------------------------------------------
884 begin;
885 delete from t1 where col1=13 ;
886 delete from t2 where col1=13 ;
887 delete from t3 where col1=13 ;
888 delete from t4 where col1=13 ;
889 delete from t5 where col1=13 ;
890 delete from t6 where col1=13 ;
891 commit;
892 select * from t1 order by col1;
893 col1
894 15
895 select * from t2 order by col1;
896 col1
897 15
898 17
899 select * from t3 order by col1;
900 col1
901 15
902 17
903 select * from t4 order by colint;
904 colint col1
905 1 15
906 3 15
907 4 17
908 5 23
909 6 34
910 7 56
911 8 56
912 9 45
913 10 34
914 11 78
915 12 89
916 13 67
917 14 46
918 15 34
919 16 324
920 17 345
921 18 34
922 19 78
923 20 567
924 21 4
925 22 435
926 23 34
927 24 45
928 25 4565
929 26 4
930 27 3
931 28 2
932 29 3
933 30 15
934 31 6
935 32 8
936 33 9
937 34 745
938 35 34
939 36 34
940 37 324
941 38 67
942 39 78
943 40 89
944 41 90
945 42 78967
946 50 56
947 51 34
948 55 123
949 select * from t5 order by colint;
950 colint col1
951 1 15
952 3 15
953 4 17
954 5 23
955 6 34
956 7 56
957 8 56
958 9 45
959 10 34
960 11 78
961 12 89
962 13 67
963 14 46
964 15 34
965 16 324
966 17 345
967 18 34
968 19 78
969 20 567
970 21 4
971 22 435
972 23 34
973 24 45
974 25 4565
975 26 4
976 27 3
977 28 2
978 29 3
979 30 15
980 31 6
981 32 8
982 33 9
983 34 745
984 35 34
985 36 34
986 37 324
987 38 67
988 39 78
989 40 89
990 41 90
991 42 78967
992 50 56
993 51 34
994 55 123
995 begin;
996 insert into t1 values (13 );
997 insert into t2 values (13 );
998 insert into t3 values (13 );
999 insert into t4 values (60,13 );
1000 insert into t5 values (60,13 );
1001 insert into t6 values (60,13 );
1002 commit;
1003 select * from t1 order by col1;
1004 col1
1005 13
1006 15
1007 select * from t2 order by col1;
1008 col1
1009 13
1010 15
1011 17
1012 select * from t3 order by col1;
1013 col1
1014 13
1015 15
1016 17
1017 select * from t4 order by colint;
1018 colint col1
1019 1 15
1020 3 15
1021 4 17
1022 5 23
1023 6 34
1024 7 56
1025 8 56
1026 9 45
1027 10 34
1028 11 78
1029 12 89
1030 13 67
1031 14 46
1032 15 34
1033 16 324
1034 17 345
1035 18 34
1036 19 78
1037 20 567
1038 21 4
1039 22 435
1040 23 34
1041 24 45
1042 25 4565
1043 26 4
1044 27 3
1045 28 2
1046 29 3
1047 30 15
1048 31 6
1049 32 8
1050 33 9
1051 34 745
1052 35 34
1053 36 34
1054 37 324
1055 38 67
1056 39 78
1057 40 89
1058 41 90
1059 42 78967
1060 50 56
1061 51 34
1062 55 123
1063 60 13
1064 select * from t5 order by colint;
1065 colint col1
1066 1 15
1067 3 15
1068 4 17
1069 5 23
1070 6 34
1071 7 56
1072 8 56
1073 9 45
1074 10 34
1075 11 78
1076 12 89
1077 13 67
1078 14 46
1079 15 34
1080 16 324
1081 17 345
1082 18 34
1083 19 78
1084 20 567
1085 21 4
1086 22 435
1087 23 34
1088 24 45
1089 25 4565
1090 26 4
1091 27 3
1092 28 2
1093 29 3
1094 30 15
1095 31 6
1096 32 8
1097 33 9
1098 34 745
1099 35 34
1100 36 34
1101 37 324
1102 38 67
1103 39 78
1104 40 89
1105 41 90
1106 42 78967
1107 50 56
1108 51 34
1109 55 123
1110 60 13
1111 select * from t6 order by colint;
1112 colint col1
1113 1 15
1114 3 15
1115 4 17
1116 5 23
1117 6 34
1118 7 56
1119 8 56
1120 9 45
1121 10 34
1122 11 78
1123 12 89
1124 13 67
1125 14 46
1126 15 34
1127 16 324
1128 17 345
1129 18 34
1130 19 78
1131 20 567
1132 21 4
1133 22 435
1134 23 34
1135 24 45
1136 25 4565
1137 26 4
1138 27 3
1139 28 2
1140 29 3
1141 30 15
1142 31 6
1143 32 8
1144 33 9
1145 34 745
1146 35 34
1147 36 34
1148 37 324
1149 38 67
1150 39 78
1151 40 89
1152 41 90
1153 42 78967
1154 50 56
1155 51 34
1156 55 123
1157 60 13
1158 alter table t1 drop partition p0;
1159 alter table t2 drop partition p0;
1160 alter table t4 drop partition p0;
1161 alter table t5 drop partition p0;
1162 alter table t6 drop partition p0;
1163 select * from t1 order by col1;
1164 col1
1165 15
1166 select * from t2 order by col1;
1167 col1
1168 13
1169 15
1170 17
1171 select * from t3 order by col1;
1172 col1
1173 13
1174 15
1175 17
1176 select * from t4 order by colint;
1177 colint col1
1178 15 34
1179 16 324
1180 17 345
1181 18 34
1182 19 78
1183 20 567
1184 21 4
1185 22 435
1186 23 34
1187 24 45
1188 25 4565
1189 26 4
1190 27 3
1191 28 2
1192 29 3
1193 30 15
1194 31 6
1195 32 8
1196 33 9
1197 34 745
1198 35 34
1199 36 34
1200 37 324
1201 38 67
1202 39 78
1203 40 89
1204 41 90
1205 42 78967
1206 50 56
1207 51 34
1208 55 123
1209 60 13
1210 select * from t5 order by colint;
1211 colint col1
1212 11 78
1213 12 89
1214 13 67
1215 14 46
1216 15 34
1217 16 324
1218 17 345
1219 18 34
1220 19 78
1221 20 567
1222 21 4
1223 22 435
1224 23 34
1225 24 45
1226 25 4565
1227 26 4
1228 27 3
1229 28 2
1230 29 3
1231 30 15
1232 31 6
1233 32 8
1234 33 9
1235 34 745
1236 35 34
1237 36 34
1238 37 324
1239 38 67
1240 39 78
1241 40 89
1242 41 90
1243 42 78967
1244 50 56
1245 51 34
1246 55 123
1247 60 13
1248 select * from t6 order by colint;
1249 colint col1
1250 15 34
1251 16 324
1252 17 345
1253 18 34
1254 19 78
1255 20 567
1256 21 4
1257 22 435
1258 23 34
1259 24 45
1260 25 4565
1261 26 4
1262 27 3
1263 28 2
1264 29 3
1265 30 15
1266 31 6
1267 32 8
1268 33 9
1269 34 745
1270 35 34
1271 36 34
1272 37 324
1273 38 67
1274 39 78
1275 40 89
1276 41 90
1277 42 78967
1278 50 56
1279 51 34
1280 55 123
1281 60 13
1282 -------------------------------------------------------------------------
1283 --- Delete rows and partitions of tables with abs(col1)
1284 -------------------------------------------------------------------------
1285 begin;
1286 delete from t11 where col1=13 ;
1287 delete from t22 where col1=13 ;
1288 delete from t33 where col1=13 ;
1289 delete from t44 where col1=13 ;
1290 delete from t55 where col1=13 ;
1291 delete from t66 where col1=13 ;
1292 commit;
1293 select * from t11 order by col1;
1294 col1
1295 15
1296 select * from t22 order by col1;
1297 col1
1298 15
1299 17
1300 select * from t33 order by col1;
1301 col1
1302 15
1303 17
1304 select * from t44 order by colint;
1305 colint col1
1306 1 15
1307 3 15
1308 4 17
1309 5 23
1310 6 34
1311 7 56
1312 8 56
1313 9 45
1314 10 34
1315 11 78
1316 12 89
1317 13 67
1318 14 46
1319 15 34
1320 16 324
1321 17 345
1322 18 34
1323 19 78
1324 20 567
1325 21 4
1326 22 435
1327 23 34
1328 24 45
1329 25 4565
1330 26 4
1331 27 3
1332 28 2
1333 29 3
1334 30 15
1335 31 6
1336 32 8
1337 33 9
1338 34 745
1339 35 34
1340 36 34
1341 37 324
1342 38 67
1343 39 78
1344 40 89
1345 41 90
1346 42 78967
1347 50 56
1348 51 34
1349 55 123
1350 select * from t55 order by colint;
1351 colint col1
1352 1 15
1353 3 15
1354 4 17
1355 5 23
1356 6 34
1357 7 56
1358 8 56
1359 9 45
1360 10 34
1361 11 78
1362 12 89
1363 13 67
1364 14 46
1365 15 34
1366 16 324
1367 17 345
1368 18 34
1369 19 78
1370 20 567
1371 21 4
1372 22 435
1373 23 34
1374 24 45
1375 25 4565
1376 26 4
1377 27 3
1378 28 2
1379 29 3
1380 30 15
1381 31 6
1382 32 8
1383 33 9
1384 34 745
1385 35 34
1386 36 34
1387 37 324
1388 38 67
1389 39 78
1390 40 89
1391 41 90
1392 42 78967
1393 50 56
1394 51 34
1395 55 123
1396 begin;
1397 insert into t11 values (13 );
1398 insert into t22 values (13 );
1399 insert into t33 values (13 );
1400 insert into t44 values (60,13 );
1401 insert into t55 values (60,13 );
1402 insert into t66 values (60,13 );
1403 commit;
1404 select * from t11 order by col1;
1405 col1
1406 13
1407 15
1408 select * from t22 order by col1;
1409 col1
1410 13
1411 15
1412 17
1413 select * from t33 order by col1;
1414 col1
1415 13
1416 15
1417 17
1418 select * from t44 order by colint;
1419 colint col1
1420 1 15
1421 3 15
1422 4 17
1423 5 23
1424 6 34
1425 7 56
1426 8 56
1427 9 45
1428 10 34
1429 11 78
1430 12 89
1431 13 67
1432 14 46
1433 15 34
1434 16 324
1435 17 345
1436 18 34
1437 19 78
1438 20 567
1439 21 4
1440 22 435
1441 23 34
1442 24 45
1443 25 4565
1444 26 4
1445 27 3
1446 28 2
1447 29 3
1448 30 15
1449 31 6
1450 32 8
1451 33 9
1452 34 745
1453 35 34
1454 36 34
1455 37 324
1456 38 67
1457 39 78
1458 40 89
1459 41 90
1460 42 78967
1461 50 56
1462 51 34
1463 55 123
1464 60 13
1465 select * from t55 order by colint;
1466 colint col1
1467 1 15
1468 3 15
1469 4 17
1470 5 23
1471 6 34
1472 7 56
1473 8 56
1474 9 45
1475 10 34
1476 11 78
1477 12 89
1478 13 67
1479 14 46
1480 15 34
1481 16 324
1482 17 345
1483 18 34
1484 19 78
1485 20 567
1486 21 4
1487 22 435
1488 23 34
1489 24 45
1490 25 4565
1491 26 4
1492 27 3
1493 28 2
1494 29 3
1495 30 15
1496 31 6
1497 32 8
1498 33 9
1499 34 745
1500 35 34
1501 36 34
1502 37 324
1503 38 67
1504 39 78
1505 40 89
1506 41 90
1507 42 78967
1508 50 56
1509 51 34
1510 55 123
1511 60 13
1512 select * from t66 order by colint;
1513 colint col1
1514 1 15
1515 3 15
1516 4 17
1517 5 23
1518 6 34
1519 7 56
1520 8 56
1521 9 45
1522 10 34
1523 11 78
1524 12 89
1525 13 67
1526 14 46
1527 15 34
1528 16 324
1529 17 345
1530 18 34
1531 19 78
1532 20 567
1533 21 4
1534 22 435
1535 23 34
1536 24 45
1537 25 4565
1538 26 4
1539 27 3
1540 28 2
1541 29 3
1542 30 15
1543 31 6
1544 32 8
1545 33 9
1546 34 745
1547 35 34
1548 36 34
1549 37 324
1550 38 67
1551 39 78
1552 40 89
1553 41 90
1554 42 78967
1555 50 56
1556 51 34
1557 55 123
1558 60 13
1559 alter table t11 drop partition p0;
1560 alter table t22 drop partition p0;
1561 alter table t44 drop partition p0;
1562 alter table t55 drop partition p0;
1563 alter table t66 drop partition p0;
1564 select * from t11 order by col1;
1565 col1
1566 15
1567 select * from t22 order by col1;
1568 col1
1569 13
1570 15
1571 17
1572 select * from t33 order by col1;
1573 col1
1574 13
1575 15
1576 17
1577 select * from t44 order by colint;
1578 colint col1
1579 15 34
1580 16 324
1581 17 345
1582 18 34
1583 19 78
1584 20 567
1585 21 4
1586 22 435
1587 23 34
1588 24 45
1589 25 4565
1590 26 4
1591 27 3
1592 28 2
1593 29 3
1594 30 15
1595 31 6
1596 32 8
1597 33 9
1598 34 745
1599 35 34
1600 36 34
1601 37 324
1602 38 67
1603 39 78
1604 40 89
1605 41 90
1606 42 78967
1607 50 56
1608 51 34
1609 55 123
1610 60 13
1611 select * from t55 order by colint;
1612 colint col1
1613 11 78
1614 12 89
1615 13 67
1616 14 46
1617 15 34
1618 16 324
1619 17 345
1620 18 34
1621 19 78
1622 20 567
1623 21 4
1624 22 435
1625 23 34
1626 24 45
1627 25 4565
1628 26 4
1629 27 3
1630 28 2
1631 29 3
1632 30 15
1633 31 6
1634 32 8
1635 33 9
1636 34 745
1637 35 34
1638 36 34
1639 37 324
1640 38 67
1641 39 78
1642 40 89
1643 41 90
1644 42 78967
1645 50 56
1646 51 34
1647 55 123
1648 60 13
1649 select * from t66 order by colint;
1650 colint col1
1651 15 34
1652 16 324
1653 17 345
1654 18 34
1655 19 78
1656 20 567
1657 21 4
1658 22 435
1659 23 34
1660 24 45
1661 25 4565
1662 26 4
1663 27 3
1664 28 2
1665 29 3
1666 30 15
1667 31 6
1668 32 8
1669 33 9
1670 34 745
1671 35 34
1672 36 34
1673 37 324
1674 38 67
1675 39 78
1676 40 89
1677 41 90
1678 42 78967
1679 50 56
1680 51 34
1681 55 123
1682 60 13
1683 -------------------------
1684 ---- some alter table end
1685 -------------------------
1686 drop table if exists t1 ;
1687 drop table if exists t2 ;
1688 drop table if exists t3 ;
1689 drop table if exists t4 ;
1690 drop table if exists t5 ;
1691 drop table if exists t6 ;
1692 drop table if exists t11 ;
1693 drop table if exists t22 ;
1694 drop table if exists t33 ;
1695 drop table if exists t44 ;
1696 drop table if exists t55 ;
1697 drop table if exists t66 ;
1698 -------------------------------------------------------------------------
1699 --- mod(col1,10) in partition with coltype int
1700 -------------------------------------------------------------------------
1701 drop table if exists t1 ;
1702 drop table if exists t2 ;
1703 drop table if exists t3 ;
1704 drop table if exists t4 ;
1705 drop table if exists t5 ;
1706 drop table if exists t6 ;
1707 -------------------------------------------------------------------------
1708 --- Create tables with mod(col1,10)
1709 -------------------------------------------------------------------------
1710 create table t1 (col1 int) engine='INNODB'
1711 partition by range(mod(col1,10))
1712 (partition p0 values less than (15),
1713 partition p1 values less than maxvalue);
1714 create table t2 (col1 int) engine='INNODB'
1715 partition by list(mod(col1,10))
1716 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
1717 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
1718 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
1719 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
1720 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
1721 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
1722 );
1723 create table t3 (col1 int) engine='INNODB'
1724 partition by hash(mod(col1,10));
1725 create table t4 (colint int, col1 int) engine='INNODB'
1726 partition by range(colint)
1727 subpartition by hash(mod(col1,10)) subpartitions 2
1728 (partition p0 values less than (15),
1729 partition p1 values less than maxvalue);
1730 create table t5 (colint int, col1 int) engine='INNODB'
1731 partition by list(colint)
1732 subpartition by hash(mod(col1,10)) subpartitions 2
1733 (partition p0 values in (1,2,3,4,5,6,7,8,9,10),
1734 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
1735 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
1736 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
1737 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
1738 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
1739 );
1740 create table t6 (colint int, col1 int) engine='INNODB'
1741 partition by range(colint)
1742 (partition p0 values less than (mod(15,10)),
1743 partition p1 values less than maxvalue);
1744 -------------------------------------------------------------------------
1745 --- Access tables with mod(col1,10)
1746 -------------------------------------------------------------------------
1747 begin;
1748 insert into t1 values (5);
1749 insert into t1 values (19);
1750 insert into t2 values (5);
1751 insert into t2 values (19);
1752 insert into t2 values (17);
1753 insert into t3 values (5);
1754 insert into t3 values (19);
1755 insert into t3 values (17);
1756 commit;
1757 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_int.inc' into table t4;
1758 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_int.inc' into table t5;
1759 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_int.inc' into table t6;
1760 select mod(col1,10) from t1 order by col1;
1761 mod(col1,10)
1762 5
1763 9
1764 select * from t1 order by col1;
1765 col1
1766 5
1767 19
1768 select * from t2 order by col1;
1769 col1
1770 5
1771 17
1772 19
1773 select * from t3 order by col1;
1774 col1
1775 5
1776 17
1777 19
1778 select * from t4 order by colint;
1779 colint col1
1780 1 5
1781 2 13
1782 3 15
1783 4 17
1784 5 23
1785 6 34
1786 7 56
1787 8 56
1788 9 45
1789 10 34
1790 11 78
1791 12 89
1792 13 67
1793 14 46
1794 15 34
1795 16 324
1796 17 345
1797 18 34
1798 19 78
1799 20 567
1800 21 4
1801 22 435
1802 23 34
1803 24 45
1804 25 4565
1805 26 4
1806 27 3
1807 28 2
1808 29 3
1809 30 5
1810 31 6
1811 32 8
1812 33 9
1813 34 745
1814 35 34
1815 36 34
1816 37 324
1817 38 67
1818 39 78
1819 40 89
1820 41 90
1821 42 78967
1822 50 56
1823 51 34
1824 55 123
1825 select * from t5 order by colint;
1826 colint col1
1827 1 5
1828 2 13
1829 3 15
1830 4 17
1831 5 23
1832 6 34
1833 7 56
1834 8 56
1835 9 45
1836 10 34
1837 11 78
1838 12 89
1839 13 67
1840 14 46
1841 15 34
1842 16 324
1843 17 345
1844 18 34
1845 19 78
1846 20 567
1847 21 4
1848 22 435
1849 23 34
1850 24 45
1851 25 4565
1852 26 4
1853 27 3
1854 28 2
1855 29 3
1856 30 5
1857 31 6
1858 32 8
1859 33 9
1860 34 745
1861 35 34
1862 36 34
1863 37 324
1864 38 67
1865 39 78
1866 40 89
1867 41 90
1868 42 78967
1869 50 56
1870 51 34
1871 55 123
1872 select * from t6 order by colint;
1873 colint col1
1874 1 5
1875 2 13
1876 3 15
1877 4 17
1878 5 23
1879 6 34
1880 7 56
1881 8 56
1882 9 45
1883 10 34
1884 11 78
1885 12 89
1886 13 67
1887 14 46
1888 15 34
1889 16 324
1890 17 345
1891 18 34
1892 19 78
1893 20 567
1894 21 4
1895 22 435
1896 23 34
1897 24 45
1898 25 4565
1899 26 4
1900 27 3
1901 28 2
1902 29 3
1903 30 5
1904 31 6
1905 32 8
1906 33 9
1907 34 745
1908 35 34
1909 36 34
1910 37 324
1911 38 67
1912 39 78
1913 40 89
1914 41 90
1915 42 78967
1916 50 56
1917 51 34
1918 55 123
1919 begin;
1920 update t1 set col1=15 where col1=5;
1921 update t2 set col1=15 where col1=5;
1922 update t3 set col1=15 where col1=5;
1923 update t4 set col1=15 where col1=5;
1924 update t5 set col1=15 where col1=5;
1925 update t6 set col1=15 where col1=5;
1926 commit;
1927 select * from t1 order by col1;
1928 col1
1929 15
1930 19
1931 select * from t2 order by col1;
1932 col1
1933 15
1934 17
1935 19
1936 select * from t3 order by col1;
1937 col1
1938 15
1939 17
1940 19
1941 select * from t4 order by colint;
1942 colint col1
1943 1 15
1944 2 13
1945 3 15
1946 4 17
1947 5 23
1948 6 34
1949 7 56
1950 8 56
1951 9 45
1952 10 34
1953 11 78
1954 12 89
1955 13 67
1956 14 46
1957 15 34
1958 16 324
1959 17 345
1960 18 34
1961 19 78
1962 20 567
1963 21 4
1964 22 435
1965 23 34
1966 24 45
1967 25 4565
1968 26 4
1969 27 3
1970 28 2
1971 29 3
1972 30 15
1973 31 6
1974 32 8
1975 33 9
1976 34 745
1977 35 34
1978 36 34
1979 37 324
1980 38 67
1981 39 78
1982 40 89
1983 41 90
1984 42 78967
1985 50 56
1986 51 34
1987 55 123
1988 select * from t5 order by colint;
1989 colint col1
1990 1 15
1991 2 13
1992 3 15
1993 4 17
1994 5 23
1995 6 34
1996 7 56
1997 8 56
1998 9 45
1999 10 34
2000 11 78
2001 12 89
2002 13 67
2003 14 46
2004 15 34
2005 16 324
2006 17 345
2007 18 34
2008 19 78
2009 20 567
2010 21 4
2011 22 435
2012 23 34
2013 24 45
2014 25 4565
2015 26 4
2016 27 3
2017 28 2
2018 29 3
2019 30 15
2020 31 6
2021 32 8
2022 33 9
2023 34 745
2024 35 34
2025 36 34
2026 37 324
2027 38 67
2028 39 78
2029 40 89
2030 41 90
2031 42 78967
2032 50 56
2033 51 34
2034 55 123
2035 select * from t6 order by colint;
2036 colint col1
2037 1 15
2038 2 13
2039 3 15
2040 4 17
2041 5 23
2042 6 34
2043 7 56
2044 8 56
2045 9 45
2046 10 34
2047 11 78
2048 12 89
2049 13 67
2050 14 46
2051 15 34
2052 16 324
2053 17 345
2054 18 34
2055 19 78
2056 20 567
2057 21 4
2058 22 435
2059 23 34
2060 24 45
2061 25 4565
2062 26 4
2063 27 3
2064 28 2
2065 29 3
2066 30 15
2067 31 6
2068 32 8
2069 33 9
2070 34 745
2071 35 34
2072 36 34
2073 37 324
2074 38 67
2075 39 78
2076 40 89
2077 41 90
2078 42 78967
2079 50 56
2080 51 34
2081 55 123
2082 -------------------------------------------------------------------------
2083 --- Alter tables with mod(col1,10)
2084 -------------------------------------------------------------------------
2085 drop table if exists t11 ;
2086 drop table if exists t22 ;
2087 drop table if exists t33 ;
2088 drop table if exists t44 ;
2089 drop table if exists t55 ;
2090 drop table if exists t66 ;
2091 create table t11 engine='INNODB' as select * from t1;
2092 create table t22 engine='INNODB' as select * from t2;
2093 create table t33 engine='INNODB' as select * from t3;
2094 create table t44 engine='INNODB' as select * from t4;
2095 create table t55 engine='INNODB' as select * from t5;
2096 create table t66 engine='INNODB' as select * from t6;
2097 alter table t11
2098 partition by range(mod(col1,10))
2099 (partition p0 values less than (15),
2100 partition p1 values less than maxvalue);
2101 alter table t22
2102 partition by list(mod(col1,10))
2103 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
2104 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
2105 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
2106 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
2107 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
2108 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
2109 );
2110 alter table t33
2111 partition by hash(mod(col1,10));
2112 alter table t44
2113 partition by range(colint)
2114 subpartition by hash(mod(col1,10)) subpartitions 2
2115 (partition p0 values less than (15),
2116 partition p1 values less than maxvalue);
2117 alter table t55
2118 partition by list(colint)
2119 subpartition by hash(mod(col1,10)) subpartitions 2
2120 (partition p0 values in (1,2,3,4,5,6,7,8,9,10),
2121 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
2122 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
2123 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
2124 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
2125 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
2126 );
2127 alter table t66
2128 partition by range(colint)
2129 (partition p0 values less than (mod(15,10)),
2130 partition p1 values less than maxvalue);
2131 select * from t11 order by col1;
2132 col1
2133 15
2134 19
2135 select * from t22 order by col1;
2136 col1
2137 15
2138 17
2139 19
2140 select * from t33 order by col1;
2141 col1
2142 15
2143 17
2144 19
2145 select * from t44 order by colint;
2146 colint col1
2147 1 15
2148 2 13
2149 3 15
2150 4 17
2151 5 23
2152 6 34
2153 7 56
2154 8 56
2155 9 45
2156 10 34
2157 11 78
2158 12 89
2159 13 67
2160 14 46
2161 15 34
2162 16 324
2163 17 345
2164 18 34
2165 19 78
2166 20 567
2167 21 4
2168 22 435
2169 23 34
2170 24 45
2171 25 4565
2172 26 4
2173 27 3
2174 28 2
2175 29 3
2176 30 15
2177 31 6
2178 32 8
2179 33 9
2180 34 745
2181 35 34
2182 36 34
2183 37 324
2184 38 67
2185 39 78
2186 40 89
2187 41 90
2188 42 78967
2189 50 56
2190 51 34
2191 55 123
2192 select * from t55 order by colint;
2193 colint col1
2194 1 15
2195 2 13
2196 3 15
2197 4 17
2198 5 23
2199 6 34
2200 7 56
2201 8 56
2202 9 45
2203 10 34
2204 11 78
2205 12 89
2206 13 67
2207 14 46
2208 15 34
2209 16 324
2210 17 345
2211 18 34
2212 19 78
2213 20 567
2214 21 4
2215 22 435
2216 23 34
2217 24 45
2218 25 4565
2219 26 4
2220 27 3
2221 28 2
2222 29 3
2223 30 15
2224 31 6
2225 32 8
2226 33 9
2227 34 745
2228 35 34
2229 36 34
2230 37 324
2231 38 67
2232 39 78
2233 40 89
2234 41 90
2235 42 78967
2236 50 56
2237 51 34
2238 55 123
2239 select * from t66 order by colint;
2240 colint col1
2241 1 15
2242 2 13
2243 3 15
2244 4 17
2245 5 23
2246 6 34
2247 7 56
2248 8 56
2249 9 45
2250 10 34
2251 11 78
2252 12 89
2253 13 67
2254 14 46
2255 15 34
2256 16 324
2257 17 345
2258 18 34
2259 19 78
2260 20 567
2261 21 4
2262 22 435
2263 23 34
2264 24 45
2265 25 4565
2266 26 4
2267 27 3
2268 28 2
2269 29 3
2270 30 15
2271 31 6
2272 32 8
2273 33 9
2274 34 745
2275 35 34
2276 36 34
2277 37 324
2278 38 67
2279 39 78
2280 40 89
2281 41 90
2282 42 78967
2283 50 56
2284 51 34
2285 55 123
2286 ---------------------------
2287 ---- some alter table begin
2288 ---------------------------
2289 alter table t11
2290 reorganize partition p0,p1 into
2291 (partition s1 values less than maxvalue);
2292 select * from t11 order by col1;
2293 col1
2294 15
2295 19
2296 alter table t11
2297 reorganize partition s1 into
2298 (partition p0 values less than (15),
2299 partition p1 values less than maxvalue);
2300 select * from t11 order by col1;
2301 col1
2302 15
2303 19
2304 alter table t55
2305 partition by list(colint)
2306 subpartition by hash(mod(col1,10)) subpartitions 5
2307 (partition p0 values in (1,2,3,4,5,6,7,8,9,10),
2308 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
2309 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
2310 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
2311 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
2312 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
2313 );
2314 show create table t55;
2315 Table Create Table
2316 t55 CREATE TABLE `t55` (
2317 `colint` int(11) DEFAULT NULL,
2318 `col1` int(11) DEFAULT NULL
2319 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
2320 PARTITION BY LIST (`colint`)
2321 SUBPARTITION BY HASH (`col1` MOD 10)
2322 SUBPARTITIONS 5
2323 (PARTITION `p0` VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB,
2324 PARTITION `p1` VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB,
2325 PARTITION `p2` VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB,
2326 PARTITION `p3` VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB,
2327 PARTITION `p4` VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB,
2328 PARTITION `p5` VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB)
2329 select * from t55 order by colint;
2330 colint col1
2331 1 15
2332 2 13
2333 3 15
2334 4 17
2335 5 23
2336 6 34
2337 7 56
2338 8 56
2339 9 45
2340 10 34
2341 11 78
2342 12 89
2343 13 67
2344 14 46
2345 15 34
2346 16 324
2347 17 345
2348 18 34
2349 19 78
2350 20 567
2351 21 4
2352 22 435
2353 23 34
2354 24 45
2355 25 4565
2356 26 4
2357 27 3
2358 28 2
2359 29 3
2360 30 15
2361 31 6
2362 32 8
2363 33 9
2364 34 745
2365 35 34
2366 36 34
2367 37 324
2368 38 67
2369 39 78
2370 40 89
2371 41 90
2372 42 78967
2373 50 56
2374 51 34
2375 55 123
2376 alter table t66
2377 reorganize partition p0,p1 into
2378 (partition s1 values less than maxvalue);
2379 select * from t66 order by colint;
2380 colint col1
2381 1 15
2382 2 13
2383 3 15
2384 4 17
2385 5 23
2386 6 34
2387 7 56
2388 8 56
2389 9 45
2390 10 34
2391 11 78
2392 12 89
2393 13 67
2394 14 46
2395 15 34
2396 16 324
2397 17 345
2398 18 34
2399 19 78
2400 20 567
2401 21 4
2402 22 435
2403 23 34
2404 24 45
2405 25 4565
2406 26 4
2407 27 3
2408 28 2
2409 29 3
2410 30 15
2411 31 6
2412 32 8
2413 33 9
2414 34 745
2415 35 34
2416 36 34
2417 37 324
2418 38 67
2419 39 78
2420 40 89
2421 41 90
2422 42 78967
2423 50 56
2424 51 34
2425 55 123
2426 alter table t66
2427 reorganize partition s1 into
2428 (partition p0 values less than (mod(15,10)),
2429 partition p1 values less than maxvalue);
2430 select * from t66 order by colint;
2431 colint col1
2432 1 15
2433 2 13
2434 3 15
2435 4 17
2436 5 23
2437 6 34
2438 7 56
2439 8 56
2440 9 45
2441 10 34
2442 11 78
2443 12 89
2444 13 67
2445 14 46
2446 15 34
2447 16 324
2448 17 345
2449 18 34
2450 19 78
2451 20 567
2452 21 4
2453 22 435
2454 23 34
2455 24 45
2456 25 4565
2457 26 4
2458 27 3
2459 28 2
2460 29 3
2461 30 15
2462 31 6
2463 32 8
2464 33 9
2465 34 745
2466 35 34
2467 36 34
2468 37 324
2469 38 67
2470 39 78
2471 40 89
2472 41 90
2473 42 78967
2474 50 56
2475 51 34
2476 55 123
2477 alter table t66
2478 reorganize partition p0,p1 into
2479 (partition s1 values less than maxvalue);
2480 select * from t66 order by colint;
2481 colint col1
2482 1 15
2483 2 13
2484 3 15
2485 4 17
2486 5 23
2487 6 34
2488 7 56
2489 8 56
2490 9 45
2491 10 34
2492 11 78
2493 12 89
2494 13 67
2495 14 46
2496 15 34
2497 16 324
2498 17 345
2499 18 34
2500 19 78
2501 20 567
2502 21 4
2503 22 435
2504 23 34
2505 24 45
2506 25 4565
2507 26 4
2508 27 3
2509 28 2
2510 29 3
2511 30 15
2512 31 6
2513 32 8
2514 33 9
2515 34 745
2516 35 34
2517 36 34
2518 37 324
2519 38 67
2520 39 78
2521 40 89
2522 41 90
2523 42 78967
2524 50 56
2525 51 34
2526 55 123
2527 alter table t66
2528 reorganize partition s1 into
2529 (partition p0 values less than (mod(15,10)),
2530 partition p1 values less than maxvalue);
2531 select * from t66 order by colint;
2532 colint col1
2533 1 15
2534 2 13
2535 3 15
2536 4 17
2537 5 23
2538 6 34
2539 7 56
2540 8 56
2541 9 45
2542 10 34
2543 11 78
2544 12 89
2545 13 67
2546 14 46
2547 15 34
2548 16 324
2549 17 345
2550 18 34
2551 19 78
2552 20 567
2553 21 4
2554 22 435
2555 23 34
2556 24 45
2557 25 4565
2558 26 4
2559 27 3
2560 28 2
2561 29 3
2562 30 15
2563 31 6
2564 32 8
2565 33 9
2566 34 745
2567 35 34
2568 36 34
2569 37 324
2570 38 67
2571 39 78
2572 40 89
2573 41 90
2574 42 78967
2575 50 56
2576 51 34
2577 55 123
2578 -------------------------------------------------------------------------
2579 --- Delete rows and partitions of tables with mod(col1,10)
2580 -------------------------------------------------------------------------
2581 begin;
2582 delete from t1 where col1=19;
2583 delete from t2 where col1=19;
2584 delete from t3 where col1=19;
2585 delete from t4 where col1=19;
2586 delete from t5 where col1=19;
2587 delete from t6 where col1=19;
2588 commit;
2589 select * from t1 order by col1;
2590 col1
2591 15
2592 select * from t2 order by col1;
2593 col1
2594 15
2595 17
2596 select * from t3 order by col1;
2597 col1
2598 15
2599 17
2600 select * from t4 order by colint;
2601 colint col1
2602 1 15
2603 2 13
2604 3 15
2605 4 17
2606 5 23
2607 6 34
2608 7 56
2609 8 56
2610 9 45
2611 10 34
2612 11 78
2613 12 89
2614 13 67
2615 14 46
2616 15 34
2617 16 324
2618 17 345
2619 18 34
2620 19 78
2621 20 567
2622 21 4
2623 22 435
2624 23 34
2625 24 45
2626 25 4565
2627 26 4
2628 27 3
2629 28 2
2630 29 3
2631 30 15
2632 31 6
2633 32 8
2634 33 9
2635 34 745
2636 35 34
2637 36 34
2638 37 324
2639 38 67
2640 39 78
2641 40 89
2642 41 90
2643 42 78967
2644 50 56
2645 51 34
2646 55 123
2647 select * from t5 order by colint;
2648 colint col1
2649 1 15
2650 2 13
2651 3 15
2652 4 17
2653 5 23
2654 6 34
2655 7 56
2656 8 56
2657 9 45
2658 10 34
2659 11 78
2660 12 89
2661 13 67
2662 14 46
2663 15 34
2664 16 324
2665 17 345
2666 18 34
2667 19 78
2668 20 567
2669 21 4
2670 22 435
2671 23 34
2672 24 45
2673 25 4565
2674 26 4
2675 27 3
2676 28 2
2677 29 3
2678 30 15
2679 31 6
2680 32 8
2681 33 9
2682 34 745
2683 35 34
2684 36 34
2685 37 324
2686 38 67
2687 39 78
2688 40 89
2689 41 90
2690 42 78967
2691 50 56
2692 51 34
2693 55 123
2694 begin;
2695 insert into t1 values (19);
2696 insert into t2 values (19);
2697 insert into t3 values (19);
2698 insert into t4 values (60,19);
2699 insert into t5 values (60,19);
2700 insert into t6 values (60,19);
2701 commit;
2702 select * from t1 order by col1;
2703 col1
2704 15
2705 19
2706 select * from t2 order by col1;
2707 col1
2708 15
2709 17
2710 19
2711 select * from t3 order by col1;
2712 col1
2713 15
2714 17
2715 19
2716 select * from t4 order by colint;
2717 colint col1
2718 1 15
2719 2 13
2720 3 15
2721 4 17
2722 5 23
2723 6 34
2724 7 56
2725 8 56
2726 9 45
2727 10 34
2728 11 78
2729 12 89
2730 13 67
2731 14 46
2732 15 34
2733 16 324
2734 17 345
2735 18 34
2736 19 78
2737 20 567
2738 21 4
2739 22 435
2740 23 34
2741 24 45
2742 25 4565
2743 26 4
2744 27 3
2745 28 2
2746 29 3
2747 30 15
2748 31 6
2749 32 8
2750 33 9
2751 34 745
2752 35 34
2753 36 34
2754 37 324
2755 38 67
2756 39 78
2757 40 89
2758 41 90
2759 42 78967
2760 50 56
2761 51 34
2762 55 123
2763 60 19
2764 select * from t5 order by colint;
2765 colint col1
2766 1 15
2767 2 13
2768 3 15
2769 4 17
2770 5 23
2771 6 34
2772 7 56
2773 8 56
2774 9 45
2775 10 34
2776 11 78
2777 12 89
2778 13 67
2779 14 46
2780 15 34
2781 16 324
2782 17 345
2783 18 34
2784 19 78
2785 20 567
2786 21 4
2787 22 435
2788 23 34
2789 24 45
2790 25 4565
2791 26 4
2792 27 3
2793 28 2
2794 29 3
2795 30 15
2796 31 6
2797 32 8
2798 33 9
2799 34 745
2800 35 34
2801 36 34
2802 37 324
2803 38 67
2804 39 78
2805 40 89
2806 41 90
2807 42 78967
2808 50 56
2809 51 34
2810 55 123
2811 60 19
2812 select * from t6 order by colint;
2813 colint col1
2814 1 15
2815 2 13
2816 3 15
2817 4 17
2818 5 23
2819 6 34
2820 7 56
2821 8 56
2822 9 45
2823 10 34
2824 11 78
2825 12 89
2826 13 67
2827 14 46
2828 15 34
2829 16 324
2830 17 345
2831 18 34
2832 19 78
2833 20 567
2834 21 4
2835 22 435
2836 23 34
2837 24 45
2838 25 4565
2839 26 4
2840 27 3
2841 28 2
2842 29 3
2843 30 15
2844 31 6
2845 32 8
2846 33 9
2847 34 745
2848 35 34
2849 36 34
2850 37 324
2851 38 67
2852 39 78
2853 40 89
2854 41 90
2855 42 78967
2856 50 56
2857 51 34
2858 55 123
2859 60 19
2860 alter table t1 drop partition p0;
2861 alter table t2 drop partition p0;
2862 alter table t4 drop partition p0;
2863 alter table t5 drop partition p0;
2864 alter table t6 drop partition p0;
2865 select * from t1 order by col1;
2866 col1
2867 select * from t2 order by col1;
2868 col1
2869 select * from t3 order by col1;
2870 col1
2871 15
2872 17
2873 19
2874 select * from t4 order by colint;
2875 colint col1
2876 15 34
2877 16 324
2878 17 345
2879 18 34
2880 19 78
2881 20 567
2882 21 4
2883 22 435
2884 23 34
2885 24 45
2886 25 4565
2887 26 4
2888 27 3
2889 28 2
2890 29 3
2891 30 15
2892 31 6
2893 32 8
2894 33 9
2895 34 745
2896 35 34
2897 36 34
2898 37 324
2899 38 67
2900 39 78
2901 40 89
2902 41 90
2903 42 78967
2904 50 56
2905 51 34
2906 55 123
2907 60 19
2908 select * from t5 order by colint;
2909 colint col1
2910 11 78
2911 12 89
2912 13 67
2913 14 46
2914 15 34
2915 16 324
2916 17 345
2917 18 34
2918 19 78
2919 20 567
2920 21 4
2921 22 435
2922 23 34
2923 24 45
2924 25 4565
2925 26 4
2926 27 3
2927 28 2
2928 29 3
2929 30 15
2930 31 6
2931 32 8
2932 33 9
2933 34 745
2934 35 34
2935 36 34
2936 37 324
2937 38 67
2938 39 78
2939 40 89
2940 41 90
2941 42 78967
2942 50 56
2943 51 34
2944 55 123
2945 60 19
2946 select * from t6 order by colint;
2947 colint col1
2948 5 23
2949 6 34
2950 7 56
2951 8 56
2952 9 45
2953 10 34
2954 11 78
2955 12 89
2956 13 67
2957 14 46
2958 15 34
2959 16 324
2960 17 345
2961 18 34
2962 19 78
2963 20 567
2964 21 4
2965 22 435
2966 23 34
2967 24 45
2968 25 4565
2969 26 4
2970 27 3
2971 28 2
2972 29 3
2973 30 15
2974 31 6
2975 32 8
2976 33 9
2977 34 745
2978 35 34
2979 36 34
2980 37 324
2981 38 67
2982 39 78
2983 40 89
2984 41 90
2985 42 78967
2986 50 56
2987 51 34
2988 55 123
2989 60 19
2990 -------------------------------------------------------------------------
2991 --- Delete rows and partitions of tables with mod(col1,10)
2992 -------------------------------------------------------------------------
2993 begin;
2994 delete from t11 where col1=19;
2995 delete from t22 where col1=19;
2996 delete from t33 where col1=19;
2997 delete from t44 where col1=19;
2998 delete from t55 where col1=19;
2999 delete from t66 where col1=19;
3000 commit;
3001 select * from t11 order by col1;
3002 col1
3003 15
3004 select * from t22 order by col1;
3005 col1
3006 15
3007 17
3008 select * from t33 order by col1;
3009 col1
3010 15
3011 17
3012 select * from t44 order by colint;
3013 colint col1
3014 1 15
3015 2 13
3016 3 15
3017 4 17
3018 5 23
3019 6 34
3020 7 56
3021 8 56
3022 9 45
3023 10 34
3024 11 78
3025 12 89
3026 13 67
3027 14 46
3028 15 34
3029 16 324
3030 17 345
3031 18 34
3032 19 78
3033 20 567
3034 21 4
3035 22 435
3036 23 34
3037 24 45
3038 25 4565
3039 26 4
3040 27 3
3041 28 2
3042 29 3
3043 30 15
3044 31 6
3045 32 8
3046 33 9
3047 34 745
3048 35 34
3049 36 34
3050 37 324
3051 38 67
3052 39 78
3053 40 89
3054 41 90
3055 42 78967
3056 50 56
3057 51 34
3058 55 123
3059 select * from t55 order by colint;
3060 colint col1
3061 1 15
3062 2 13
3063 3 15
3064 4 17
3065 5 23
3066 6 34
3067 7 56
3068 8 56
3069 9 45
3070 10 34
3071 11 78
3072 12 89
3073 13 67
3074 14 46
3075 15 34
3076 16 324
3077 17 345
3078 18 34
3079 19 78
3080 20 567
3081 21 4
3082 22 435
3083 23 34
3084 24 45
3085 25 4565
3086 26 4
3087 27 3
3088 28 2
3089 29 3
3090 30 15
3091 31 6
3092 32 8
3093 33 9
3094 34 745
3095 35 34
3096 36 34
3097 37 324
3098 38 67
3099 39 78
3100 40 89
3101 41 90
3102 42 78967
3103 50 56
3104 51 34
3105 55 123
3106 begin;
3107 insert into t11 values (19);
3108 insert into t22 values (19);
3109 insert into t33 values (19);
3110 insert into t44 values (60,19);
3111 insert into t55 values (60,19);
3112 insert into t66 values (60,19);
3113 commit;
3114 select * from t11 order by col1;
3115 col1
3116 15
3117 19
3118 select * from t22 order by col1;
3119 col1
3120 15
3121 17
3122 19
3123 select * from t33 order by col1;
3124 col1
3125 15
3126 17
3127 19
3128 select * from t44 order by colint;
3129 colint col1
3130 1 15
3131 2 13
3132 3 15
3133 4 17
3134 5 23
3135 6 34
3136 7 56
3137 8 56
3138 9 45
3139 10 34
3140 11 78
3141 12 89
3142 13 67
3143 14 46
3144 15 34
3145 16 324
3146 17 345
3147 18 34
3148 19 78
3149 20 567
3150 21 4
3151 22 435
3152 23 34
3153 24 45
3154 25 4565
3155 26 4
3156 27 3
3157 28 2
3158 29 3
3159 30 15
3160 31 6
3161 32 8
3162 33 9
3163 34 745
3164 35 34
3165 36 34
3166 37 324
3167 38 67
3168 39 78
3169 40 89
3170 41 90
3171 42 78967
3172 50 56
3173 51 34
3174 55 123
3175 60 19
3176 select * from t55 order by colint;
3177 colint col1
3178 1 15
3179 2 13
3180 3 15
3181 4 17
3182 5 23
3183 6 34
3184 7 56
3185 8 56
3186 9 45
3187 10 34
3188 11 78
3189 12 89
3190 13 67
3191 14 46
3192 15 34
3193 16 324
3194 17 345
3195 18 34
3196 19 78
3197 20 567
3198 21 4
3199 22 435
3200 23 34
3201 24 45
3202 25 4565
3203 26 4
3204 27 3
3205 28 2
3206 29 3
3207 30 15
3208 31 6
3209 32 8
3210 33 9
3211 34 745
3212 35 34
3213 36 34
3214 37 324
3215 38 67
3216 39 78
3217 40 89
3218 41 90
3219 42 78967
3220 50 56
3221 51 34
3222 55 123
3223 60 19
3224 select * from t66 order by colint;
3225 colint col1
3226 1 15
3227 2 13
3228 3 15
3229 4 17
3230 5 23
3231 6 34
3232 7 56
3233 8 56
3234 9 45
3235 10 34
3236 11 78
3237 12 89
3238 13 67
3239 14 46
3240 15 34
3241 16 324
3242 17 345
3243 18 34
3244 19 78
3245 20 567
3246 21 4
3247 22 435
3248 23 34
3249 24 45
3250 25 4565
3251 26 4
3252 27 3
3253 28 2
3254 29 3
3255 30 15
3256 31 6
3257 32 8
3258 33 9
3259 34 745
3260 35 34
3261 36 34
3262 37 324
3263 38 67
3264 39 78
3265 40 89
3266 41 90
3267 42 78967
3268 50 56
3269 51 34
3270 55 123
3271 60 19
3272 alter table t11 drop partition p0;
3273 alter table t22 drop partition p0;
3274 alter table t44 drop partition p0;
3275 alter table t55 drop partition p0;
3276 alter table t66 drop partition p0;
3277 select * from t11 order by col1;
3278 col1
3279 select * from t22 order by col1;
3280 col1
3281 select * from t33 order by col1;
3282 col1
3283 15
3284 17
3285 19
3286 select * from t44 order by colint;
3287 colint col1
3288 15 34
3289 16 324
3290 17 345
3291 18 34
3292 19 78
3293 20 567
3294 21 4
3295 22 435
3296 23 34
3297 24 45
3298 25 4565
3299 26 4
3300 27 3
3301 28 2
3302 29 3
3303 30 15
3304 31 6
3305 32 8
3306 33 9
3307 34 745
3308 35 34
3309 36 34
3310 37 324
3311 38 67
3312 39 78
3313 40 89
3314 41 90
3315 42 78967
3316 50 56
3317 51 34
3318 55 123
3319 60 19
3320 select * from t55 order by colint;
3321 colint col1
3322 11 78
3323 12 89
3324 13 67
3325 14 46
3326 15 34
3327 16 324
3328 17 345
3329 18 34
3330 19 78
3331 20 567
3332 21 4
3333 22 435
3334 23 34
3335 24 45
3336 25 4565
3337 26 4
3338 27 3
3339 28 2
3340 29 3
3341 30 15
3342 31 6
3343 32 8
3344 33 9
3345 34 745
3346 35 34
3347 36 34
3348 37 324
3349 38 67
3350 39 78
3351 40 89
3352 41 90
3353 42 78967
3354 50 56
3355 51 34
3356 55 123
3357 60 19
3358 select * from t66 order by colint;
3359 colint col1
3360 5 23
3361 6 34
3362 7 56
3363 8 56
3364 9 45
3365 10 34
3366 11 78
3367 12 89
3368 13 67
3369 14 46
3370 15 34
3371 16 324
3372 17 345
3373 18 34
3374 19 78
3375 20 567
3376 21 4
3377 22 435
3378 23 34
3379 24 45
3380 25 4565
3381 26 4
3382 27 3
3383 28 2
3384 29 3
3385 30 15
3386 31 6
3387 32 8
3388 33 9
3389 34 745
3390 35 34
3391 36 34
3392 37 324
3393 38 67
3394 39 78
3395 40 89
3396 41 90
3397 42 78967
3398 50 56
3399 51 34
3400 55 123
3401 60 19
3402 -------------------------
3403 ---- some alter table end
3404 -------------------------
3405 drop table if exists t1 ;
3406 drop table if exists t2 ;
3407 drop table if exists t3 ;
3408 drop table if exists t4 ;
3409 drop table if exists t5 ;
3410 drop table if exists t6 ;
3411 drop table if exists t11 ;
3412 drop table if exists t22 ;
3413 drop table if exists t33 ;
3414 drop table if exists t44 ;
3415 drop table if exists t55 ;
3416 drop table if exists t66 ;
3417 -------------------------------------------------------------------------
3418 --- day(col1) in partition with coltype date
3419 -------------------------------------------------------------------------
3420 drop table if exists t1 ;
3421 drop table if exists t2 ;
3422 drop table if exists t3 ;
3423 drop table if exists t4 ;
3424 drop table if exists t5 ;
3425 drop table if exists t6 ;
3426 -------------------------------------------------------------------------
3427 --- Create tables with day(col1)
3428 -------------------------------------------------------------------------
3429 create table t1 (col1 date) engine='INNODB'
3430 partition by range(day(col1))
3431 (partition p0 values less than (15),
3432 partition p1 values less than maxvalue);
3433 create table t2 (col1 date) engine='INNODB'
3434 partition by list(day(col1))
3435 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
3436 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
3437 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
3438 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
3439 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
3440 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
3441 );
3442 create table t3 (col1 date) engine='INNODB'
3443 partition by hash(day(col1));
3444 create table t4 (colint int, col1 date) engine='INNODB'
3445 partition by range(colint)
3446 subpartition by hash(day(col1)) subpartitions 2
3447 (partition p0 values less than (15),
3448 partition p1 values less than maxvalue);
3449 create table t5 (colint int, col1 date) engine='INNODB'
3450 partition by list(colint)
3451 subpartition by hash(day(col1)) subpartitions 2
3452 (partition p0 values in (1,2,3,4,5,6,7,8,9,10),
3453 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
3454 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
3455 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
3456 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
3457 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
3458 );
3459 create table t6 (colint int, col1 date) engine='INNODB'
3460 partition by range(colint)
3461 (partition p0 values less than (day('2006-12-21')),
3462 partition p1 values less than maxvalue);
3463 -------------------------------------------------------------------------
3464 --- Access tables with day(col1)
3465 -------------------------------------------------------------------------
3466 begin;
3467 insert into t1 values ('2006-02-03');
3468 insert into t1 values ('2006-01-17');
3469 insert into t2 values ('2006-02-03');
3470 insert into t2 values ('2006-01-17');
3471 insert into t2 values ('2006-01-25');
3472 insert into t3 values ('2006-02-03');
3473 insert into t3 values ('2006-01-17');
3474 insert into t3 values ('2006-01-25');
3475 commit;
3476 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4;
3477 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5;
3478 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6;
3479 select day(col1) from t1 order by col1;
3480 day(col1)
3481 17
3482 3
3483 select * from t1 order by col1;
3484 col1
3485 2006-01-17
3486 2006-02-03
3487 select * from t2 order by col1;
3488 col1
3489 2006-01-17
3490 2006-01-25
3491 2006-02-03
3492 select * from t3 order by col1;
3493 col1
3494 2006-01-17
3495 2006-01-25
3496 2006-02-03
3497 select * from t4 order by colint;
3498 colint col1
3499 1 2006-02-03
3500 2 2006-01-17
3501 3 2006-01-25
3502 4 2006-02-05
3503 select * from t5 order by colint;
3504 colint col1
3505 1 2006-02-03
3506 2 2006-01-17
3507 3 2006-01-25
3508 4 2006-02-05
3509 select * from t6 order by colint;
3510 colint col1
3511 1 2006-02-03
3512 2 2006-01-17
3513 3 2006-01-25
3514 4 2006-02-05
3515 begin;
3516 update t1 set col1='2006-02-05' where col1='2006-02-03';
3517 update t2 set col1='2006-02-05' where col1='2006-02-03';
3518 update t3 set col1='2006-02-05' where col1='2006-02-03';
3519 update t4 set col1='2006-02-05' where col1='2006-02-03';
3520 update t5 set col1='2006-02-05' where col1='2006-02-03';
3521 update t6 set col1='2006-02-05' where col1='2006-02-03';
3522 commit;
3523 select * from t1 order by col1;
3524 col1
3525 2006-01-17
3526 2006-02-05
3527 select * from t2 order by col1;
3528 col1
3529 2006-01-17
3530 2006-01-25
3531 2006-02-05
3532 select * from t3 order by col1;
3533 col1
3534 2006-01-17
3535 2006-01-25
3536 2006-02-05
3537 select * from t4 order by colint;
3538 colint col1
3539 1 2006-02-05
3540 2 2006-01-17
3541 3 2006-01-25
3542 4 2006-02-05
3543 select * from t5 order by colint;
3544 colint col1
3545 1 2006-02-05
3546 2 2006-01-17
3547 3 2006-01-25
3548 4 2006-02-05
3549 select * from t6 order by colint;
3550 colint col1
3551 1 2006-02-05
3552 2 2006-01-17
3553 3 2006-01-25
3554 4 2006-02-05
3555 -------------------------------------------------------------------------
3556 --- Alter tables with day(col1)
3557 -------------------------------------------------------------------------
3558 drop table if exists t11 ;
3559 drop table if exists t22 ;
3560 drop table if exists t33 ;
3561 drop table if exists t44 ;
3562 drop table if exists t55 ;
3563 drop table if exists t66 ;
3564 create table t11 engine='INNODB' as select * from t1;
3565 create table t22 engine='INNODB' as select * from t2;
3566 create table t33 engine='INNODB' as select * from t3;
3567 create table t44 engine='INNODB' as select * from t4;
3568 create table t55 engine='INNODB' as select * from t5;
3569 create table t66 engine='INNODB' as select * from t6;
3570 alter table t11
3571 partition by range(day(col1))
3572 (partition p0 values less than (15),
3573 partition p1 values less than maxvalue);
3574 alter table t22
3575 partition by list(day(col1))
3576 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
3577 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
3578 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
3579 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
3580 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
3581 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
3582 );
3583 alter table t33
3584 partition by hash(day(col1));
3585 alter table t44
3586 partition by range(colint)
3587 subpartition by hash(day(col1)) subpartitions 2
3588 (partition p0 values less than (15),
3589 partition p1 values less than maxvalue);
3590 alter table t55
3591 partition by list(colint)
3592 subpartition by hash(day(col1)) subpartitions 2
3593 (partition p0 values in (1,2,3,4,5,6,7,8,9,10),
3594 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
3595 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
3596 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
3597 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
3598 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
3599 );
3600 alter table t66
3601 partition by range(colint)
3602 (partition p0 values less than (day('2006-12-21')),
3603 partition p1 values less than maxvalue);
3604 select * from t11 order by col1;
3605 col1
3606 2006-01-17
3607 2006-02-05
3608 select * from t22 order by col1;
3609 col1
3610 2006-01-17
3611 2006-01-25
3612 2006-02-05
3613 select * from t33 order by col1;
3614 col1
3615 2006-01-17
3616 2006-01-25
3617 2006-02-05
3618 select * from t44 order by colint;
3619 colint col1
3620 1 2006-02-05
3621 2 2006-01-17
3622 3 2006-01-25
3623 4 2006-02-05
3624 select * from t55 order by colint;
3625 colint col1
3626 1 2006-02-05
3627 2 2006-01-17
3628 3 2006-01-25
3629 4 2006-02-05
3630 select * from t66 order by colint;
3631 colint col1
3632 1 2006-02-05
3633 2 2006-01-17
3634 3 2006-01-25
3635 4 2006-02-05
3636 ---------------------------
3637 ---- some alter table begin
3638 ---------------------------
3639 alter table t11
3640 reorganize partition p0,p1 into
3641 (partition s1 values less than maxvalue);
3642 select * from t11 order by col1;
3643 col1
3644 2006-01-17
3645 2006-02-05
3646 alter table t11
3647 reorganize partition s1 into
3648 (partition p0 values less than (15),
3649 partition p1 values less than maxvalue);
3650 select * from t11 order by col1;
3651 col1
3652 2006-01-17
3653 2006-02-05
3654 alter table t55
3655 partition by list(colint)
3656 subpartition by hash(day(col1)) subpartitions 5
3657 (partition p0 values in (1,2,3,4,5,6,7,8,9,10),
3658 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
3659 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
3660 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
3661 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
3662 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
3663 );
3664 show create table t55;
3665 Table Create Table
3666 t55 CREATE TABLE `t55` (
3667 `colint` int(11) DEFAULT NULL,
3668 `col1` date DEFAULT NULL
3669 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
3670 PARTITION BY LIST (`colint`)
3671 SUBPARTITION BY HASH (dayofmonth(`col1`))
3672 SUBPARTITIONS 5
3673 (PARTITION `p0` VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB,
3674 PARTITION `p1` VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB,
3675 PARTITION `p2` VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB,
3676 PARTITION `p3` VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB,
3677 PARTITION `p4` VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB,
3678 PARTITION `p5` VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB)
3679 select * from t55 order by colint;
3680 colint col1
3681 1 2006-02-05
3682 2 2006-01-17
3683 3 2006-01-25
3684 4 2006-02-05
3685 alter table t66
3686 reorganize partition p0,p1 into
3687 (partition s1 values less than maxvalue);
3688 select * from t66 order by colint;
3689 colint col1
3690 1 2006-02-05
3691 2 2006-01-17
3692 3 2006-01-25
3693 4 2006-02-05
3694 alter table t66
3695 reorganize partition s1 into
3696 (partition p0 values less than (day('2006-12-21')),
3697 partition p1 values less than maxvalue);
3698 select * from t66 order by colint;
3699 colint col1
3700 1 2006-02-05
3701 2 2006-01-17
3702 3 2006-01-25
3703 4 2006-02-05
3704 alter table t66
3705 reorganize partition p0,p1 into
3706 (partition s1 values less than maxvalue);
3707 select * from t66 order by colint;
3708 colint col1
3709 1 2006-02-05
3710 2 2006-01-17
3711 3 2006-01-25
3712 4 2006-02-05
3713 alter table t66
3714 reorganize partition s1 into
3715 (partition p0 values less than (day('2006-12-21')),
3716 partition p1 values less than maxvalue);
3717 select * from t66 order by colint;
3718 colint col1
3719 1 2006-02-05
3720 2 2006-01-17
3721 3 2006-01-25
3722 4 2006-02-05
3723 -------------------------------------------------------------------------
3724 --- Delete rows and partitions of tables with day(col1)
3725 -------------------------------------------------------------------------
3726 begin;
3727 delete from t1 where col1='2006-01-17';
3728 delete from t2 where col1='2006-01-17';
3729 delete from t3 where col1='2006-01-17';
3730 delete from t4 where col1='2006-01-17';
3731 delete from t5 where col1='2006-01-17';
3732 delete from t6 where col1='2006-01-17';
3733 commit;
3734 select * from t1 order by col1;
3735 col1
3736 2006-02-05
3737 select * from t2 order by col1;
3738 col1
3739 2006-01-25
3740 2006-02-05
3741 select * from t3 order by col1;
3742 col1
3743 2006-01-25
3744 2006-02-05
3745 select * from t4 order by colint;
3746 colint col1
3747 1 2006-02-05
3748 3 2006-01-25
3749 4 2006-02-05
3750 select * from t5 order by colint;
3751 colint col1
3752 1 2006-02-05
3753 3 2006-01-25
3754 4 2006-02-05
3755 begin;
3756 insert into t1 values ('2006-01-17');
3757 insert into t2 values ('2006-01-17');
3758 insert into t3 values ('2006-01-17');
3759 insert into t4 values (60,'2006-01-17');
3760 insert into t5 values (60,'2006-01-17');
3761 insert into t6 values (60,'2006-01-17');
3762 commit;
3763 select * from t1 order by col1;
3764 col1
3765 2006-01-17
3766 2006-02-05
3767 select * from t2 order by col1;
3768 col1
3769 2006-01-17
3770 2006-01-25
3771 2006-02-05
3772 select * from t3 order by col1;
3773 col1
3774 2006-01-17
3775 2006-01-25
3776 2006-02-05
3777 select * from t4 order by colint;
3778 colint col1
3779 1 2006-02-05
3780 3 2006-01-25
3781 4 2006-02-05
3782 60 2006-01-17
3783 select * from t5 order by colint;
3784 colint col1
3785 1 2006-02-05
3786 3 2006-01-25
3787 4 2006-02-05
3788 60 2006-01-17
3789 select * from t6 order by colint;
3790 colint col1
3791 1 2006-02-05
3792 3 2006-01-25
3793 4 2006-02-05
3794 60 2006-01-17
3795 alter table t1 drop partition p0;
3796 alter table t2 drop partition p0;
3797 alter table t4 drop partition p0;
3798 alter table t5 drop partition p0;
3799 alter table t6 drop partition p0;
3800 select * from t1 order by col1;
3801 col1
3802 2006-01-17
3803 select * from t2 order by col1;
3804 col1
3805 2006-01-17
3806 2006-01-25
3807 select * from t3 order by col1;
3808 col1
3809 2006-01-17
3810 2006-01-25
3811 2006-02-05
3812 select * from t4 order by colint;
3813 colint col1
3814 60 2006-01-17
3815 select * from t5 order by colint;
3816 colint col1
3817 60 2006-01-17
3818 select * from t6 order by colint;
3819 colint col1
3820 60 2006-01-17
3821 -------------------------------------------------------------------------
3822 --- Delete rows and partitions of tables with day(col1)
3823 -------------------------------------------------------------------------
3824 begin;
3825 delete from t11 where col1='2006-01-17';
3826 delete from t22 where col1='2006-01-17';
3827 delete from t33 where col1='2006-01-17';
3828 delete from t44 where col1='2006-01-17';
3829 delete from t55 where col1='2006-01-17';
3830 delete from t66 where col1='2006-01-17';
3831 commit;
3832 select * from t11 order by col1;
3833 col1
3834 2006-02-05
3835 select * from t22 order by col1;
3836 col1
3837 2006-01-25
3838 2006-02-05
3839 select * from t33 order by col1;
3840 col1
3841 2006-01-25
3842 2006-02-05
3843 select * from t44 order by colint;
3844 colint col1
3845 1 2006-02-05
3846 3 2006-01-25
3847 4 2006-02-05
3848 select * from t55 order by colint;
3849 colint col1
3850 1 2006-02-05
3851 3 2006-01-25
3852 4 2006-02-05
3853 begin;
3854 insert into t11 values ('2006-01-17');
3855 insert into t22 values ('2006-01-17');
3856 insert into t33 values ('2006-01-17');
3857 insert into t44 values (60,'2006-01-17');
3858 insert into t55 values (60,'2006-01-17');
3859 insert into t66 values (60,'2006-01-17');
3860 commit;
3861 select * from t11 order by col1;
3862 col1
3863 2006-01-17
3864 2006-02-05
3865 select * from t22 order by col1;
3866 col1
3867 2006-01-17
3868 2006-01-25
3869 2006-02-05
3870 select * from t33 order by col1;
3871 col1
3872 2006-01-17
3873 2006-01-25
3874 2006-02-05
3875 select * from t44 order by colint;
3876 colint col1
3877 1 2006-02-05
3878 3 2006-01-25
3879 4 2006-02-05
3880 60 2006-01-17
3881 select * from t55 order by colint;
3882 colint col1
3883 1 2006-02-05
3884 3 2006-01-25
3885 4 2006-02-05
3886 60 2006-01-17
3887 select * from t66 order by colint;
3888 colint col1
3889 1 2006-02-05
3890 3 2006-01-25
3891 4 2006-02-05
3892 60 2006-01-17
3893 alter table t11 drop partition p0;
3894 alter table t22 drop partition p0;
3895 alter table t44 drop partition p0;
3896 alter table t55 drop partition p0;
3897 alter table t66 drop partition p0;
3898 select * from t11 order by col1;
3899 col1
3900 2006-01-17
3901 select * from t22 order by col1;
3902 col1
3903 2006-01-17
3904 2006-01-25
3905 select * from t33 order by col1;
3906 col1
3907 2006-01-17
3908 2006-01-25
3909 2006-02-05
3910 select * from t44 order by colint;
3911 colint col1
3912 60 2006-01-17
3913 select * from t55 order by colint;
3914 colint col1
3915 60 2006-01-17
3916 select * from t66 order by colint;
3917 colint col1
3918 60 2006-01-17
3919 -------------------------
3920 ---- some alter table end
3921 -------------------------
3922 drop table if exists t1 ;
3923 drop table if exists t2 ;
3924 drop table if exists t3 ;
3925 drop table if exists t4 ;
3926 drop table if exists t5 ;
3927 drop table if exists t6 ;
3928 drop table if exists t11 ;
3929 drop table if exists t22 ;
3930 drop table if exists t33 ;
3931 drop table if exists t44 ;
3932 drop table if exists t55 ;
3933 drop table if exists t66 ;
3934 -------------------------------------------------------------------------
3935 --- dayofmonth(col1) in partition with coltype date
3936 -------------------------------------------------------------------------
3937 drop table if exists t1 ;
3938 drop table if exists t2 ;
3939 drop table if exists t3 ;
3940 drop table if exists t4 ;
3941 drop table if exists t5 ;
3942 drop table if exists t6 ;
3943 -------------------------------------------------------------------------
3944 --- Create tables with dayofmonth(col1)
3945 -------------------------------------------------------------------------
3946 create table t1 (col1 date) engine='INNODB'
3947 partition by range(dayofmonth(col1))
3948 (partition p0 values less than (15),
3949 partition p1 values less than maxvalue);
3950 create table t2 (col1 date) engine='INNODB'
3951 partition by list(dayofmonth(col1))
3952 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
3953 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
3954 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
3955 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
3956 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
3957 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
3958 );
3959 create table t3 (col1 date) engine='INNODB'
3960 partition by hash(dayofmonth(col1));
3961 create table t4 (colint int, col1 date) engine='INNODB'
3962 partition by range(colint)
3963 subpartition by hash(dayofmonth(col1)) subpartitions 2
3964 (partition p0 values less than (15),
3965 partition p1 values less than maxvalue);
3966 create table t5 (colint int, col1 date) engine='INNODB'
3967 partition by list(colint)
3968 subpartition by hash(dayofmonth(col1)) subpartitions 2
3969 (partition p0 values in (1,2,3,4,5,6,7,8,9,10),
3970 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
3971 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
3972 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
3973 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
3974 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
3975 );
3976 create table t6 (colint int, col1 date) engine='INNODB'
3977 partition by range(colint)
3978 (partition p0 values less than (dayofmonth('2006-12-24')),
3979 partition p1 values less than maxvalue);
3980 -------------------------------------------------------------------------
3981 --- Access tables with dayofmonth(col1)
3982 -------------------------------------------------------------------------
3983 begin;
3984 insert into t1 values ('2006-02-03');
3985 insert into t1 values ('2006-01-17');
3986 insert into t2 values ('2006-02-03');
3987 insert into t2 values ('2006-01-17');
3988 insert into t2 values ('2006-01-25');
3989 insert into t3 values ('2006-02-03');
3990 insert into t3 values ('2006-01-17');
3991 insert into t3 values ('2006-01-25');
3992 commit;
3993 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4;
3994 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5;
3995 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6;
3996 select dayofmonth(col1) from t1 order by col1;
3997 dayofmonth(col1)
3998 17
3999 3
4000 select * from t1 order by col1;
4001 col1
4002 2006-01-17
4003 2006-02-03
4004 select * from t2 order by col1;
4005 col1
4006 2006-01-17
4007 2006-01-25
4008 2006-02-03
4009 select * from t3 order by col1;
4010 col1
4011 2006-01-17
4012 2006-01-25
4013 2006-02-03
4014 select * from t4 order by colint;
4015 colint col1
4016 1 2006-02-03
4017 2 2006-01-17
4018 3 2006-01-25
4019 4 2006-02-05
4020 select * from t5 order by colint;
4021 colint col1
4022 1 2006-02-03
4023 2 2006-01-17
4024 3 2006-01-25
4025 4 2006-02-05
4026 select * from t6 order by colint;
4027 colint col1
4028 1 2006-02-03
4029 2 2006-01-17
4030 3 2006-01-25
4031 4 2006-02-05
4032 begin;
4033 update t1 set col1='2006-02-05' where col1='2006-02-03';
4034 update t2 set col1='2006-02-05' where col1='2006-02-03';
4035 update t3 set col1='2006-02-05' where col1='2006-02-03';
4036 update t4 set col1='2006-02-05' where col1='2006-02-03';
4037 update t5 set col1='2006-02-05' where col1='2006-02-03';
4038 update t6 set col1='2006-02-05' where col1='2006-02-03';
4039 commit;
4040 select * from t1 order by col1;
4041 col1
4042 2006-01-17
4043 2006-02-05
4044 select * from t2 order by col1;
4045 col1
4046 2006-01-17
4047 2006-01-25
4048 2006-02-05
4049 select * from t3 order by col1;
4050 col1
4051 2006-01-17
4052 2006-01-25
4053 2006-02-05
4054 select * from t4 order by colint;
4055 colint col1
4056 1 2006-02-05
4057 2 2006-01-17
4058 3 2006-01-25
4059 4 2006-02-05
4060 select * from t5 order by colint;
4061 colint col1
4062 1 2006-02-05
4063 2 2006-01-17
4064 3 2006-01-25
4065 4 2006-02-05
4066 select * from t6 order by colint;
4067 colint col1
4068 1 2006-02-05
4069 2 2006-01-17
4070 3 2006-01-25
4071 4 2006-02-05
4072 -------------------------------------------------------------------------
4073 --- Alter tables with dayofmonth(col1)
4074 -------------------------------------------------------------------------
4075 drop table if exists t11 ;
4076 drop table if exists t22 ;
4077 drop table if exists t33 ;
4078 drop table if exists t44 ;
4079 drop table if exists t55 ;
4080 drop table if exists t66 ;
4081 create table t11 engine='INNODB' as select * from t1;
4082 create table t22 engine='INNODB' as select * from t2;
4083 create table t33 engine='INNODB' as select * from t3;
4084 create table t44 engine='INNODB' as select * from t4;
4085 create table t55 engine='INNODB' as select * from t5;
4086 create table t66 engine='INNODB' as select * from t6;
4087 alter table t11
4088 partition by range(dayofmonth(col1))
4089 (partition p0 values less than (15),
4090 partition p1 values less than maxvalue);
4091 alter table t22
4092 partition by list(dayofmonth(col1))
4093 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
4094 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
4095 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
4096 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
4097 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
4098 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
4099 );
4100 alter table t33
4101 partition by hash(dayofmonth(col1));
4102 alter table t44
4103 partition by range(colint)
4104 subpartition by hash(dayofmonth(col1)) subpartitions 2
4105 (partition p0 values less than (15),
4106 partition p1 values less than maxvalue);
4107 alter table t55
4108 partition by list(colint)
4109 subpartition by hash(dayofmonth(col1)) subpartitions 2
4110 (partition p0 values in (1,2,3,4,5,6,7,8,9,10),
4111 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
4112 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
4113 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
4114 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
4115 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
4116 );
4117 alter table t66
4118 partition by range(colint)
4119 (partition p0 values less than (dayofmonth('2006-12-24')),
4120 partition p1 values less than maxvalue);
4121 select * from t11 order by col1;
4122 col1
4123 2006-01-17
4124 2006-02-05
4125 select * from t22 order by col1;
4126 col1
4127 2006-01-17
4128 2006-01-25
4129 2006-02-05
4130 select * from t33 order by col1;
4131 col1
4132 2006-01-17
4133 2006-01-25
4134 2006-02-05
4135 select * from t44 order by colint;
4136 colint col1
4137 1 2006-02-05
4138 2 2006-01-17
4139 3 2006-01-25
4140 4 2006-02-05
4141 select * from t55 order by colint;
4142 colint col1
4143 1 2006-02-05
4144 2 2006-01-17
4145 3 2006-01-25
4146 4 2006-02-05
4147 select * from t66 order by colint;
4148 colint col1
4149 1 2006-02-05
4150 2 2006-01-17
4151 3 2006-01-25
4152 4 2006-02-05
4153 ---------------------------
4154 ---- some alter table begin
4155 ---------------------------
4156 alter table t11
4157 reorganize partition p0,p1 into
4158 (partition s1 values less than maxvalue);
4159 select * from t11 order by col1;
4160 col1
4161 2006-01-17
4162 2006-02-05
4163 alter table t11
4164 reorganize partition s1 into
4165 (partition p0 values less than (15),
4166 partition p1 values less than maxvalue);
4167 select * from t11 order by col1;
4168 col1
4169 2006-01-17
4170 2006-02-05
4171 alter table t55
4172 partition by list(colint)
4173 subpartition by hash(dayofmonth(col1)) subpartitions 5
4174 (partition p0 values in (1,2,3,4,5,6,7,8,9,10),
4175 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
4176 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
4177 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
4178 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
4179 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
4180 );
4181 show create table t55;
4182 Table Create Table
4183 t55 CREATE TABLE `t55` (
4184 `colint` int(11) DEFAULT NULL,
4185 `col1` date DEFAULT NULL
4186 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
4187 PARTITION BY LIST (`colint`)
4188 SUBPARTITION BY HASH (dayofmonth(`col1`))
4189 SUBPARTITIONS 5
4190 (PARTITION `p0` VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB,
4191 PARTITION `p1` VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB,
4192 PARTITION `p2` VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB,
4193 PARTITION `p3` VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB,
4194 PARTITION `p4` VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB,
4195 PARTITION `p5` VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB)
4196 select * from t55 order by colint;
4197 colint col1
4198 1 2006-02-05
4199 2 2006-01-17
4200 3 2006-01-25
4201 4 2006-02-05
4202 alter table t66
4203 reorganize partition p0,p1 into
4204 (partition s1 values less than maxvalue);
4205 select * from t66 order by colint;
4206 colint col1
4207 1 2006-02-05
4208 2 2006-01-17
4209 3 2006-01-25
4210 4 2006-02-05
4211 alter table t66
4212 reorganize partition s1 into
4213 (partition p0 values less than (dayofmonth('2006-12-24')),
4214 partition p1 values less than maxvalue);
4215 select * from t66 order by colint;
4216 colint col1
4217 1 2006-02-05
4218 2 2006-01-17
4219 3 2006-01-25
4220 4 2006-02-05
4221 alter table t66
4222 reorganize partition p0,p1 into
4223 (partition s1 values less than maxvalue);
4224 select * from t66 order by colint;
4225 colint col1
4226 1 2006-02-05
4227 2 2006-01-17
4228 3 2006-01-25
4229 4 2006-02-05
4230 alter table t66
4231 reorganize partition s1 into
4232 (partition p0 values less than (dayofmonth('2006-12-24')),
4233 partition p1 values less than maxvalue);
4234 select * from t66 order by colint;
4235 colint col1
4236 1 2006-02-05
4237 2 2006-01-17
4238 3 2006-01-25
4239 4 2006-02-05
4240 -------------------------------------------------------------------------
4241 --- Delete rows and partitions of tables with dayofmonth(col1)
4242 -------------------------------------------------------------------------
4243 begin;
4244 delete from t1 where col1='2006-01-17';
4245 delete from t2 where col1='2006-01-17';
4246 delete from t3 where col1='2006-01-17';
4247 delete from t4 where col1='2006-01-17';
4248 delete from t5 where col1='2006-01-17';
4249 delete from t6 where col1='2006-01-17';
4250 commit;
4251 select * from t1 order by col1;
4252 col1
4253 2006-02-05
4254 select * from t2 order by col1;
4255 col1
4256 2006-01-25
4257 2006-02-05
4258 select * from t3 order by col1;
4259 col1
4260 2006-01-25
4261 2006-02-05
4262 select * from t4 order by colint;
4263 colint col1
4264 1 2006-02-05
4265 3 2006-01-25
4266 4 2006-02-05
4267 select * from t5 order by colint;
4268 colint col1
4269 1 2006-02-05
4270 3 2006-01-25
4271 4 2006-02-05
4272 begin;
4273 insert into t1 values ('2006-01-17');
4274 insert into t2 values ('2006-01-17');
4275 insert into t3 values ('2006-01-17');
4276 insert into t4 values (60,'2006-01-17');
4277 insert into t5 values (60,'2006-01-17');
4278 insert into t6 values (60,'2006-01-17');
4279 commit;
4280 select * from t1 order by col1;
4281 col1
4282 2006-01-17
4283 2006-02-05
4284 select * from t2 order by col1;
4285 col1
4286 2006-01-17
4287 2006-01-25
4288 2006-02-05
4289 select * from t3 order by col1;
4290 col1
4291 2006-01-17
4292 2006-01-25
4293 2006-02-05
4294 select * from t4 order by colint;
4295 colint col1
4296 1 2006-02-05
4297 3 2006-01-25
4298 4 2006-02-05
4299 60 2006-01-17
4300 select * from t5 order by colint;
4301 colint col1
4302 1 2006-02-05
4303 3 2006-01-25
4304 4 2006-02-05
4305 60 2006-01-17
4306 select * from t6 order by colint;
4307 colint col1
4308 1 2006-02-05
4309 3 2006-01-25
4310 4 2006-02-05
4311 60 2006-01-17
4312 alter table t1 drop partition p0;
4313 alter table t2 drop partition p0;
4314 alter table t4 drop partition p0;
4315 alter table t5 drop partition p0;
4316 alter table t6 drop partition p0;
4317 select * from t1 order by col1;
4318 col1
4319 2006-01-17
4320 select * from t2 order by col1;
4321 col1
4322 2006-01-17
4323 2006-01-25
4324 select * from t3 order by col1;
4325 col1
4326 2006-01-17
4327 2006-01-25
4328 2006-02-05
4329 select * from t4 order by colint;
4330 colint col1
4331 60 2006-01-17
4332 select * from t5 order by colint;
4333 colint col1
4334 60 2006-01-17
4335 select * from t6 order by colint;
4336 colint col1
4337 60 2006-01-17
4338 -------------------------------------------------------------------------
4339 --- Delete rows and partitions of tables with dayofmonth(col1)
4340 -------------------------------------------------------------------------
4341 begin;
4342 delete from t11 where col1='2006-01-17';
4343 delete from t22 where col1='2006-01-17';
4344 delete from t33 where col1='2006-01-17';
4345 delete from t44 where col1='2006-01-17';
4346 delete from t55 where col1='2006-01-17';
4347 delete from t66 where col1='2006-01-17';
4348 commit;
4349 select * from t11 order by col1;
4350 col1
4351 2006-02-05
4352 select * from t22 order by col1;
4353 col1
4354 2006-01-25
4355 2006-02-05
4356 select * from t33 order by col1;
4357 col1
4358 2006-01-25
4359 2006-02-05
4360 select * from t44 order by colint;
4361 colint col1
4362 1 2006-02-05
4363 3 2006-01-25
4364 4 2006-02-05
4365 select * from t55 order by colint;
4366 colint col1
4367 1 2006-02-05
4368 3 2006-01-25
4369 4 2006-02-05
4370 begin;
4371 insert into t11 values ('2006-01-17');
4372 insert into t22 values ('2006-01-17');
4373 insert into t33 values ('2006-01-17');
4374 insert into t44 values (60,'2006-01-17');
4375 insert into t55 values (60,'2006-01-17');
4376 insert into t66 values (60,'2006-01-17');
4377 commit;
4378 select * from t11 order by col1;
4379 col1
4380 2006-01-17
4381 2006-02-05
4382 select * from t22 order by col1;
4383 col1
4384 2006-01-17
4385 2006-01-25
4386 2006-02-05
4387 select * from t33 order by col1;
4388 col1
4389 2006-01-17
4390 2006-01-25
4391 2006-02-05
4392 select * from t44 order by colint;
4393 colint col1
4394 1 2006-02-05
4395 3 2006-01-25
4396 4 2006-02-05
4397 60 2006-01-17
4398 select * from t55 order by colint;
4399 colint col1
4400 1 2006-02-05
4401 3 2006-01-25
4402 4 2006-02-05
4403 60 2006-01-17
4404 select * from t66 order by colint;
4405 colint col1
4406 1 2006-02-05
4407 3 2006-01-25
4408 4 2006-02-05
4409 60 2006-01-17
4410 alter table t11 drop partition p0;
4411 alter table t22 drop partition p0;
4412 alter table t44 drop partition p0;
4413 alter table t55 drop partition p0;
4414 alter table t66 drop partition p0;
4415 select * from t11 order by col1;
4416 col1
4417 2006-01-17
4418 select * from t22 order by col1;
4419 col1
4420 2006-01-17
4421 2006-01-25
4422 select * from t33 order by col1;
4423 col1
4424 2006-01-17
4425 2006-01-25
4426 2006-02-05
4427 select * from t44 order by colint;
4428 colint col1
4429 60 2006-01-17
4430 select * from t55 order by colint;
4431 colint col1
4432 60 2006-01-17
4433 select * from t66 order by colint;
4434 colint col1
4435 60 2006-01-17
4436 -------------------------
4437 ---- some alter table end
4438 -------------------------
4439 drop table if exists t1 ;
4440 drop table if exists t2 ;
4441 drop table if exists t3 ;
4442 drop table if exists t4 ;
4443 drop table if exists t5 ;
4444 drop table if exists t6 ;
4445 drop table if exists t11 ;
4446 drop table if exists t22 ;
4447 drop table if exists t33 ;
4448 drop table if exists t44 ;
4449 drop table if exists t55 ;
4450 drop table if exists t66 ;
4451 -------------------------------------------------------------------------
4452 --- dayofweek(col1) in partition with coltype date
4453 -------------------------------------------------------------------------
4454 drop table if exists t1 ;
4455 drop table if exists t2 ;
4456 drop table if exists t3 ;
4457 drop table if exists t4 ;
4458 drop table if exists t5 ;
4459 drop table if exists t6 ;
4460 -------------------------------------------------------------------------
4461 --- Create tables with dayofweek(col1)
4462 -------------------------------------------------------------------------
4463 create table t1 (col1 date) engine='INNODB'
4464 partition by range(dayofweek(col1))
4465 (partition p0 values less than (15),
4466 partition p1 values less than maxvalue);
4467 create table t2 (col1 date) engine='INNODB'
4468 partition by list(dayofweek(col1))
4469 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
4470 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
4471 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
4472 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
4473 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
4474 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
4475 );
4476 create table t3 (col1 date) engine='INNODB'
4477 partition by hash(dayofweek(col1));
4478 create table t4 (colint int, col1 date) engine='INNODB'
4479 partition by range(colint)
4480 subpartition by hash(dayofweek(col1)) subpartitions 2
4481 (partition p0 values less than (15),
4482 partition p1 values less than maxvalue);
4483 create table t5 (colint int, col1 date) engine='INNODB'
4484 partition by list(colint)
4485 subpartition by hash(dayofweek(col1)) subpartitions 2
4486 (partition p0 values in (1,2,3,4,5,6,7,8,9,10),
4487 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
4488 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
4489 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
4490 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
4491 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
4492 );
4493 create table t6 (colint int, col1 date) engine='INNODB'
4494 partition by range(colint)
4495 (partition p0 values less than (dayofweek('2006-12-24')),
4496 partition p1 values less than maxvalue);
4497 -------------------------------------------------------------------------
4498 --- Access tables with dayofweek(col1)
4499 -------------------------------------------------------------------------
4500 begin;
4501 insert into t1 values ('2006-01-03');
4502 insert into t1 values ('2006-02-17');
4503 insert into t2 values ('2006-01-03');
4504 insert into t2 values ('2006-02-17');
4505 insert into t2 values ('2006-01-25');
4506 insert into t3 values ('2006-01-03');
4507 insert into t3 values ('2006-02-17');
4508 insert into t3 values ('2006-01-25');
4509 commit;
4510 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4;
4511 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5;
4512 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6;
4513 select dayofweek(col1) from t1 order by col1;
4514 dayofweek(col1)
4515 3
4516 6
4517 select * from t1 order by col1;
4518 col1
4519 2006-01-03
4520 2006-02-17
4521 select * from t2 order by col1;
4522 col1
4523 2006-01-03
4524 2006-01-25
4525 2006-02-17
4526 select * from t3 order by col1;
4527 col1
4528 2006-01-03
4529 2006-01-25
4530 2006-02-17
4531 select * from t4 order by colint;
4532 colint col1
4533 1 2006-02-03
4534 2 2006-01-17
4535 3 2006-01-25
4536 4 2006-02-05
4537 select * from t5 order by colint;
4538 colint col1
4539 1 2006-02-03
4540 2 2006-01-17
4541 3 2006-01-25
4542 4 2006-02-05
4543 select * from t6 order by colint;
4544 colint col1
4545 1 2006-02-03
4546 2 2006-01-17
4547 3 2006-01-25
4548 4 2006-02-05
4549 begin;
4550 update t1 set col1='2006-02-05' where col1='2006-01-03';
4551 update t2 set col1='2006-02-05' where col1='2006-01-03';
4552 update t3 set col1='2006-02-05' where col1='2006-01-03';
4553 update t4 set col1='2006-02-05' where col1='2006-01-03';
4554 update t5 set col1='2006-02-05' where col1='2006-01-03';
4555 update t6 set col1='2006-02-05' where col1='2006-01-03';
4556 commit;
4557 select * from t1 order by col1;
4558 col1
4559 2006-02-05
4560 2006-02-17
4561 select * from t2 order by col1;
4562 col1
4563 2006-01-25
4564 2006-02-05
4565 2006-02-17
4566 select * from t3 order by col1;
4567 col1
4568 2006-01-25
4569 2006-02-05
4570 2006-02-17
4571 select * from t4 order by colint;
4572 colint col1
4573 1 2006-02-03
4574 2 2006-01-17
4575 3 2006-01-25
4576 4 2006-02-05
4577 select * from t5 order by colint;
4578 colint col1
4579 1 2006-02-03
4580 2 2006-01-17
4581 3 2006-01-25
4582 4 2006-02-05
4583 select * from t6 order by colint;
4584 colint col1
4585 1 2006-02-03
4586 2 2006-01-17
4587 3 2006-01-25
4588 4 2006-02-05
4589 -------------------------------------------------------------------------
4590 --- Alter tables with dayofweek(col1)
4591 -------------------------------------------------------------------------
4592 drop table if exists t11 ;
4593 drop table if exists t22 ;
4594 drop table if exists t33 ;
4595 drop table if exists t44 ;
4596 drop table if exists t55 ;
4597 drop table if exists t66 ;
4598 create table t11 engine='INNODB' as select * from t1;
4599 create table t22 engine='INNODB' as select * from t2;
4600 create table t33 engine='INNODB' as select * from t3;
4601 create table t44 engine='INNODB' as select * from t4;
4602 create table t55 engine='INNODB' as select * from t5;
4603 create table t66 engine='INNODB' as select * from t6;
4604 alter table t11
4605 partition by range(dayofweek(col1))
4606 (partition p0 values less than (15),
4607 partition p1 values less than maxvalue);
4608 alter table t22
4609 partition by list(dayofweek(col1))
4610 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
4611 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
4612 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
4613 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
4614 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
4615 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
4616 );
4617 alter table t33
4618 partition by hash(dayofweek(col1));
4619 alter table t44
4620 partition by range(colint)
4621 subpartition by hash(dayofweek(col1)) subpartitions 2
4622 (partition p0 values less than (15),
4623 partition p1 values less than maxvalue);
4624 alter table t55
4625 partition by list(colint)
4626 subpartition by hash(dayofweek(col1)) subpartitions 2
4627 (partition p0 values in (1,2,3,4,5,6,7,8,9,10),
4628 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
4629 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
4630 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
4631 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
4632 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
4633 );
4634 alter table t66
4635 partition by range(colint)
4636 (partition p0 values less than (dayofweek('2006-12-24')),
4637 partition p1 values less than maxvalue);
4638 select * from t11 order by col1;
4639 col1
4640 2006-02-05
4641 2006-02-17
4642 select * from t22 order by col1;
4643 col1
4644 2006-01-25
4645 2006-02-05
4646 2006-02-17
4647 select * from t33 order by col1;
4648 col1
4649 2006-01-25
4650 2006-02-05
4651 2006-02-17
4652 select * from t44 order by colint;
4653 colint col1
4654 1 2006-02-03
4655 2 2006-01-17
4656 3 2006-01-25
4657 4 2006-02-05
4658 select * from t55 order by colint;
4659 colint col1
4660 1 2006-02-03
4661 2 2006-01-17
4662 3 2006-01-25
4663 4 2006-02-05
4664 select * from t66 order by colint;
4665 colint col1
4666 1 2006-02-03
4667 2 2006-01-17
4668 3 2006-01-25
4669 4 2006-02-05
4670 ---------------------------
4671 ---- some alter table begin
4672 ---------------------------
4673 alter table t11
4674 reorganize partition p0,p1 into
4675 (partition s1 values less than maxvalue);
4676 select * from t11 order by col1;
4677 col1
4678 2006-02-05
4679 2006-02-17
4680 alter table t11
4681 reorganize partition s1 into
4682 (partition p0 values less than (15),
4683 partition p1 values less than maxvalue);
4684 select * from t11 order by col1;
4685 col1
4686 2006-02-05
4687 2006-02-17
4688 alter table t55
4689 partition by list(colint)
4690 subpartition by hash(dayofweek(col1)) subpartitions 5
4691 (partition p0 values in (1,2,3,4,5,6,7,8,9,10),
4692 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
4693 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
4694 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
4695 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
4696 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
4697 );
4698 show create table t55;
4699 Table Create Table
4700 t55 CREATE TABLE `t55` (
4701 `colint` int(11) DEFAULT NULL,
4702 `col1` date DEFAULT NULL
4703 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
4704 PARTITION BY LIST (`colint`)
4705 SUBPARTITION BY HASH (dayofweek(`col1`))
4706 SUBPARTITIONS 5
4707 (PARTITION `p0` VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB,
4708 PARTITION `p1` VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB,
4709 PARTITION `p2` VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB,
4710 PARTITION `p3` VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB,
4711 PARTITION `p4` VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB,
4712 PARTITION `p5` VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB)
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 alter table t66
4720 reorganize partition p0,p1 into
4721 (partition s1 values less than maxvalue);
4722 select * from t66 order by colint;
4723 colint col1
4724 1 2006-02-03
4725 2 2006-01-17
4726 3 2006-01-25
4727 4 2006-02-05
4728 alter table t66
4729 reorganize partition s1 into
4730 (partition p0 values less than (dayofweek('2006-12-24')),
4731 partition p1 values less than maxvalue);
4732 select * from t66 order by colint;
4733 colint col1
4734 1 2006-02-03
4735 2 2006-01-17
4736 3 2006-01-25
4737 4 2006-02-05
4738 alter table t66
4739 reorganize partition p0,p1 into
4740 (partition s1 values less than maxvalue);
4741 select * from t66 order by colint;
4742 colint col1
4743 1 2006-02-03
4744 2 2006-01-17
4745 3 2006-01-25
4746 4 2006-02-05
4747 alter table t66
4748 reorganize partition s1 into
4749 (partition p0 values less than (dayofweek('2006-12-24')),
4750 partition p1 values less than maxvalue);
4751 select * from t66 order by colint;
4752 colint col1
4753 1 2006-02-03
4754 2 2006-01-17
4755 3 2006-01-25
4756 4 2006-02-05
4757 -------------------------------------------------------------------------
4758 --- Delete rows and partitions of tables with dayofweek(col1)
4759 -------------------------------------------------------------------------
4760 begin;
4761 delete from t1 where col1='2006-02-17';
4762 delete from t2 where col1='2006-02-17';
4763 delete from t3 where col1='2006-02-17';
4764 delete from t4 where col1='2006-02-17';
4765 delete from t5 where col1='2006-02-17';
4766 delete from t6 where col1='2006-02-17';
4767 commit;
4768 select * from t1 order by col1;
4769 col1
4770 2006-02-05
4771 select * from t2 order by col1;
4772 col1
4773 2006-01-25
4774 2006-02-05
4775 select * from t3 order by col1;
4776 col1
4777 2006-01-25
4778 2006-02-05
4779 select * from t4 order by colint;
4780 colint col1
4781 1 2006-02-03
4782 2 2006-01-17
4783 3 2006-01-25
4784 4 2006-02-05
4785 select * from t5 order by colint;
4786 colint col1
4787 1 2006-02-03
4788 2 2006-01-17
4789 3 2006-01-25
4790 4 2006-02-05
4791 begin;
4792 insert into t1 values ('2006-02-17');
4793 insert into t2 values ('2006-02-17');
4794 insert into t3 values ('2006-02-17');
4795 insert into t4 values (60,'2006-02-17');
4796 insert into t5 values (60,'2006-02-17');
4797 insert into t6 values (60,'2006-02-17');
4798 commit;
4799 select * from t1 order by col1;
4800 col1
4801 2006-02-05
4802 2006-02-17
4803 select * from t2 order by col1;
4804 col1
4805 2006-01-25
4806 2006-02-05
4807 2006-02-17
4808 select * from t3 order by col1;
4809 col1
4810 2006-01-25
4811 2006-02-05
4812 2006-02-17
4813 select * from t4 order by colint;
4814 colint col1
4815 1 2006-02-03
4816 2 2006-01-17
4817 3 2006-01-25
4818 4 2006-02-05
4819 60 2006-02-17
4820 select * from t5 order by colint;
4821 colint col1
4822 1 2006-02-03
4823 2 2006-01-17
4824 3 2006-01-25
4825 4 2006-02-05
4826 60 2006-02-17
4827 select * from t6 order by colint;
4828 colint col1
4829 1 2006-02-03
4830 2 2006-01-17
4831 3 2006-01-25
4832 4 2006-02-05
4833 60 2006-02-17
4834 alter table t1 drop partition p0;
4835 alter table t2 drop partition p0;
4836 alter table t4 drop partition p0;
4837 alter table t5 drop partition p0;
4838 alter table t6 drop partition p0;
4839 select * from t1 order by col1;
4840 col1
4841 select * from t2 order by col1;
4842 col1
4843 select * from t3 order by col1;
4844 col1
4845 2006-01-25
4846 2006-02-05
4847 2006-02-17
4848 select * from t4 order by colint;
4849 colint col1
4850 60 2006-02-17
4851 select * from t5 order by colint;
4852 colint col1
4853 60 2006-02-17
4854 select * from t6 order by colint;
4855 colint col1
4856 1 2006-02-03
4857 2 2006-01-17
4858 3 2006-01-25
4859 4 2006-02-05
4860 60 2006-02-17
4861 -------------------------------------------------------------------------
4862 --- Delete rows and partitions of tables with dayofweek(col1)
4863 -------------------------------------------------------------------------
4864 begin;
4865 delete from t11 where col1='2006-02-17';
4866 delete from t22 where col1='2006-02-17';
4867 delete from t33 where col1='2006-02-17';
4868 delete from t44 where col1='2006-02-17';
4869 delete from t55 where col1='2006-02-17';
4870 delete from t66 where col1='2006-02-17';
4871 commit;
4872 select * from t11 order by col1;
4873 col1
4874 2006-02-05
4875 select * from t22 order by col1;
4876 col1
4877 2006-01-25
4878 2006-02-05
4879 select * from t33 order by col1;
4880 col1
4881 2006-01-25
4882 2006-02-05
4883 select * from t44 order by colint;
4884 colint col1
4885 1 2006-02-03
4886 2 2006-01-17
4887 3 2006-01-25
4888 4 2006-02-05
4889 select * from t55 order by colint;
4890 colint col1
4891 1 2006-02-03
4892 2 2006-01-17
4893 3 2006-01-25
4894 4 2006-02-05
4895 begin;
4896 insert into t11 values ('2006-02-17');
4897 insert into t22 values ('2006-02-17');
4898 insert into t33 values ('2006-02-17');
4899 insert into t44 values (60,'2006-02-17');
4900 insert into t55 values (60,'2006-02-17');
4901 insert into t66 values (60,'2006-02-17');
4902 commit;
4903 select * from t11 order by col1;
4904 col1
4905 2006-02-05
4906 2006-02-17
4907 select * from t22 order by col1;
4908 col1
4909 2006-01-25
4910 2006-02-05
4911 2006-02-17
4912 select * from t33 order by col1;
4913 col1
4914 2006-01-25
4915 2006-02-05
4916 2006-02-17
4917 select * from t44 order by colint;
4918 colint col1
4919 1 2006-02-03
4920 2 2006-01-17
4921 3 2006-01-25
4922 4 2006-02-05
4923 60 2006-02-17
4924 select * from t55 order by colint;
4925 colint col1
4926 1 2006-02-03
4927 2 2006-01-17
4928 3 2006-01-25
4929 4 2006-02-05
4930 60 2006-02-17
4931 select * from t66 order by colint;
4932 colint col1
4933 1 2006-02-03
4934 2 2006-01-17
4935 3 2006-01-25
4936 4 2006-02-05
4937 60 2006-02-17
4938 alter table t11 drop partition p0;
4939 alter table t22 drop partition p0;
4940 alter table t44 drop partition p0;
4941 alter table t55 drop partition p0;
4942 alter table t66 drop partition p0;
4943 select * from t11 order by col1;
4944 col1
4945 select * from t22 order by col1;
4946 col1
4947 select * from t33 order by col1;
4948 col1
4949 2006-01-25
4950 2006-02-05
4951 2006-02-17
4952 select * from t44 order by colint;
4953 colint col1
4954 60 2006-02-17
4955 select * from t55 order by colint;
4956 colint col1
4957 60 2006-02-17
4958 select * from t66 order by colint;
4959 colint col1
4960 1 2006-02-03
4961 2 2006-01-17
4962 3 2006-01-25
4963 4 2006-02-05
4964 60 2006-02-17
4965 -------------------------
4966 ---- some alter table end
4967 -------------------------
4968 drop table if exists t1 ;
4969 drop table if exists t2 ;
4970 drop table if exists t3 ;
4971 drop table if exists t4 ;
4972 drop table if exists t5 ;
4973 drop table if exists t6 ;
4974 drop table if exists t11 ;
4975 drop table if exists t22 ;
4976 drop table if exists t33 ;
4977 drop table if exists t44 ;
4978 drop table if exists t55 ;
4979 drop table if exists t66 ;
4980 -------------------------------------------------------------------------
4981 --- dayofyear(col1) in partition with coltype date
4982 -------------------------------------------------------------------------
4983 drop table if exists t1 ;
4984 drop table if exists t2 ;
4985 drop table if exists t3 ;
4986 drop table if exists t4 ;
4987 drop table if exists t5 ;
4988 drop table if exists t6 ;
4989 -------------------------------------------------------------------------
4990 --- Create tables with dayofyear(col1)
4991 -------------------------------------------------------------------------
4992 create table t1 (col1 date) engine='INNODB'
4993 partition by range(dayofyear(col1))
4994 (partition p0 values less than (15),
4995 partition p1 values less than maxvalue);
4996 create table t2 (col1 date) engine='INNODB'
4997 partition by list(dayofyear(col1))
4998 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
4999 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
5000 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
5001 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
5002 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
5003 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
5004 );
5005 create table t3 (col1 date) engine='INNODB'
5006 partition by hash(dayofyear(col1));
5007 create table t4 (colint int, col1 date) engine='INNODB'
5008 partition by range(colint)
5009 subpartition by hash(dayofyear(col1)) subpartitions 2
5010 (partition p0 values less than (15),
5011 partition p1 values less than maxvalue);
5012 create table t5 (colint int, col1 date) engine='INNODB'
5013 partition by list(colint)
5014 subpartition by hash(dayofyear(col1)) subpartitions 2
5015 (partition p0 values in (1,2,3,4,5,6,7,8,9,10),
5016 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
5017 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
5018 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
5019 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
5020 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
5021 );
5022 create table t6 (colint int, col1 date) engine='INNODB'
5023 partition by range(colint)
5024 (partition p0 values less than (dayofyear('2006-12-25')),
5025 partition p1 values less than maxvalue);
5026 -------------------------------------------------------------------------
5027 --- Access tables with dayofyear(col1)
5028 -------------------------------------------------------------------------
5029 begin;
5030 insert into t1 values ('2006-01-03');
5031 insert into t1 values ('2006-01-17');
5032 insert into t2 values ('2006-01-03');
5033 insert into t2 values ('2006-01-17');
5034 insert into t2 values ('2006-02-25');
5035 insert into t3 values ('2006-01-03');
5036 insert into t3 values ('2006-01-17');
5037 insert into t3 values ('2006-02-25');
5038 commit;
5039 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4;
5040 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5;
5041 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6;
5042 select dayofyear(col1) from t1 order by col1;
5043 dayofyear(col1)
5044 3
5045 17
5046 select * from t1 order by col1;
5047 col1
5048 2006-01-03
5049 2006-01-17
5050 select * from t2 order by col1;
5051 col1
5052 2006-01-03
5053 2006-01-17
5054 2006-02-25
5055 select * from t3 order by col1;
5056 col1
5057 2006-01-03
5058 2006-01-17
5059 2006-02-25
5060 select * from t4 order by colint;
5061 colint col1
5062 1 2006-02-03
5063 2 2006-01-17
5064 3 2006-01-25
5065 4 2006-02-05
5066 select * from t5 order by colint;
5067 colint col1
5068 1 2006-02-03
5069 2 2006-01-17
5070 3 2006-01-25
5071 4 2006-02-05
5072 select * from t6 order by colint;
5073 colint col1
5074 1 2006-02-03
5075 2 2006-01-17
5076 3 2006-01-25
5077 4 2006-02-05
5078 begin;
5079 update t1 set col1='2006-02-05' where col1='2006-01-03';
5080 update t2 set col1='2006-02-05' where col1='2006-01-03';
5081 update t3 set col1='2006-02-05' where col1='2006-01-03';
5082 update t4 set col1='2006-02-05' where col1='2006-01-03';
5083 update t5 set col1='2006-02-05' where col1='2006-01-03';
5084 update t6 set col1='2006-02-05' where col1='2006-01-03';
5085 commit;
5086 select * from t1 order by col1;
5087 col1
5088 2006-01-17
5089 2006-02-05
5090 select * from t2 order by col1;
5091 col1
5092 2006-01-17
5093 2006-02-05
5094 2006-02-25
5095 select * from t3 order by col1;
5096 col1
5097 2006-01-17
5098 2006-02-05
5099 2006-02-25
5100 select * from t4 order by colint;
5101 colint col1
5102 1 2006-02-03
5103 2 2006-01-17
5104 3 2006-01-25
5105 4 2006-02-05
5106 select * from t5 order by colint;
5107 colint col1
5108 1 2006-02-03
5109 2 2006-01-17
5110 3 2006-01-25
5111 4 2006-02-05
5112 select * from t6 order by colint;
5113 colint col1
5114 1 2006-02-03
5115 2 2006-01-17
5116 3 2006-01-25
5117 4 2006-02-05
5118 -------------------------------------------------------------------------
5119 --- Alter tables with dayofyear(col1)
5120 -------------------------------------------------------------------------
5121 drop table if exists t11 ;
5122 drop table if exists t22 ;
5123 drop table if exists t33 ;
5124 drop table if exists t44 ;
5125 drop table if exists t55 ;
5126 drop table if exists t66 ;
5127 create table t11 engine='INNODB' as select * from t1;
5128 create table t22 engine='INNODB' as select * from t2;
5129 create table t33 engine='INNODB' as select * from t3;
5130 create table t44 engine='INNODB' as select * from t4;
5131 create table t55 engine='INNODB' as select * from t5;
5132 create table t66 engine='INNODB' as select * from t6;
5133 alter table t11
5134 partition by range(dayofyear(col1))
5135 (partition p0 values less than (15),
5136 partition p1 values less than maxvalue);
5137 alter table t22
5138 partition by list(dayofyear(col1))
5139 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
5140 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
5141 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
5142 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
5143 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
5144 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
5145 );
5146 alter table t33
5147 partition by hash(dayofyear(col1));
5148 alter table t44
5149 partition by range(colint)
5150 subpartition by hash(dayofyear(col1)) subpartitions 2
5151 (partition p0 values less than (15),
5152 partition p1 values less than maxvalue);
5153 alter table t55
5154 partition by list(colint)
5155 subpartition by hash(dayofyear(col1)) subpartitions 2
5156 (partition p0 values in (1,2,3,4,5,6,7,8,9,10),
5157 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
5158 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
5159 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
5160 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
5161 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
5162 );
5163 alter table t66
5164 partition by range(colint)
5165 (partition p0 values less than (dayofyear('2006-12-25')),
5166 partition p1 values less than maxvalue);
5167 select * from t11 order by col1;
5168 col1
5169 2006-01-17
5170 2006-02-05
5171 select * from t22 order by col1;
5172 col1
5173 2006-01-17
5174 2006-02-05
5175 2006-02-25
5176 select * from t33 order by col1;
5177 col1
5178 2006-01-17
5179 2006-02-05
5180 2006-02-25
5181 select * from t44 order by colint;
5182 colint col1
5183 1 2006-02-03
5184 2 2006-01-17
5185 3 2006-01-25
5186 4 2006-02-05
5187 select * from t55 order by colint;
5188 colint col1
5189 1 2006-02-03
5190 2 2006-01-17
5191 3 2006-01-25
5192 4 2006-02-05
5193 select * from t66 order by colint;
5194 colint col1
5195 1 2006-02-03
5196 2 2006-01-17
5197 3 2006-01-25
5198 4 2006-02-05
5199 ---------------------------
5200 ---- some alter table begin
5201 ---------------------------
5202 alter table t11
5203 reorganize partition p0,p1 into
5204 (partition s1 values less than maxvalue);
5205 select * from t11 order by col1;
5206 col1
5207 2006-01-17
5208 2006-02-05
5209 alter table t11
5210 reorganize partition s1 into
5211 (partition p0 values less than (15),
5212 partition p1 values less than maxvalue);
5213 select * from t11 order by col1;
5214 col1
5215 2006-01-17
5216 2006-02-05
5217 alter table t55
5218 partition by list(colint)
5219 subpartition by hash(dayofyear(col1)) subpartitions 5
5220 (partition p0 values in (1,2,3,4,5,6,7,8,9,10),
5221 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
5222 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
5223 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
5224 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
5225 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
5226 );
5227 show create table t55;
5228 Table Create Table
5229 t55 CREATE TABLE `t55` (
5230 `colint` int(11) DEFAULT NULL,
5231 `col1` date DEFAULT NULL
5232 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
5233 PARTITION BY LIST (`colint`)
5234 SUBPARTITION BY HASH (dayofyear(`col1`))
5235 SUBPARTITIONS 5
5236 (PARTITION `p0` VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB,
5237 PARTITION `p1` VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB,
5238 PARTITION `p2` VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB,
5239 PARTITION `p3` VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB,
5240 PARTITION `p4` VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB,
5241 PARTITION `p5` VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB)
5242 select * from t55 order by colint;
5243 colint col1
5244 1 2006-02-03
5245 2 2006-01-17
5246 3 2006-01-25
5247 4 2006-02-05
5248 alter table t66
5249 reorganize partition p0,p1 into
5250 (partition s1 values less than maxvalue);
5251 select * from t66 order by colint;
5252 colint col1
5253 1 2006-02-03
5254 2 2006-01-17
5255 3 2006-01-25
5256 4 2006-02-05
5257 alter table t66
5258 reorganize partition s1 into
5259 (partition p0 values less than (dayofyear('2006-12-25')),
5260 partition p1 values less than maxvalue);
5261 select * from t66 order by colint;
5262 colint col1
5263 1 2006-02-03
5264 2 2006-01-17
5265 3 2006-01-25
5266 4 2006-02-05
5267 alter table t66
5268 reorganize partition p0,p1 into
5269 (partition s1 values less than maxvalue);
5270 select * from t66 order by colint;
5271 colint col1
5272 1 2006-02-03
5273 2 2006-01-17
5274 3 2006-01-25
5275 4 2006-02-05
5276 alter table t66
5277 reorganize partition s1 into
5278 (partition p0 values less than (dayofyear('2006-12-25')),
5279 partition p1 values less than maxvalue);
5280 select * from t66 order by colint;
5281 colint col1
5282 1 2006-02-03
5283 2 2006-01-17
5284 3 2006-01-25
5285 4 2006-02-05
5286 -------------------------------------------------------------------------
5287 --- Delete rows and partitions of tables with dayofyear(col1)
5288 -------------------------------------------------------------------------
5289 begin;
5290 delete from t1 where col1='2006-01-17';
5291 delete from t2 where col1='2006-01-17';
5292 delete from t3 where col1='2006-01-17';
5293 delete from t4 where col1='2006-01-17';
5294 delete from t5 where col1='2006-01-17';
5295 delete from t6 where col1='2006-01-17';
5296 commit;
5297 select * from t1 order by col1;
5298 col1
5299 2006-02-05
5300 select * from t2 order by col1;
5301 col1
5302 2006-02-05
5303 2006-02-25
5304 select * from t3 order by col1;
5305 col1
5306 2006-02-05
5307 2006-02-25
5308 select * from t4 order by colint;
5309 colint col1
5310 1 2006-02-03
5311 3 2006-01-25
5312 4 2006-02-05
5313 select * from t5 order by colint;
5314 colint col1
5315 1 2006-02-03
5316 3 2006-01-25
5317 4 2006-02-05
5318 begin;
5319 insert into t1 values ('2006-01-17');
5320 insert into t2 values ('2006-01-17');
5321 insert into t3 values ('2006-01-17');
5322 insert into t4 values (60,'2006-01-17');
5323 insert into t5 values (60,'2006-01-17');
5324 insert into t6 values (60,'2006-01-17');
5325 commit;
5326 select * from t1 order by col1;
5327 col1
5328 2006-01-17
5329 2006-02-05
5330 select * from t2 order by col1;
5331 col1
5332 2006-01-17
5333 2006-02-05
5334 2006-02-25
5335 select * from t3 order by col1;
5336 col1
5337 2006-01-17
5338 2006-02-05
5339 2006-02-25
5340 select * from t4 order by colint;
5341 colint col1
5342 1 2006-02-03
5343 3 2006-01-25
5344 4 2006-02-05
5345 60 2006-01-17
5346 select * from t5 order by colint;
5347 colint col1
5348 1 2006-02-03
5349 3 2006-01-25
5350 4 2006-02-05
5351 60 2006-01-17
5352 select * from t6 order by colint;
5353 colint col1
5354 1 2006-02-03
5355 3 2006-01-25
5356 4 2006-02-05
5357 60 2006-01-17
5358 alter table t1 drop partition p0;
5359 alter table t2 drop partition p0;
5360 alter table t4 drop partition p0;
5361 alter table t5 drop partition p0;
5362 alter table t6 drop partition p0;
5363 select * from t1 order by col1;
5364 col1
5365 2006-01-17
5366 2006-02-05
5367 select * from t2 order by col1;
5368 col1
5369 2006-01-17
5370 2006-02-05
5371 2006-02-25
5372 select * from t3 order by col1;
5373 col1
5374 2006-01-17
5375 2006-02-05
5376 2006-02-25
5377 select * from t4 order by colint;
5378 colint col1
5379 60 2006-01-17
5380 select * from t5 order by colint;
5381 colint col1
5382 60 2006-01-17
5383 select * from t6 order by colint;
5384 colint col1
5385 -------------------------------------------------------------------------
5386 --- Delete rows and partitions of tables with dayofyear(col1)
5387 -------------------------------------------------------------------------
5388 begin;
5389 delete from t11 where col1='2006-01-17';
5390 delete from t22 where col1='2006-01-17';
5391 delete from t33 where col1='2006-01-17';
5392 delete from t44 where col1='2006-01-17';
5393 delete from t55 where col1='2006-01-17';
5394 delete from t66 where col1='2006-01-17';
5395 commit;
5396 select * from t11 order by col1;
5397 col1
5398 2006-02-05
5399 select * from t22 order by col1;
5400 col1
5401 2006-02-05
5402 2006-02-25
5403 select * from t33 order by col1;
5404 col1
5405 2006-02-05
5406 2006-02-25
5407 select * from t44 order by colint;
5408 colint col1
5409 1 2006-02-03
5410 3 2006-01-25
5411 4 2006-02-05
5412 select * from t55 order by colint;
5413 colint col1
5414 1 2006-02-03
5415 3 2006-01-25
5416 4 2006-02-05
5417 begin;
5418 insert into t11 values ('2006-01-17');
5419 insert into t22 values ('2006-01-17');
5420 insert into t33 values ('2006-01-17');
5421 insert into t44 values (60,'2006-01-17');
5422 insert into t55 values (60,'2006-01-17');
5423 insert into t66 values (60,'2006-01-17');
5424 commit;
5425 select * from t11 order by col1;
5426 col1
5427 2006-01-17
5428 2006-02-05
5429 select * from t22 order by col1;
5430 col1
5431 2006-01-17
5432 2006-02-05
5433 2006-02-25
5434 select * from t33 order by col1;
5435 col1
5436 2006-01-17
5437 2006-02-05
5438 2006-02-25
5439 select * from t44 order by colint;
5440 colint col1
5441 1 2006-02-03
5442 3 2006-01-25
5443 4 2006-02-05
5444 60 2006-01-17
5445 select * from t55 order by colint;
5446 colint col1
5447 1 2006-02-03
5448 3 2006-01-25
5449 4 2006-02-05
5450 60 2006-01-17
5451 select * from t66 order by colint;
5452 colint col1
5453 1 2006-02-03
5454 3 2006-01-25
5455 4 2006-02-05
5456 60 2006-01-17
5457 alter table t11 drop partition p0;
5458 alter table t22 drop partition p0;
5459 alter table t44 drop partition p0;
5460 alter table t55 drop partition p0;
5461 alter table t66 drop partition p0;
5462 select * from t11 order by col1;
5463 col1
5464 2006-01-17
5465 2006-02-05
5466 select * from t22 order by col1;
5467 col1
5468 2006-01-17
5469 2006-02-05
5470 2006-02-25
5471 select * from t33 order by col1;
5472 col1
5473 2006-01-17
5474 2006-02-05
5475 2006-02-25
5476 select * from t44 order by colint;
5477 colint col1
5478 60 2006-01-17
5479 select * from t55 order by colint;
5480 colint col1
5481 60 2006-01-17
5482 select * from t66 order by colint;
5483 colint col1
5484 -------------------------
5485 ---- some alter table end
5486 -------------------------
5487 drop table if exists t1 ;
5488 drop table if exists t2 ;
5489 drop table if exists t3 ;
5490 drop table if exists t4 ;
5491 drop table if exists t5 ;
5492 drop table if exists t6 ;
5493 drop table if exists t11 ;
5494 drop table if exists t22 ;
5495 drop table if exists t33 ;
5496 drop table if exists t44 ;
5497 drop table if exists t55 ;
5498 drop table if exists t66 ;
5499 -------------------------------------------------------------------------
5500 --- extract(month from col1) in partition with coltype date
5501 -------------------------------------------------------------------------
5502 drop table if exists t1 ;
5503 drop table if exists t2 ;
5504 drop table if exists t3 ;
5505 drop table if exists t4 ;
5506 drop table if exists t5 ;
5507 drop table if exists t6 ;
5508 -------------------------------------------------------------------------
5509 --- Create tables with extract(month from col1)
5510 -------------------------------------------------------------------------
5511 create table t1 (col1 date) engine='INNODB'
5512 partition by range(extract(month from col1))
5513 (partition p0 values less than (15),
5514 partition p1 values less than maxvalue);
5515 create table t2 (col1 date) engine='INNODB'
5516 partition by list(extract(month from col1))
5517 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
5518 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
5519 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
5520 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
5521 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
5522 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
5523 );
5524 create table t3 (col1 date) engine='INNODB'
5525 partition by hash(extract(month from col1));
5526 create table t4 (colint int, col1 date) engine='INNODB'
5527 partition by range(colint)
5528 subpartition by hash(extract(month from col1)) subpartitions 2
5529 (partition p0 values less than (15),
5530 partition p1 values less than maxvalue);
5531 create table t5 (colint int, col1 date) engine='INNODB'
5532 partition by list(colint)
5533 subpartition by hash(extract(month from col1)) subpartitions 2
5534 (partition p0 values in (1,2,3,4,5,6,7,8,9,10),
5535 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
5536 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
5537 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
5538 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
5539 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
5540 );
5541 create table t6 (colint int, col1 date) engine='INNODB'
5542 partition by range(colint)
5543 (partition p0 values less than (extract(year from '1998-11-23')),
5544 partition p1 values less than maxvalue);
5545 -------------------------------------------------------------------------
5546 --- Access tables with extract(month from col1)
5547 -------------------------------------------------------------------------
5548 begin;
5549 insert into t1 values ('2006-01-03');
5550 insert into t1 values ('2006-02-17');
5551 insert into t2 values ('2006-01-03');
5552 insert into t2 values ('2006-02-17');
5553 insert into t2 values ('2006-01-25');
5554 insert into t3 values ('2006-01-03');
5555 insert into t3 values ('2006-02-17');
5556 insert into t3 values ('2006-01-25');
5557 commit;
5558 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4;
5559 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5;
5560 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6;
5561 select extract(month from col1) from t1 order by col1;
5562 extract(month from col1)
5563 1
5564 2
5565 select * from t1 order by col1;
5566 col1
5567 2006-01-03
5568 2006-02-17
5569 select * from t2 order by col1;
5570 col1
5571 2006-01-03
5572 2006-01-25
5573 2006-02-17
5574 select * from t3 order by col1;
5575 col1
5576 2006-01-03
5577 2006-01-25
5578 2006-02-17
5579 select * from t4 order by colint;
5580 colint col1
5581 1 2006-02-03
5582 2 2006-01-17
5583 3 2006-01-25
5584 4 2006-02-05
5585 select * from t5 order by colint;
5586 colint col1
5587 1 2006-02-03
5588 2 2006-01-17
5589 3 2006-01-25
5590 4 2006-02-05
5591 select * from t6 order by colint;
5592 colint col1
5593 1 2006-02-03
5594 2 2006-01-17
5595 3 2006-01-25
5596 4 2006-02-05
5597 begin;
5598 update t1 set col1='2006-02-05' where col1='2006-01-03';
5599 update t2 set col1='2006-02-05' where col1='2006-01-03';
5600 update t3 set col1='2006-02-05' where col1='2006-01-03';
5601 update t4 set col1='2006-02-05' where col1='2006-01-03';
5602 update t5 set col1='2006-02-05' where col1='2006-01-03';
5603 update t6 set col1='2006-02-05' where col1='2006-01-03';
5604 commit;
5605 select * from t1 order by col1;
5606 col1
5607 2006-02-05
5608 2006-02-17
5609 select * from t2 order by col1;
5610 col1
5611 2006-01-25
5612 2006-02-05
5613 2006-02-17
5614 select * from t3 order by col1;
5615 col1
5616 2006-01-25
5617 2006-02-05
5618 2006-02-17
5619 select * from t4 order by colint;
5620 colint col1
5621 1 2006-02-03
5622 2 2006-01-17
5623 3 2006-01-25
5624 4 2006-02-05
5625 select * from t5 order by colint;
5626 colint col1
5627 1 2006-02-03
5628 2 2006-01-17
5629 3 2006-01-25
5630 4 2006-02-05
5631 select * from t6 order by colint;
5632 colint col1
5633 1 2006-02-03
5634 2 2006-01-17
5635 3 2006-01-25
5636 4 2006-02-05
5637 -------------------------------------------------------------------------
5638 --- Alter tables with extract(month from col1)
5639 -------------------------------------------------------------------------
5640 drop table if exists t11 ;
5641 drop table if exists t22 ;
5642 drop table if exists t33 ;
5643 drop table if exists t44 ;
5644 drop table if exists t55 ;
5645 drop table if exists t66 ;
5646 create table t11 engine='INNODB' as select * from t1;
5647 create table t22 engine='INNODB' as select * from t2;
5648 create table t33 engine='INNODB' as select * from t3;
5649 create table t44 engine='INNODB' as select * from t4;
5650 create table t55 engine='INNODB' as select * from t5;
5651 create table t66 engine='INNODB' as select * from t6;
5652 alter table t11
5653 partition by range(extract(month from col1))
5654 (partition p0 values less than (15),
5655 partition p1 values less than maxvalue);
5656 alter table t22
5657 partition by list(extract(month from col1))
5658 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
5659 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
5660 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
5661 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
5662 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
5663 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
5664 );
5665 alter table t33
5666 partition by hash(extract(month from col1));
5667 alter table t44
5668 partition by range(colint)
5669 subpartition by hash(extract(month from col1)) subpartitions 2
5670 (partition p0 values less than (15),
5671 partition p1 values less than maxvalue);
5672 alter table t55
5673 partition by list(colint)
5674 subpartition by hash(extract(month from col1)) subpartitions 2
5675 (partition p0 values in (1,2,3,4,5,6,7,8,9,10),
5676 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
5677 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
5678 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
5679 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
5680 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
5681 );
5682 alter table t66
5683 partition by range(colint)
5684 (partition p0 values less than (extract(year from '1998-11-23')),
5685 partition p1 values less than maxvalue);
5686 select * from t11 order by col1;
5687 col1
5688 2006-02-05
5689 2006-02-17
5690 select * from t22 order by col1;
5691 col1
5692 2006-01-25
5693 2006-02-05
5694 2006-02-17
5695 select * from t33 order by col1;
5696 col1
5697 2006-01-25
5698 2006-02-05
5699 2006-02-17
5700 select * from t44 order by colint;
5701 colint col1
5702 1 2006-02-03
5703 2 2006-01-17
5704 3 2006-01-25
5705 4 2006-02-05
5706 select * from t55 order by colint;
5707 colint col1
5708 1 2006-02-03
5709 2 2006-01-17
5710 3 2006-01-25
5711 4 2006-02-05
5712 select * from t66 order by colint;
5713 colint col1
5714 1 2006-02-03
5715 2 2006-01-17
5716 3 2006-01-25
5717 4 2006-02-05
5718 ---------------------------
5719 ---- some alter table begin
5720 ---------------------------
5721 alter table t11
5722 reorganize partition p0,p1 into
5723 (partition s1 values less than maxvalue);
5724 select * from t11 order by col1;
5725 col1
5726 2006-02-05
5727 2006-02-17
5728 alter table t11
5729 reorganize partition s1 into
5730 (partition p0 values less than (15),
5731 partition p1 values less than maxvalue);
5732 select * from t11 order by col1;
5733 col1
5734 2006-02-05
5735 2006-02-17
5736 alter table t55
5737 partition by list(colint)
5738 subpartition by hash(extract(month from col1)) subpartitions 5
5739 (partition p0 values in (1,2,3,4,5,6,7,8,9,10),
5740 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
5741 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
5742 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
5743 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
5744 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
5745 );
5746 show create table t55;
5747 Table Create Table
5748 t55 CREATE TABLE `t55` (
5749 `colint` int(11) DEFAULT NULL,
5750 `col1` date DEFAULT NULL
5751 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
5752 PARTITION BY LIST (`colint`)
5753 SUBPARTITION BY HASH (extract(month from `col1`))
5754 SUBPARTITIONS 5
5755 (PARTITION `p0` VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB,
5756 PARTITION `p1` VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB,
5757 PARTITION `p2` VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB,
5758 PARTITION `p3` VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB,
5759 PARTITION `p4` VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB,
5760 PARTITION `p5` VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB)
5761 select * from t55 order by colint;
5762 colint col1
5763 1 2006-02-03
5764 2 2006-01-17
5765 3 2006-01-25
5766 4 2006-02-05
5767 alter table t66
5768 reorganize partition p0,p1 into
5769 (partition s1 values less than maxvalue);
5770 select * from t66 order by colint;
5771 colint col1
5772 1 2006-02-03
5773 2 2006-01-17
5774 3 2006-01-25
5775 4 2006-02-05
5776 alter table t66
5777 reorganize partition s1 into
5778 (partition p0 values less than (extract(year from '1998-11-23')),
5779 partition p1 values less than maxvalue);
5780 select * from t66 order by colint;
5781 colint col1
5782 1 2006-02-03
5783 2 2006-01-17
5784 3 2006-01-25
5785 4 2006-02-05
5786 alter table t66
5787 reorganize partition p0,p1 into
5788 (partition s1 values less than maxvalue);
5789 select * from t66 order by colint;
5790 colint col1
5791 1 2006-02-03
5792 2 2006-01-17
5793 3 2006-01-25
5794 4 2006-02-05
5795 alter table t66
5796 reorganize partition s1 into
5797 (partition p0 values less than (extract(year from '1998-11-23')),
5798 partition p1 values less than maxvalue);
5799 select * from t66 order by colint;
5800 colint col1
5801 1 2006-02-03
5802 2 2006-01-17
5803 3 2006-01-25
5804 4 2006-02-05
5805 -------------------------------------------------------------------------
5806 --- Delete rows and partitions of tables with extract(month from col1)
5807 -------------------------------------------------------------------------
5808 begin;
5809 delete from t1 where col1='2006-02-17';
5810 delete from t2 where col1='2006-02-17';
5811 delete from t3 where col1='2006-02-17';
5812 delete from t4 where col1='2006-02-17';
5813 delete from t5 where col1='2006-02-17';
5814 delete from t6 where col1='2006-02-17';
5815 commit;
5816 select * from t1 order by col1;
5817 col1
5818 2006-02-05
5819 select * from t2 order by col1;
5820 col1
5821 2006-01-25
5822 2006-02-05
5823 select * from t3 order by col1;
5824 col1
5825 2006-01-25
5826 2006-02-05
5827 select * from t4 order by colint;
5828 colint col1
5829 1 2006-02-03
5830 2 2006-01-17
5831 3 2006-01-25
5832 4 2006-02-05
5833 select * from t5 order by colint;
5834 colint col1
5835 1 2006-02-03
5836 2 2006-01-17
5837 3 2006-01-25
5838 4 2006-02-05
5839 begin;
5840 insert into t1 values ('2006-02-17');
5841 insert into t2 values ('2006-02-17');
5842 insert into t3 values ('2006-02-17');
5843 insert into t4 values (60,'2006-02-17');
5844 insert into t5 values (60,'2006-02-17');
5845 insert into t6 values (60,'2006-02-17');
5846 commit;
5847 select * from t1 order by col1;
5848 col1
5849 2006-02-05
5850 2006-02-17
5851 select * from t2 order by col1;
5852 col1
5853 2006-01-25
5854 2006-02-05
5855 2006-02-17
5856 select * from t3 order by col1;
5857 col1
5858 2006-01-25
5859 2006-02-05
5860 2006-02-17
5861 select * from t4 order by colint;
5862 colint col1
5863 1 2006-02-03
5864 2 2006-01-17
5865 3 2006-01-25
5866 4 2006-02-05
5867 60 2006-02-17
5868 select * from t5 order by colint;
5869 colint col1
5870 1 2006-02-03
5871 2 2006-01-17
5872 3 2006-01-25
5873 4 2006-02-05
5874 60 2006-02-17
5875 select * from t6 order by colint;
5876 colint col1
5877 1 2006-02-03
5878 2 2006-01-17
5879 3 2006-01-25
5880 4 2006-02-05
5881 60 2006-02-17
5882 alter table t1 drop partition p0;
5883 alter table t2 drop partition p0;
5884 alter table t4 drop partition p0;
5885 alter table t5 drop partition p0;
5886 alter table t6 drop partition p0;
5887 select * from t1 order by col1;
5888 col1
5889 select * from t2 order by col1;
5890 col1
5891 select * from t3 order by col1;
5892 col1
5893 2006-01-25
5894 2006-02-05
5895 2006-02-17
5896 select * from t4 order by colint;
5897 colint col1
5898 60 2006-02-17
5899 select * from t5 order by colint;
5900 colint col1
5901 60 2006-02-17
5902 select * from t6 order by colint;
5903 colint col1
5904 -------------------------------------------------------------------------
5905 --- Delete rows and partitions of tables with extract(month from col1)
5906 -------------------------------------------------------------------------
5907 begin;
5908 delete from t11 where col1='2006-02-17';
5909 delete from t22 where col1='2006-02-17';
5910 delete from t33 where col1='2006-02-17';
5911 delete from t44 where col1='2006-02-17';
5912 delete from t55 where col1='2006-02-17';
5913 delete from t66 where col1='2006-02-17';
5914 commit;
5915 select * from t11 order by col1;
5916 col1
5917 2006-02-05
5918 select * from t22 order by col1;
5919 col1
5920 2006-01-25
5921 2006-02-05
5922 select * from t33 order by col1;
5923 col1
5924 2006-01-25
5925 2006-02-05
5926 select * from t44 order by colint;
5927 colint col1
5928 1 2006-02-03
5929 2 2006-01-17
5930 3 2006-01-25
5931 4 2006-02-05
5932 select * from t55 order by colint;
5933 colint col1
5934 1 2006-02-03
5935 2 2006-01-17
5936 3 2006-01-25
5937 4 2006-02-05
5938 begin;
5939 insert into t11 values ('2006-02-17');
5940 insert into t22 values ('2006-02-17');
5941 insert into t33 values ('2006-02-17');
5942 insert into t44 values (60,'2006-02-17');
5943 insert into t55 values (60,'2006-02-17');
5944 insert into t66 values (60,'2006-02-17');
5945 commit;
5946 select * from t11 order by col1;
5947 col1
5948 2006-02-05
5949 2006-02-17
5950 select * from t22 order by col1;
5951 col1
5952 2006-01-25
5953 2006-02-05
5954 2006-02-17
5955 select * from t33 order by col1;
5956 col1
5957 2006-01-25
5958 2006-02-05
5959 2006-02-17
5960 select * from t44 order by colint;
5961 colint col1
5962 1 2006-02-03
5963 2 2006-01-17
5964 3 2006-01-25
5965 4 2006-02-05
5966 60 2006-02-17
5967 select * from t55 order by colint;
5968 colint col1
5969 1 2006-02-03
5970 2 2006-01-17
5971 3 2006-01-25
5972 4 2006-02-05
5973 60 2006-02-17
5974 select * from t66 order by colint;
5975 colint col1
5976 1 2006-02-03
5977 2 2006-01-17
5978 3 2006-01-25
5979 4 2006-02-05
5980 60 2006-02-17
5981 alter table t11 drop partition p0;
5982 alter table t22 drop partition p0;
5983 alter table t44 drop partition p0;
5984 alter table t55 drop partition p0;
5985 alter table t66 drop partition p0;
5986 select * from t11 order by col1;
5987 col1
5988 select * from t22 order by col1;
5989 col1
5990 select * from t33 order by col1;
5991 col1
5992 2006-01-25
5993 2006-02-05
5994 2006-02-17
5995 select * from t44 order by colint;
5996 colint col1
5997 60 2006-02-17
5998 select * from t55 order by colint;
5999 colint col1
6000 60 2006-02-17
6001 select * from t66 order by colint;
6002 colint col1
6003 -------------------------
6004 ---- some alter table end
6005 -------------------------
6006 drop table if exists t1 ;
6007 drop table if exists t2 ;
6008 drop table if exists t3 ;
6009 drop table if exists t4 ;
6010 drop table if exists t5 ;
6011 drop table if exists t6 ;
6012 drop table if exists t11 ;
6013 drop table if exists t22 ;
6014 drop table if exists t33 ;
6015 drop table if exists t44 ;
6016 drop table if exists t55 ;
6017 drop table if exists t66 ;
6018 -------------------------------------------------------------------------
6019 --- hour(col1) in partition with coltype time
6020 -------------------------------------------------------------------------
6021 drop table if exists t1 ;
6022 drop table if exists t2 ;
6023 drop table if exists t3 ;
6024 drop table if exists t4 ;
6025 drop table if exists t5 ;
6026 drop table if exists t6 ;
6027 -------------------------------------------------------------------------
6028 --- Create tables with hour(col1)
6029 -------------------------------------------------------------------------
6030 create table t1 (col1 time) engine='INNODB'
6031 partition by range(hour(col1))
6032 (partition p0 values less than (15),
6033 partition p1 values less than maxvalue);
6034 create table t2 (col1 time) engine='INNODB'
6035 partition by list(hour(col1))
6036 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
6037 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
6038 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
6039 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
6040 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
6041 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
6042 );
6043 create table t3 (col1 time) engine='INNODB'
6044 partition by hash(hour(col1));
6045 create table t4 (colint int, col1 time) engine='INNODB'
6046 partition by range(colint)
6047 subpartition by hash(hour(col1)) subpartitions 2
6048 (partition p0 values less than (15),
6049 partition p1 values less than maxvalue);
6050 create table t5 (colint int, col1 time) engine='INNODB'
6051 partition by list(colint)
6052 subpartition by hash(hour(col1)) subpartitions 2
6053 (partition p0 values in (1,2,3,4,5,6,7,8,9,10),
6054 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
6055 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
6056 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
6057 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
6058 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
6059 );
6060 create table t6 (colint int, col1 time) engine='INNODB'
6061 partition by range(colint)
6062 (partition p0 values less than (hour('18:30')),
6063 partition p1 values less than maxvalue);
6064 -------------------------------------------------------------------------
6065 --- Access tables with hour(col1)
6066 -------------------------------------------------------------------------
6067 begin;
6068 insert into t1 values ('09:09');
6069 insert into t1 values ('14:30');
6070 insert into t2 values ('09:09');
6071 insert into t2 values ('14:30');
6072 insert into t2 values ('21:59');
6073 insert into t3 values ('09:09');
6074 insert into t3 values ('14:30');
6075 insert into t3 values ('21:59');
6076 commit;
6077 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t4;
6078 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t5;
6079 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t6;
6080 select hour(col1) from t1 order by col1;
6081 hour(col1)
6082 9
6083 14
6084 select * from t1 order by col1;
6085 col1
6086 09:09:00
6087 14:30:00
6088 select * from t2 order by col1;
6089 col1
6090 09:09:00
6091 14:30:00
6092 21:59:00
6093 select * from t3 order by col1;
6094 col1
6095 09:09:00
6096 14:30:00
6097 21:59:00
6098 select * from t4 order by colint;
6099 colint col1
6100 1 09:09:15
6101 2 04:30:01
6102 3 00:59:22
6103 4 05:30:34
6104 select * from t5 order by colint;
6105 colint col1
6106 1 09:09:15
6107 2 04:30:01
6108 3 00:59:22
6109 4 05:30:34
6110 select * from t6 order by colint;
6111 colint col1
6112 1 09:09:15
6113 2 04:30:01
6114 3 00:59:22
6115 4 05:30:34
6116 begin;
6117 update t1 set col1='10:30' where col1='09:09';
6118 update t2 set col1='10:30' where col1='09:09';
6119 update t3 set col1='10:30' where col1='09:09';
6120 update t4 set col1='10:30' where col1='09:09';
6121 update t5 set col1='10:30' where col1='09:09';
6122 update t6 set col1='10:30' where col1='09:09';
6123 commit;
6124 select * from t1 order by col1;
6125 col1
6126 10:30:00
6127 14:30:00
6128 select * from t2 order by col1;
6129 col1
6130 10:30:00
6131 14:30:00
6132 21:59:00
6133 select * from t3 order by col1;
6134 col1
6135 10:30:00
6136 14:30:00
6137 21:59:00
6138 select * from t4 order by colint;
6139 colint col1
6140 1 09:09:15
6141 2 04:30:01
6142 3 00:59:22
6143 4 05:30:34
6144 select * from t5 order by colint;
6145 colint col1
6146 1 09:09:15
6147 2 04:30:01
6148 3 00:59:22
6149 4 05:30:34
6150 select * from t6 order by colint;
6151 colint col1
6152 1 09:09:15
6153 2 04:30:01
6154 3 00:59:22
6155 4 05:30:34
6156 -------------------------------------------------------------------------
6157 --- Alter tables with hour(col1)
6158 -------------------------------------------------------------------------
6159 drop table if exists t11 ;
6160 drop table if exists t22 ;
6161 drop table if exists t33 ;
6162 drop table if exists t44 ;
6163 drop table if exists t55 ;
6164 drop table if exists t66 ;
6165 create table t11 engine='INNODB' as select * from t1;
6166 create table t22 engine='INNODB' as select * from t2;
6167 create table t33 engine='INNODB' as select * from t3;
6168 create table t44 engine='INNODB' as select * from t4;
6169 create table t55 engine='INNODB' as select * from t5;
6170 create table t66 engine='INNODB' as select * from t6;
6171 alter table t11
6172 partition by range(hour(col1))
6173 (partition p0 values less than (15),
6174 partition p1 values less than maxvalue);
6175 alter table t22
6176 partition by list(hour(col1))
6177 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
6178 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
6179 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
6180 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
6181 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
6182 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
6183 );
6184 alter table t33
6185 partition by hash(hour(col1));
6186 alter table t44
6187 partition by range(colint)
6188 subpartition by hash(hour(col1)) subpartitions 2
6189 (partition p0 values less than (15),
6190 partition p1 values less than maxvalue);
6191 alter table t55
6192 partition by list(colint)
6193 subpartition by hash(hour(col1)) subpartitions 2
6194 (partition p0 values in (1,2,3,4,5,6,7,8,9,10),
6195 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
6196 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
6197 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
6198 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
6199 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
6200 );
6201 alter table t66
6202 partition by range(colint)
6203 (partition p0 values less than (hour('18:30')),
6204 partition p1 values less than maxvalue);
6205 select * from t11 order by col1;
6206 col1
6207 10:30:00
6208 14:30:00
6209 select * from t22 order by col1;
6210 col1
6211 10:30:00
6212 14:30:00
6213 21:59:00
6214 select * from t33 order by col1;
6215 col1
6216 10:30:00
6217 14:30:00
6218 21:59:00
6219 select * from t44 order by colint;
6220 colint col1
6221 1 09:09:15
6222 2 04:30:01
6223 3 00:59:22
6224 4 05:30:34
6225 select * from t55 order by colint;
6226 colint col1
6227 1 09:09:15
6228 2 04:30:01
6229 3 00:59:22
6230 4 05:30:34
6231 select * from t66 order by colint;
6232 colint col1
6233 1 09:09:15
6234 2 04:30:01
6235 3 00:59:22
6236 4 05:30:34
6237 ---------------------------
6238 ---- some alter table begin
6239 ---------------------------
6240 alter table t11
6241 reorganize partition p0,p1 into
6242 (partition s1 values less than maxvalue);
6243 select * from t11 order by col1;
6244 col1
6245 10:30:00
6246 14:30:00
6247 alter table t11
6248 reorganize partition s1 into
6249 (partition p0 values less than (15),
6250 partition p1 values less than maxvalue);
6251 select * from t11 order by col1;
6252 col1
6253 10:30:00
6254 14:30:00
6255 alter table t55
6256 partition by list(colint)
6257 subpartition by hash(hour(col1)) subpartitions 5
6258 (partition p0 values in (1,2,3,4,5,6,7,8,9,10),
6259 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
6260 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
6261 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
6262 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
6263 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
6264 );
6265 show create table t55;
6266 Table Create Table
6267 t55 CREATE TABLE `t55` (
6268 `colint` int(11) DEFAULT NULL,
6269 `col1` time DEFAULT NULL
6270 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
6271 PARTITION BY LIST (`colint`)
6272 SUBPARTITION BY HASH (hour(`col1`))
6273 SUBPARTITIONS 5
6274 (PARTITION `p0` VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB,
6275 PARTITION `p1` VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB,
6276 PARTITION `p2` VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB,
6277 PARTITION `p3` VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB,
6278 PARTITION `p4` VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB,
6279 PARTITION `p5` VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB)
6280 select * from t55 order by colint;
6281 colint col1
6282 1 09:09:15
6283 2 04:30:01
6284 3 00:59:22
6285 4 05:30:34
6286 alter table t66
6287 reorganize partition p0,p1 into
6288 (partition s1 values less than maxvalue);
6289 select * from t66 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 alter table t66
6296 reorganize partition s1 into
6297 (partition p0 values less than (hour('18:30')),
6298 partition p1 values less than maxvalue);
6299 select * from t66 order by colint;
6300 colint col1
6301 1 09:09:15
6302 2 04:30:01
6303 3 00:59:22
6304 4 05:30:34
6305 alter table t66
6306 reorganize partition p0,p1 into
6307 (partition s1 values less than maxvalue);
6308 select * from t66 order by colint;
6309 colint col1
6310 1 09:09:15
6311 2 04:30:01
6312 3 00:59:22
6313 4 05:30:34
6314 alter table t66
6315 reorganize partition s1 into
6316 (partition p0 values less than (hour('18:30')),
6317 partition p1 values less than maxvalue);
6318 select * from t66 order by colint;
6319 colint col1
6320 1 09:09:15
6321 2 04:30:01
6322 3 00:59:22
6323 4 05:30:34
6324 -------------------------------------------------------------------------
6325 --- Delete rows and partitions of tables with hour(col1)
6326 -------------------------------------------------------------------------
6327 begin;
6328 delete from t1 where col1='14:30';
6329 delete from t2 where col1='14:30';
6330 delete from t3 where col1='14:30';
6331 delete from t4 where col1='14:30';
6332 delete from t5 where col1='14:30';
6333 delete from t6 where col1='14:30';
6334 commit;
6335 select * from t1 order by col1;
6336 col1
6337 10:30:00
6338 select * from t2 order by col1;
6339 col1
6340 10:30:00
6341 21:59:00
6342 select * from t3 order by col1;
6343 col1
6344 10:30:00
6345 21:59:00
6346 select * from t4 order by colint;
6347 colint col1
6348 1 09:09:15
6349 2 04:30:01
6350 3 00:59:22
6351 4 05:30:34
6352 select * from t5 order by colint;
6353 colint col1
6354 1 09:09:15
6355 2 04:30:01
6356 3 00:59:22
6357 4 05:30:34
6358 begin;
6359 insert into t1 values ('14:30');
6360 insert into t2 values ('14:30');
6361 insert into t3 values ('14:30');
6362 insert into t4 values (60,'14:30');
6363 insert into t5 values (60,'14:30');
6364 insert into t6 values (60,'14:30');
6365 commit;
6366 select * from t1 order by col1;
6367 col1
6368 10:30:00
6369 14:30:00
6370 select * from t2 order by col1;
6371 col1
6372 10:30:00
6373 14:30:00
6374 21:59:00
6375 select * from t3 order by col1;
6376 col1
6377 10:30:00
6378 14:30:00
6379 21:59:00
6380 select * from t4 order by colint;
6381 colint col1
6382 1 09:09:15
6383 2 04:30:01
6384 3 00:59:22
6385 4 05:30:34
6386 60 14:30:00
6387 select * from t5 order by colint;
6388 colint col1
6389 1 09:09:15
6390 2 04:30:01
6391 3 00:59:22
6392 4 05:30:34
6393 60 14:30:00
6394 select * from t6 order by colint;
6395 colint col1
6396 1 09:09:15
6397 2 04:30:01
6398 3 00:59:22
6399 4 05:30:34
6400 60 14:30:00
6401 alter table t1 drop partition p0;
6402 alter table t2 drop partition p0;
6403 alter table t4 drop partition p0;
6404 alter table t5 drop partition p0;
6405 alter table t6 drop partition p0;
6406 select * from t1 order by col1;
6407 col1
6408 select * from t2 order by col1;
6409 col1
6410 14:30:00
6411 21:59:00
6412 select * from t3 order by col1;
6413 col1
6414 10:30:00
6415 14:30:00
6416 21:59:00
6417 select * from t4 order by colint;
6418 colint col1
6419 60 14:30:00
6420 select * from t5 order by colint;
6421 colint col1
6422 60 14:30:00
6423 select * from t6 order by colint;
6424 colint col1
6425 60 14:30:00
6426 -------------------------------------------------------------------------
6427 --- Delete rows and partitions of tables with hour(col1)
6428 -------------------------------------------------------------------------
6429 begin;
6430 delete from t11 where col1='14:30';
6431 delete from t22 where col1='14:30';
6432 delete from t33 where col1='14:30';
6433 delete from t44 where col1='14:30';
6434 delete from t55 where col1='14:30';
6435 delete from t66 where col1='14:30';
6436 commit;
6437 select * from t11 order by col1;
6438 col1
6439 10:30:00
6440 select * from t22 order by col1;
6441 col1
6442 10:30:00
6443 21:59:00
6444 select * from t33 order by col1;
6445 col1
6446 10:30:00
6447 21:59:00
6448 select * from t44 order by colint;
6449 colint col1
6450 1 09:09:15
6451 2 04:30:01
6452 3 00:59:22
6453 4 05:30:34
6454 select * from t55 order by colint;
6455 colint col1
6456 1 09:09:15
6457 2 04:30:01
6458 3 00:59:22
6459 4 05:30:34
6460 begin;
6461 insert into t11 values ('14:30');
6462 insert into t22 values ('14:30');
6463 insert into t33 values ('14:30');
6464 insert into t44 values (60,'14:30');
6465 insert into t55 values (60,'14:30');
6466 insert into t66 values (60,'14:30');
6467 commit;
6468 select * from t11 order by col1;
6469 col1
6470 10:30:00
6471 14:30:00
6472 select * from t22 order by col1;
6473 col1
6474 10:30:00
6475 14:30:00
6476 21:59:00
6477 select * from t33 order by col1;
6478 col1
6479 10:30:00
6480 14:30:00
6481 21:59:00
6482 select * from t44 order by colint;
6483 colint col1
6484 1 09:09:15
6485 2 04:30:01
6486 3 00:59:22
6487 4 05:30:34
6488 60 14:30:00
6489 select * from t55 order by colint;
6490 colint col1
6491 1 09:09:15
6492 2 04:30:01
6493 3 00:59:22
6494 4 05:30:34
6495 60 14:30:00
6496 select * from t66 order by colint;
6497 colint col1
6498 1 09:09:15
6499 2 04:30:01
6500 3 00:59:22
6501 4 05:30:34
6502 60 14:30:00
6503 alter table t11 drop partition p0;
6504 alter table t22 drop partition p0;
6505 alter table t44 drop partition p0;
6506 alter table t55 drop partition p0;
6507 alter table t66 drop partition p0;
6508 select * from t11 order by col1;
6509 col1
6510 select * from t22 order by col1;
6511 col1
6512 14:30:00
6513 21:59:00
6514 select * from t33 order by col1;
6515 col1
6516 10:30:00
6517 14:30:00
6518 21:59:00
6519 select * from t44 order by colint;
6520 colint col1
6521 60 14:30:00
6522 select * from t55 order by colint;
6523 colint col1
6524 60 14:30:00
6525 select * from t66 order by colint;
6526 colint col1
6527 60 14:30:00
6528 -------------------------
6529 ---- some alter table end
6530 -------------------------
6531 drop table if exists t1 ;
6532 drop table if exists t2 ;
6533 drop table if exists t3 ;
6534 drop table if exists t4 ;
6535 drop table if exists t5 ;
6536 drop table if exists t6 ;
6537 drop table if exists t11 ;
6538 drop table if exists t22 ;
6539 drop table if exists t33 ;
6540 drop table if exists t44 ;
6541 drop table if exists t55 ;
6542 drop table if exists t66 ;
6543 -------------------------------------------------------------------------
6544 --- microsecond(col1) in partition with coltype time(6)
6545 -------------------------------------------------------------------------
6546 drop table if exists t1 ;
6547 drop table if exists t2 ;
6548 drop table if exists t3 ;
6549 drop table if exists t4 ;
6550 drop table if exists t5 ;
6551 drop table if exists t6 ;
6552 -------------------------------------------------------------------------
6553 --- Create tables with microsecond(col1)
6554 -------------------------------------------------------------------------
6555 create table t1 (col1 time(6)) engine='INNODB'
6556 partition by range(microsecond(col1))
6557 (partition p0 values less than (15),
6558 partition p1 values less than maxvalue);
6559 create table t2 (col1 time(6)) engine='INNODB'
6560 partition by list(microsecond(col1))
6561 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
6562 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
6563 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
6564 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
6565 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
6566 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
6567 );
6568 create table t3 (col1 time(6)) engine='INNODB'
6569 partition by hash(microsecond(col1));
6570 create table t4 (colint int, col1 time(6)) engine='INNODB'
6571 partition by range(colint)
6572 subpartition by hash(microsecond(col1)) subpartitions 2
6573 (partition p0 values less than (15),
6574 partition p1 values less than maxvalue);
6575 create table t5 (colint int, col1 time(6)) engine='INNODB'
6576 partition by list(colint)
6577 subpartition by hash(microsecond(col1)) subpartitions 2
6578 (partition p0 values in (1,2,3,4,5,6,7,8,9,10),
6579 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
6580 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
6581 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
6582 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
6583 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
6584 );
6585 create table t6 (colint int, col1 time(6)) engine='INNODB'
6586 partition by range(colint)
6587 (partition p0 values less than (microsecond('10:30:10.000010')),
6588 partition p1 values less than maxvalue);
6589 -------------------------------------------------------------------------
6590 --- Access tables with microsecond(col1)
6591 -------------------------------------------------------------------------
6592 begin;
6593 insert into t1 values ('09:09:15.000002');
6594 insert into t1 values ('04:30:01.000018');
6595 insert into t2 values ('09:09:15.000002');
6596 insert into t2 values ('04:30:01.000018');
6597 insert into t2 values ('00:59:22.000024');
6598 insert into t3 values ('09:09:15.000002');
6599 insert into t3 values ('04:30:01.000018');
6600 insert into t3 values ('00:59:22.000024');
6601 commit;
6602 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t4;
6603 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t5;
6604 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t6;
6605 select microsecond(col1) from t1 order by col1;
6606 microsecond(col1)
6607 18
6608 2
6609 select * from t1 order by col1;
6610 col1
6611 04:30:01.000018
6612 09:09:15.000002
6613 select * from t2 order by col1;
6614 col1
6615 00:59:22.000024
6616 04:30:01.000018
6617 09:09:15.000002
6618 select * from t3 order by col1;
6619 col1
6620 00:59:22.000024
6621 04:30:01.000018
6622 09:09:15.000002
6623 select * from t4 order by colint;
6624 colint col1
6625 1 09:09:15.000002
6626 2 04:30:01.000018
6627 3 00:59:22.000024
6628 4 05:30:34.000037
6629 select * from t5 order by colint;
6630 colint col1
6631 1 09:09:15.000002
6632 2 04:30:01.000018
6633 3 00:59:22.000024
6634 4 05:30:34.000037
6635 select * from t6 order by colint;
6636 colint col1
6637 1 09:09:15.000002
6638 2 04:30:01.000018
6639 3 00:59:22.000024
6640 4 05:30:34.000037
6641 begin;
6642 update t1 set col1='05:30:34.000037' where col1='09:09:15.000002';
6643 update t2 set col1='05:30:34.000037' where col1='09:09:15.000002';
6644 update t3 set col1='05:30:34.000037' where col1='09:09:15.000002';
6645 update t4 set col1='05:30:34.000037' where col1='09:09:15.000002';
6646 update t5 set col1='05:30:34.000037' where col1='09:09:15.000002';
6647 update t6 set col1='05:30:34.000037' where col1='09:09:15.000002';
6648 commit;
6649 select * from t1 order by col1;
6650 col1
6651 04:30:01.000018
6652 05:30:34.000037
6653 select * from t2 order by col1;
6654 col1
6655 00:59:22.000024
6656 04:30:01.000018
6657 05:30:34.000037
6658 select * from t3 order by col1;
6659 col1
6660 00:59:22.000024
6661 04:30:01.000018
6662 05:30:34.000037
6663 select * from t4 order by colint;
6664 colint col1
6665 1 05:30:34.000037
6666 2 04:30:01.000018
6667 3 00:59:22.000024
6668 4 05:30:34.000037
6669 select * from t5 order by colint;
6670 colint col1
6671 1 05:30:34.000037
6672 2 04:30:01.000018
6673 3 00:59:22.000024
6674 4 05:30:34.000037
6675 select * from t6 order by colint;
6676 colint col1
6677 1 05:30:34.000037
6678 2 04:30:01.000018
6679 3 00:59:22.000024
6680 4 05:30:34.000037
6681 -------------------------------------------------------------------------
6682 --- Alter tables with microsecond(col1)
6683 -------------------------------------------------------------------------
6684 drop table if exists t11 ;
6685 drop table if exists t22 ;
6686 drop table if exists t33 ;
6687 drop table if exists t44 ;
6688 drop table if exists t55 ;
6689 drop table if exists t66 ;
6690 create table t11 engine='INNODB' as select * from t1;
6691 create table t22 engine='INNODB' as select * from t2;
6692 create table t33 engine='INNODB' as select * from t3;
6693 create table t44 engine='INNODB' as select * from t4;
6694 create table t55 engine='INNODB' as select * from t5;
6695 create table t66 engine='INNODB' as select * from t6;
6696 alter table t11
6697 partition by range(microsecond(col1))
6698 (partition p0 values less than (15),
6699 partition p1 values less than maxvalue);
6700 alter table t22
6701 partition by list(microsecond(col1))
6702 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
6703 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
6704 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
6705 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
6706 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
6707 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
6708 );
6709 alter table t33
6710 partition by hash(microsecond(col1));
6711 alter table t44
6712 partition by range(colint)
6713 subpartition by hash(microsecond(col1)) subpartitions 2
6714 (partition p0 values less than (15),
6715 partition p1 values less than maxvalue);
6716 alter table t55
6717 partition by list(colint)
6718 subpartition by hash(microsecond(col1)) subpartitions 2
6719 (partition p0 values in (1,2,3,4,5,6,7,8,9,10),
6720 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
6721 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
6722 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
6723 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
6724 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
6725 );
6726 alter table t66
6727 partition by range(colint)
6728 (partition p0 values less than (microsecond('10:30:10.000010')),
6729 partition p1 values less than maxvalue);
6730 select * from t11 order by col1;
6731 col1
6732 04:30:01.000018
6733 05:30:34.000037
6734 select * from t22 order by col1;
6735 col1
6736 00:59:22.000024
6737 04:30:01.000018
6738 05:30:34.000037
6739 select * from t33 order by col1;
6740 col1
6741 00:59:22.000024
6742 04:30:01.000018
6743 05:30:34.000037
6744 select * from t44 order by colint;
6745 colint col1
6746 1 05:30:34.000037
6747 2 04:30:01.000018
6748 3 00:59:22.000024
6749 4 05:30:34.000037
6750 select * from t55 order by colint;
6751 colint col1
6752 1 05:30:34.000037
6753 2 04:30:01.000018
6754 3 00:59:22.000024
6755 4 05:30:34.000037
6756 select * from t66 order by colint;
6757 colint col1
6758 1 05:30:34.000037
6759 2 04:30:01.000018
6760 3 00:59:22.000024
6761 4 05:30:34.000037
6762 ---------------------------
6763 ---- some alter table begin
6764 ---------------------------
6765 alter table t11
6766 reorganize partition p0,p1 into
6767 (partition s1 values less than maxvalue);
6768 select * from t11 order by col1;
6769 col1
6770 04:30:01.000018
6771 05:30:34.000037
6772 alter table t11
6773 reorganize partition s1 into
6774 (partition p0 values less than (15),
6775 partition p1 values less than maxvalue);
6776 select * from t11 order by col1;
6777 col1
6778 04:30:01.000018
6779 05:30:34.000037
6780 alter table t55
6781 partition by list(colint)
6782 subpartition by hash(microsecond(col1)) subpartitions 5
6783 (partition p0 values in (1,2,3,4,5,6,7,8,9,10),
6784 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
6785 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
6786 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
6787 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
6788 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
6789 );
6790 show create table t55;
6791 Table Create Table
6792 t55 CREATE TABLE `t55` (
6793 `colint` int(11) DEFAULT NULL,
6794 `col1` time(6) DEFAULT NULL
6795 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
6796 PARTITION BY LIST (`colint`)
6797 SUBPARTITION BY HASH (microsecond(`col1`))
6798 SUBPARTITIONS 5
6799 (PARTITION `p0` VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB,
6800 PARTITION `p1` VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB,
6801 PARTITION `p2` VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB,
6802 PARTITION `p3` VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB,
6803 PARTITION `p4` VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB,
6804 PARTITION `p5` VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB)
6805 select * from t55 order by colint;
6806 colint col1
6807 1 05:30:34.000037
6808 2 04:30:01.000018
6809 3 00:59:22.000024
6810 4 05:30:34.000037
6811 alter table t66
6812 reorganize partition p0,p1 into
6813 (partition s1 values less than maxvalue);
6814 select * from t66 order by colint;
6815 colint col1
6816 1 05:30:34.000037
6817 2 04:30:01.000018
6818 3 00:59:22.000024
6819 4 05:30:34.000037
6820 alter table t66
6821 reorganize partition s1 into
6822 (partition p0 values less than (microsecond('10:30:10.000010')),
6823 partition p1 values less than maxvalue);
6824 select * from t66 order by colint;
6825 colint col1
6826 1 05:30:34.000037
6827 2 04:30:01.000018
6828 3 00:59:22.000024
6829 4 05:30:34.000037
6830 alter table t66
6831 reorganize partition p0,p1 into
6832 (partition s1 values less than maxvalue);
6833 select * from t66 order by colint;
6834 colint col1
6835 1 05:30:34.000037
6836 2 04:30:01.000018
6837 3 00:59:22.000024
6838 4 05:30:34.000037
6839 alter table t66
6840 reorganize partition s1 into
6841 (partition p0 values less than (microsecond('10:30:10.000010')),
6842 partition p1 values less than maxvalue);
6843 select * from t66 order by colint;
6844 colint col1
6845 1 05:30:34.000037
6846 2 04:30:01.000018
6847 3 00:59:22.000024
6848 4 05:30:34.000037
6849 -------------------------------------------------------------------------
6850 --- Delete rows and partitions of tables with microsecond(col1)
6851 -------------------------------------------------------------------------
6852 begin;
6853 delete from t1 where col1='04:30:01.000018';
6854 delete from t2 where col1='04:30:01.000018';
6855 delete from t3 where col1='04:30:01.000018';
6856 delete from t4 where col1='04:30:01.000018';
6857 delete from t5 where col1='04:30:01.000018';
6858 delete from t6 where col1='04:30:01.000018';
6859 commit;
6860 select * from t1 order by col1;
6861 col1
6862 05:30:34.000037
6863 select * from t2 order by col1;
6864 col1
6865 00:59:22.000024
6866 05:30:34.000037
6867 select * from t3 order by col1;
6868 col1
6869 00:59:22.000024
6870 05:30:34.000037
6871 select * from t4 order by colint;
6872 colint col1
6873 1 05:30:34.000037
6874 3 00:59:22.000024
6875 4 05:30:34.000037
6876 select * from t5 order by colint;
6877 colint col1
6878 1 05:30:34.000037
6879 3 00:59:22.000024
6880 4 05:30:34.000037
6881 begin;
6882 insert into t1 values ('04:30:01.000018');
6883 insert into t2 values ('04:30:01.000018');
6884 insert into t3 values ('04:30:01.000018');
6885 insert into t4 values (60,'04:30:01.000018');
6886 insert into t5 values (60,'04:30:01.000018');
6887 insert into t6 values (60,'04:30:01.000018');
6888 commit;
6889 select * from t1 order by col1;
6890 col1
6891 04:30:01.000018
6892 05:30:34.000037
6893 select * from t2 order by col1;
6894 col1
6895 00:59:22.000024
6896 04:30:01.000018
6897 05:30:34.000037
6898 select * from t3 order by col1;
6899 col1
6900 00:59:22.000024
6901 04:30:01.000018
6902 05:30:34.000037
6903 select * from t4 order by colint;
6904 colint col1
6905 1 05:30:34.000037
6906 3 00:59:22.000024
6907 4 05:30:34.000037
6908 60 04:30:01.000018
6909 select * from t5 order by colint;
6910 colint col1
6911 1 05:30:34.000037
6912 3 00:59:22.000024
6913 4 05:30:34.000037
6914 60 04:30:01.000018
6915 select * from t6 order by colint;
6916 colint col1
6917 1 05:30:34.000037
6918 3 00:59:22.000024
6919 4 05:30:34.000037
6920 60 04:30:01.000018
6921 alter table t1 drop partition p0;
6922 alter table t2 drop partition p0;
6923 alter table t4 drop partition p0;
6924 alter table t5 drop partition p0;
6925 alter table t6 drop partition p0;
6926 select * from t1 order by col1;
6927 col1
6928 04:30:01.000018
6929 05:30:34.000037
6930 select * from t2 order by col1;
6931 col1
6932 00:59:22.000024
6933 04:30:01.000018
6934 05:30:34.000037
6935 select * from t3 order by col1;
6936 col1
6937 00:59:22.000024
6938 04:30:01.000018
6939 05:30:34.000037
6940 select * from t4 order by colint;
6941 colint col1
6942 60 04:30:01.000018
6943 select * from t5 order by colint;
6944 colint col1
6945 60 04:30:01.000018
6946 select * from t6 order by colint;
6947 colint col1
6948 60 04:30:01.000018
6949 -------------------------------------------------------------------------
6950 --- Delete rows and partitions of tables with microsecond(col1)
6951 -------------------------------------------------------------------------
6952 begin;
6953 delete from t11 where col1='04:30:01.000018';
6954 delete from t22 where col1='04:30:01.000018';
6955 delete from t33 where col1='04:30:01.000018';
6956 delete from t44 where col1='04:30:01.000018';
6957 delete from t55 where col1='04:30:01.000018';
6958 delete from t66 where col1='04:30:01.000018';
6959 commit;
6960 select * from t11 order by col1;
6961 col1
6962 05:30:34.000037
6963 select * from t22 order by col1;
6964 col1
6965 00:59:22.000024
6966 05:30:34.000037
6967 select * from t33 order by col1;
6968 col1
6969 00:59:22.000024
6970 05:30:34.000037
6971 select * from t44 order by colint;
6972 colint col1
6973 1 05:30:34.000037
6974 3 00:59:22.000024
6975 4 05:30:34.000037
6976 select * from t55 order by colint;
6977 colint col1
6978 1 05:30:34.000037
6979 3 00:59:22.000024
6980 4 05:30:34.000037
6981 begin;
6982 insert into t11 values ('04:30:01.000018');
6983 insert into t22 values ('04:30:01.000018');
6984 insert into t33 values ('04:30:01.000018');
6985 insert into t44 values (60,'04:30:01.000018');
6986 insert into t55 values (60,'04:30:01.000018');
6987 insert into t66 values (60,'04:30:01.000018');
6988 commit;
6989 select * from t11 order by col1;
6990 col1
6991 04:30:01.000018
6992 05:30:34.000037
6993 select * from t22 order by col1;
6994 col1
6995 00:59:22.000024
6996 04:30:01.000018
6997 05:30:34.000037
6998 select * from t33 order by col1;
6999 col1
7000 00:59:22.000024
7001 04:30:01.000018
7002 05:30:34.000037
7003 select * from t44 order by colint;
7004 colint col1
7005 1 05:30:34.000037
7006 3 00:59:22.000024
7007 4 05:30:34.000037
7008 60 04:30:01.000018
7009 select * from t55 order by colint;
7010 colint col1
7011 1 05:30:34.000037
7012 3 00:59:22.000024
7013 4 05:30:34.000037
7014 60 04:30:01.000018
7015 select * from t66 order by colint;
7016 colint col1
7017 1 05:30:34.000037
7018 3 00:59:22.000024
7019 4 05:30:34.000037
7020 60 04:30:01.000018
7021 alter table t11 drop partition p0;
7022 alter table t22 drop partition p0;
7023 alter table t44 drop partition p0;
7024 alter table t55 drop partition p0;
7025 alter table t66 drop partition p0;
7026 select * from t11 order by col1;
7027 col1
7028 04:30:01.000018
7029 05:30:34.000037
7030 select * from t22 order by col1;
7031 col1
7032 00:59:22.000024
7033 04:30:01.000018
7034 05:30:34.000037
7035 select * from t33 order by col1;
7036 col1
7037 00:59:22.000024
7038 04:30:01.000018
7039 05:30:34.000037
7040 select * from t44 order by colint;
7041 colint col1
7042 60 04:30:01.000018
7043 select * from t55 order by colint;
7044 colint col1
7045 60 04:30:01.000018
7046 select * from t66 order by colint;
7047 colint col1
7048 60 04:30:01.000018
7049 -------------------------
7050 ---- some alter table end
7051 -------------------------
7052 drop table if exists t1 ;
7053 drop table if exists t2 ;
7054 drop table if exists t3 ;
7055 drop table if exists t4 ;
7056 drop table if exists t5 ;
7057 drop table if exists t6 ;
7058 drop table if exists t11 ;
7059 drop table if exists t22 ;
7060 drop table if exists t33 ;
7061 drop table if exists t44 ;
7062 drop table if exists t55 ;
7063 drop table if exists t66 ;
7064 -------------------------------------------------------------------------
7065 --- minute(col1) in partition with coltype time
7066 -------------------------------------------------------------------------
7067 drop table if exists t1 ;
7068 drop table if exists t2 ;
7069 drop table if exists t3 ;
7070 drop table if exists t4 ;
7071 drop table if exists t5 ;
7072 drop table if exists t6 ;
7073 -------------------------------------------------------------------------
7074 --- Create tables with minute(col1)
7075 -------------------------------------------------------------------------
7076 create table t1 (col1 time) engine='INNODB'
7077 partition by range(minute(col1))
7078 (partition p0 values less than (15),
7079 partition p1 values less than maxvalue);
7080 create table t2 (col1 time) engine='INNODB'
7081 partition by list(minute(col1))
7082 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
7083 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
7084 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
7085 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
7086 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
7087 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
7088 );
7089 create table t3 (col1 time) engine='INNODB'
7090 partition by hash(minute(col1));
7091 create table t4 (colint int, col1 time) engine='INNODB'
7092 partition by range(colint)
7093 subpartition by hash(minute(col1)) subpartitions 2
7094 (partition p0 values less than (15),
7095 partition p1 values less than maxvalue);
7096 create table t5 (colint int, col1 time) engine='INNODB'
7097 partition by list(colint)
7098 subpartition by hash(minute(col1)) subpartitions 2
7099 (partition p0 values in (1,2,3,4,5,6,7,8,9,10),
7100 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
7101 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
7102 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
7103 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
7104 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
7105 );
7106 create table t6 (colint int, col1 time) engine='INNODB'
7107 partition by range(colint)
7108 (partition p0 values less than (minute('18:30')),
7109 partition p1 values less than maxvalue);
7110 -------------------------------------------------------------------------
7111 --- Access tables with minute(col1)
7112 -------------------------------------------------------------------------
7113 begin;
7114 insert into t1 values ('09:09:15');
7115 insert into t1 values ('14:30:45');
7116 insert into t2 values ('09:09:15');
7117 insert into t2 values ('14:30:45');
7118 insert into t2 values ('21:59:22');
7119 insert into t3 values ('09:09:15');
7120 insert into t3 values ('14:30:45');
7121 insert into t3 values ('21:59:22');
7122 commit;
7123 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t4;
7124 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t5;
7125 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t6;
7126 select minute(col1) from t1 order by col1;
7127 minute(col1)
7128 9
7129 30
7130 select * from t1 order by col1;
7131 col1
7132 09:09:15
7133 14:30:45
7134 select * from t2 order by col1;
7135 col1
7136 09:09:15
7137 14:30:45
7138 21:59:22
7139 select * from t3 order by col1;
7140 col1
7141 09:09:15
7142 14:30:45
7143 21:59:22
7144 select * from t4 order by colint;
7145 colint col1
7146 1 09:09:15
7147 2 04:30:01
7148 3 00:59:22
7149 4 05:30:34
7150 select * from t5 order by colint;
7151 colint col1
7152 1 09:09:15
7153 2 04:30:01
7154 3 00:59:22
7155 4 05:30:34
7156 select * from t6 order by colint;
7157 colint col1
7158 1 09:09:15
7159 2 04:30:01
7160 3 00:59:22
7161 4 05:30:34
7162 begin;
7163 update t1 set col1='10:24:23' where col1='09:09:15';
7164 update t2 set col1='10:24:23' where col1='09:09:15';
7165 update t3 set col1='10:24:23' where col1='09:09:15';
7166 update t4 set col1='10:24:23' where col1='09:09:15';
7167 update t5 set col1='10:24:23' where col1='09:09:15';
7168 update t6 set col1='10:24:23' where col1='09:09:15';
7169 commit;
7170 select * from t1 order by col1;
7171 col1
7172 10:24:23
7173 14:30:45
7174 select * from t2 order by col1;
7175 col1
7176 10:24:23
7177 14:30:45
7178 21:59:22
7179 select * from t3 order by col1;
7180 col1
7181 10:24:23
7182 14:30:45
7183 21:59:22
7184 select * from t4 order by colint;
7185 colint col1
7186 1 10:24:23
7187 2 04:30:01
7188 3 00:59:22
7189 4 05:30:34
7190 select * from t5 order by colint;
7191 colint col1
7192 1 10:24:23
7193 2 04:30:01
7194 3 00:59:22
7195 4 05:30:34
7196 select * from t6 order by colint;
7197 colint col1
7198 1 10:24:23
7199 2 04:30:01
7200 3 00:59:22
7201 4 05:30:34
7202 -------------------------------------------------------------------------
7203 --- Alter tables with minute(col1)
7204 -------------------------------------------------------------------------
7205 drop table if exists t11 ;
7206 drop table if exists t22 ;
7207 drop table if exists t33 ;
7208 drop table if exists t44 ;
7209 drop table if exists t55 ;
7210 drop table if exists t66 ;
7211 create table t11 engine='INNODB' as select * from t1;
7212 create table t22 engine='INNODB' as select * from t2;
7213 create table t33 engine='INNODB' as select * from t3;
7214 create table t44 engine='INNODB' as select * from t4;
7215 create table t55 engine='INNODB' as select * from t5;
7216 create table t66 engine='INNODB' as select * from t6;
7217 alter table t11
7218 partition by range(minute(col1))
7219 (partition p0 values less than (15),
7220 partition p1 values less than maxvalue);
7221 alter table t22
7222 partition by list(minute(col1))
7223 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
7224 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
7225 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
7226 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
7227 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
7228 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
7229 );
7230 alter table t33
7231 partition by hash(minute(col1));
7232 alter table t44
7233 partition by range(colint)
7234 subpartition by hash(minute(col1)) subpartitions 2
7235 (partition p0 values less than (15),
7236 partition p1 values less than maxvalue);
7237 alter table t55
7238 partition by list(colint)
7239 subpartition by hash(minute(col1)) subpartitions 2
7240 (partition p0 values in (1,2,3,4,5,6,7,8,9,10),
7241 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
7242 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
7243 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
7244 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
7245 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
7246 );
7247 alter table t66
7248 partition by range(colint)
7249 (partition p0 values less than (minute('18:30')),
7250 partition p1 values less than maxvalue);
7251 select * from t11 order by col1;
7252 col1
7253 10:24:23
7254 14:30:45
7255 select * from t22 order by col1;
7256 col1
7257 10:24:23
7258 14:30:45
7259 21:59:22
7260 select * from t33 order by col1;
7261 col1
7262 10:24:23
7263 14:30:45
7264 21:59:22
7265 select * from t44 order by colint;
7266 colint col1
7267 1 10:24:23
7268 2 04:30:01
7269 3 00:59:22
7270 4 05:30:34
7271 select * from t55 order by colint;
7272 colint col1
7273 1 10:24:23
7274 2 04:30:01
7275 3 00:59:22
7276 4 05:30:34
7277 select * from t66 order by colint;
7278 colint col1
7279 1 10:24:23
7280 2 04:30:01
7281 3 00:59:22
7282 4 05:30:34
7283 ---------------------------
7284 ---- some alter table begin
7285 ---------------------------
7286 alter table t11
7287 reorganize partition p0,p1 into
7288 (partition s1 values less than maxvalue);
7289 select * from t11 order by col1;
7290 col1
7291 10:24:23
7292 14:30:45
7293 alter table t11
7294 reorganize partition s1 into
7295 (partition p0 values less than (15),
7296 partition p1 values less than maxvalue);
7297 select * from t11 order by col1;
7298 col1
7299 10:24:23
7300 14:30:45
7301 alter table t55
7302 partition by list(colint)
7303 subpartition by hash(minute(col1)) subpartitions 5
7304 (partition p0 values in (1,2,3,4,5,6,7,8,9,10),
7305 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
7306 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
7307 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
7308 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
7309 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
7310 );
7311 show create table t55;
7312 Table Create Table
7313 t55 CREATE TABLE `t55` (
7314 `colint` int(11) DEFAULT NULL,
7315 `col1` time DEFAULT NULL
7316 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
7317 PARTITION BY LIST (`colint`)
7318 SUBPARTITION BY HASH (minute(`col1`))
7319 SUBPARTITIONS 5
7320 (PARTITION `p0` VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB,
7321 PARTITION `p1` VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB,
7322 PARTITION `p2` VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB,
7323 PARTITION `p3` VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB,
7324 PARTITION `p4` VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB,
7325 PARTITION `p5` VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB)
7326 select * from t55 order by colint;
7327 colint col1
7328 1 10:24:23
7329 2 04:30:01
7330 3 00:59:22
7331 4 05:30:34
7332 alter table t66
7333 reorganize partition p0,p1 into
7334 (partition s1 values less than maxvalue);
7335 select * from t66 order by colint;
7336 colint col1
7337 1 10:24:23
7338 2 04:30:01
7339 3 00:59:22
7340 4 05:30:34
7341 alter table t66
7342 reorganize partition s1 into
7343 (partition p0 values less than (minute('18:30')),
7344 partition p1 values less than maxvalue);
7345 select * from t66 order by colint;
7346 colint col1
7347 1 10:24:23
7348 2 04:30:01
7349 3 00:59:22
7350 4 05:30:34
7351 alter table t66
7352 reorganize partition p0,p1 into
7353 (partition s1 values less than maxvalue);
7354 select * from t66 order by colint;
7355 colint col1
7356 1 10:24:23
7357 2 04:30:01
7358 3 00:59:22
7359 4 05:30:34
7360 alter table t66
7361 reorganize partition s1 into
7362 (partition p0 values less than (minute('18:30')),
7363 partition p1 values less than maxvalue);
7364 select * from t66 order by colint;
7365 colint col1
7366 1 10:24:23
7367 2 04:30:01
7368 3 00:59:22
7369 4 05:30:34
7370 -------------------------------------------------------------------------
7371 --- Delete rows and partitions of tables with minute(col1)
7372 -------------------------------------------------------------------------
7373 begin;
7374 delete from t1 where col1='14:30:45';
7375 delete from t2 where col1='14:30:45';
7376 delete from t3 where col1='14:30:45';
7377 delete from t4 where col1='14:30:45';
7378 delete from t5 where col1='14:30:45';
7379 delete from t6 where col1='14:30:45';
7380 commit;
7381 select * from t1 order by col1;
7382 col1
7383 10:24:23
7384 select * from t2 order by col1;
7385 col1
7386 10:24:23
7387 21:59:22
7388 select * from t3 order by col1;
7389 col1
7390 10:24:23
7391 21:59:22
7392 select * from t4 order by colint;
7393 colint col1
7394 1 10:24:23
7395 2 04:30:01
7396 3 00:59:22
7397 4 05:30:34
7398 select * from t5 order by colint;
7399 colint col1
7400 1 10:24:23
7401 2 04:30:01
7402 3 00:59:22
7403 4 05:30:34
7404 begin;
7405 insert into t1 values ('14:30:45');
7406 insert into t2 values ('14:30:45');
7407 insert into t3 values ('14:30:45');
7408 insert into t4 values (60,'14:30:45');
7409 insert into t5 values (60,'14:30:45');
7410 insert into t6 values (60,'14:30:45');
7411 commit;
7412 select * from t1 order by col1;
7413 col1
7414 10:24:23
7415 14:30:45
7416 select * from t2 order by col1;
7417 col1
7418 10:24:23
7419 14:30:45
7420 21:59:22
7421 select * from t3 order by col1;
7422 col1
7423 10:24:23
7424 14:30:45
7425 21:59:22
7426 select * from t4 order by colint;
7427 colint col1
7428 1 10:24:23
7429 2 04:30:01
7430 3 00:59:22
7431 4 05:30:34
7432 60 14:30:45
7433 select * from t5 order by colint;
7434 colint col1
7435 1 10:24:23
7436 2 04:30:01
7437 3 00:59:22
7438 4 05:30:34
7439 60 14:30:45
7440 select * from t6 order by colint;
7441 colint col1
7442 1 10:24:23
7443 2 04:30:01
7444 3 00:59:22
7445 4 05:30:34
7446 60 14:30:45
7447 alter table t1 drop partition p0;
7448 alter table t2 drop partition p0;
7449 alter table t4 drop partition p0;
7450 alter table t5 drop partition p0;
7451 alter table t6 drop partition p0;
7452 select * from t1 order by col1;
7453 col1
7454 10:24:23
7455 14:30:45
7456 select * from t2 order by col1;
7457 col1
7458 10:24:23
7459 14:30:45
7460 21:59:22
7461 select * from t3 order by col1;
7462 col1
7463 10:24:23
7464 14:30:45
7465 21:59:22
7466 select * from t4 order by colint;
7467 colint col1
7468 60 14:30:45
7469 select * from t5 order by colint;
7470 colint col1
7471 60 14:30:45
7472 select * from t6 order by colint;
7473 colint col1
7474 60 14:30:45
7475 -------------------------------------------------------------------------
7476 --- Delete rows and partitions of tables with minute(col1)
7477 -------------------------------------------------------------------------
7478 begin;
7479 delete from t11 where col1='14:30:45';
7480 delete from t22 where col1='14:30:45';
7481 delete from t33 where col1='14:30:45';
7482 delete from t44 where col1='14:30:45';
7483 delete from t55 where col1='14:30:45';
7484 delete from t66 where col1='14:30:45';
7485 commit;
7486 select * from t11 order by col1;
7487 col1
7488 10:24:23
7489 select * from t22 order by col1;
7490 col1
7491 10:24:23
7492 21:59:22
7493 select * from t33 order by col1;
7494 col1
7495 10:24:23
7496 21:59:22
7497 select * from t44 order by colint;
7498 colint col1
7499 1 10:24:23
7500 2 04:30:01
7501 3 00:59:22
7502 4 05:30:34
7503 select * from t55 order by colint;
7504 colint col1
7505 1 10:24:23
7506 2 04:30:01
7507 3 00:59:22
7508 4 05:30:34
7509 begin;
7510 insert into t11 values ('14:30:45');
7511 insert into t22 values ('14:30:45');
7512 insert into t33 values ('14:30:45');
7513 insert into t44 values (60,'14:30:45');
7514 insert into t55 values (60,'14:30:45');
7515 insert into t66 values (60,'14:30:45');
7516 commit;
7517 select * from t11 order by col1;
7518 col1
7519 10:24:23
7520 14:30:45
7521 select * from t22 order by col1;
7522 col1
7523 10:24:23
7524 14:30:45
7525 21:59:22
7526 select * from t33 order by col1;
7527 col1
7528 10:24:23
7529 14:30:45
7530 21:59:22
7531 select * from t44 order by colint;
7532 colint col1
7533 1 10:24:23
7534 2 04:30:01
7535 3 00:59:22
7536 4 05:30:34
7537 60 14:30:45
7538 select * from t55 order by colint;
7539 colint col1
7540 1 10:24:23
7541 2 04:30:01
7542 3 00:59:22
7543 4 05:30:34
7544 60 14:30:45
7545 select * from t66 order by colint;
7546 colint col1
7547 1 10:24:23
7548 2 04:30:01
7549 3 00:59:22
7550 4 05:30:34
7551 60 14:30:45
7552 alter table t11 drop partition p0;
7553 alter table t22 drop partition p0;
7554 alter table t44 drop partition p0;
7555 alter table t55 drop partition p0;
7556 alter table t66 drop partition p0;
7557 select * from t11 order by col1;
7558 col1
7559 10:24:23
7560 14:30:45
7561 select * from t22 order by col1;
7562 col1
7563 10:24:23
7564 14:30:45
7565 21:59:22
7566 select * from t33 order by col1;
7567 col1
7568 10:24:23
7569 14:30:45
7570 21:59:22
7571 select * from t44 order by colint;
7572 colint col1
7573 60 14:30:45
7574 select * from t55 order by colint;
7575 colint col1
7576 60 14:30:45
7577 select * from t66 order by colint;
7578 colint col1
7579 60 14:30:45
7580 -------------------------
7581 ---- some alter table end
7582 -------------------------
7583 drop table if exists t1 ;
7584 drop table if exists t2 ;
7585 drop table if exists t3 ;
7586 drop table if exists t4 ;
7587 drop table if exists t5 ;
7588 drop table if exists t6 ;
7589 drop table if exists t11 ;
7590 drop table if exists t22 ;
7591 drop table if exists t33 ;
7592 drop table if exists t44 ;
7593 drop table if exists t55 ;
7594 drop table if exists t66 ;
7595 -------------------------------------------------------------------------
7596 --- second(col1) in partition with coltype time
7597 -------------------------------------------------------------------------
7598 drop table if exists t1 ;
7599 drop table if exists t2 ;
7600 drop table if exists t3 ;
7601 drop table if exists t4 ;
7602 drop table if exists t5 ;
7603 drop table if exists t6 ;
7604 -------------------------------------------------------------------------
7605 --- Create tables with second(col1)
7606 -------------------------------------------------------------------------
7607 create table t1 (col1 time) engine='INNODB'
7608 partition by range(second(col1))
7609 (partition p0 values less than (15),
7610 partition p1 values less than maxvalue);
7611 create table t2 (col1 time) engine='INNODB'
7612 partition by list(second(col1))
7613 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
7614 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
7615 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
7616 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
7617 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
7618 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
7619 );
7620 create table t3 (col1 time) engine='INNODB'
7621 partition by hash(second(col1));
7622 create table t4 (colint int, col1 time) engine='INNODB'
7623 partition by range(colint)
7624 subpartition by hash(second(col1)) subpartitions 2
7625 (partition p0 values less than (15),
7626 partition p1 values less than maxvalue);
7627 create table t5 (colint int, col1 time) engine='INNODB'
7628 partition by list(colint)
7629 subpartition by hash(second(col1)) subpartitions 2
7630 (partition p0 values in (1,2,3,4,5,6,7,8,9,10),
7631 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
7632 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
7633 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
7634 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
7635 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
7636 );
7637 create table t6 (colint int, col1 time) engine='INNODB'
7638 partition by range(colint)
7639 (partition p0 values less than (second('18:30:14')),
7640 partition p1 values less than maxvalue);
7641 -------------------------------------------------------------------------
7642 --- Access tables with second(col1)
7643 -------------------------------------------------------------------------
7644 begin;
7645 insert into t1 values ('09:09:09');
7646 insert into t1 values ('14:30:20');
7647 insert into t2 values ('09:09:09');
7648 insert into t2 values ('14:30:20');
7649 insert into t2 values ('21:59:22');
7650 insert into t3 values ('09:09:09');
7651 insert into t3 values ('14:30:20');
7652 insert into t3 values ('21:59:22');
7653 commit;
7654 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t4;
7655 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t5;
7656 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t6;
7657 select second(col1) from t1 order by col1;
7658 second(col1)
7659 9
7660 20
7661 select * from t1 order by col1;
7662 col1
7663 09:09:09
7664 14:30:20
7665 select * from t2 order by col1;
7666 col1
7667 09:09:09
7668 14:30:20
7669 21:59:22
7670 select * from t3 order by col1;
7671 col1
7672 09:09:09
7673 14:30:20
7674 21:59:22
7675 select * from t4 order by colint;
7676 colint col1
7677 1 09:09:15
7678 2 04:30:01
7679 3 00:59:22
7680 4 05:30:34
7681 select * from t5 order by colint;
7682 colint col1
7683 1 09:09:15
7684 2 04:30:01
7685 3 00:59:22
7686 4 05:30:34
7687 select * from t6 order by colint;
7688 colint col1
7689 1 09:09:15
7690 2 04:30:01
7691 3 00:59:22
7692 4 05:30:34
7693 begin;
7694 update t1 set col1='10:22:33' where col1='09:09:09';
7695 update t2 set col1='10:22:33' where col1='09:09:09';
7696 update t3 set col1='10:22:33' where col1='09:09:09';
7697 update t4 set col1='10:22:33' where col1='09:09:09';
7698 update t5 set col1='10:22:33' where col1='09:09:09';
7699 update t6 set col1='10:22:33' where col1='09:09:09';
7700 commit;
7701 select * from t1 order by col1;
7702 col1
7703 10:22:33
7704 14:30:20
7705 select * from t2 order by col1;
7706 col1
7707 10:22:33
7708 14:30:20
7709 21:59:22
7710 select * from t3 order by col1;
7711 col1
7712 10:22:33
7713 14:30:20
7714 21:59:22
7715 select * from t4 order by colint;
7716 colint col1
7717 1 09:09:15
7718 2 04:30:01
7719 3 00:59:22
7720 4 05:30:34
7721 select * from t5 order by colint;
7722 colint col1
7723 1 09:09:15
7724 2 04:30:01
7725 3 00:59:22
7726 4 05:30:34
7727 select * from t6 order by colint;
7728 colint col1
7729 1 09:09:15
7730 2 04:30:01
7731 3 00:59:22
7732 4 05:30:34
7733 -------------------------------------------------------------------------
7734 --- Alter tables with second(col1)
7735 -------------------------------------------------------------------------
7736 drop table if exists t11 ;
7737 drop table if exists t22 ;
7738 drop table if exists t33 ;
7739 drop table if exists t44 ;
7740 drop table if exists t55 ;
7741 drop table if exists t66 ;
7742 create table t11 engine='INNODB' as select * from t1;
7743 create table t22 engine='INNODB' as select * from t2;
7744 create table t33 engine='INNODB' as select * from t3;
7745 create table t44 engine='INNODB' as select * from t4;
7746 create table t55 engine='INNODB' as select * from t5;
7747 create table t66 engine='INNODB' as select * from t6;
7748 alter table t11
7749 partition by range(second(col1))
7750 (partition p0 values less than (15),
7751 partition p1 values less than maxvalue);
7752 alter table t22
7753 partition by list(second(col1))
7754 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
7755 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
7756 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
7757 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
7758 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
7759 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
7760 );
7761 alter table t33
7762 partition by hash(second(col1));
7763 alter table t44
7764 partition by range(colint)
7765 subpartition by hash(second(col1)) subpartitions 2
7766 (partition p0 values less than (15),
7767 partition p1 values less than maxvalue);
7768 alter table t55
7769 partition by list(colint)
7770 subpartition by hash(second(col1)) subpartitions 2
7771 (partition p0 values in (1,2,3,4,5,6,7,8,9,10),
7772 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
7773 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
7774 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
7775 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
7776 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
7777 );
7778 alter table t66
7779 partition by range(colint)
7780 (partition p0 values less than (second('18:30:14')),
7781 partition p1 values less than maxvalue);
7782 select * from t11 order by col1;
7783 col1
7784 10:22:33
7785 14:30:20
7786 select * from t22 order by col1;
7787 col1
7788 10:22:33
7789 14:30:20
7790 21:59:22
7791 select * from t33 order by col1;
7792 col1
7793 10:22:33
7794 14:30:20
7795 21:59:22
7796 select * from t44 order by colint;
7797 colint col1
7798 1 09:09:15
7799 2 04:30:01
7800 3 00:59:22
7801 4 05:30:34
7802 select * from t55 order by colint;
7803 colint col1
7804 1 09:09:15
7805 2 04:30:01
7806 3 00:59:22
7807 4 05:30:34
7808 select * from t66 order by colint;
7809 colint col1
7810 1 09:09:15
7811 2 04:30:01
7812 3 00:59:22
7813 4 05:30:34
7814 ---------------------------
7815 ---- some alter table begin
7816 ---------------------------
7817 alter table t11
7818 reorganize partition p0,p1 into
7819 (partition s1 values less than maxvalue);
7820 select * from t11 order by col1;
7821 col1
7822 10:22:33
7823 14:30:20
7824 alter table t11
7825 reorganize partition s1 into
7826 (partition p0 values less than (15),
7827 partition p1 values less than maxvalue);
7828 select * from t11 order by col1;
7829 col1
7830 10:22:33
7831 14:30:20
7832 alter table t55
7833 partition by list(colint)
7834 subpartition by hash(second(col1)) subpartitions 5
7835 (partition p0 values in (1,2,3,4,5,6,7,8,9,10),
7836 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
7837 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
7838 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
7839 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
7840 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
7841 );
7842 show create table t55;
7843 Table Create Table
7844 t55 CREATE TABLE `t55` (
7845 `colint` int(11) DEFAULT NULL,
7846 `col1` time DEFAULT NULL
7847 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
7848 PARTITION BY LIST (`colint`)
7849 SUBPARTITION BY HASH (second(`col1`))
7850 SUBPARTITIONS 5
7851 (PARTITION `p0` VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB,
7852 PARTITION `p1` VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB,
7853 PARTITION `p2` VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB,
7854 PARTITION `p3` VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB,
7855 PARTITION `p4` VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB,
7856 PARTITION `p5` VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB)
7857 select * from t55 order by colint;
7858 colint col1
7859 1 09:09:15
7860 2 04:30:01
7861 3 00:59:22
7862 4 05:30:34
7863 alter table t66
7864 reorganize partition p0,p1 into
7865 (partition s1 values less than maxvalue);
7866 select * from t66 order by colint;
7867 colint col1
7868 1 09:09:15
7869 2 04:30:01
7870 3 00:59:22
7871 4 05:30:34
7872 alter table t66
7873 reorganize partition s1 into
7874 (partition p0 values less than (second('18:30:14')),
7875 partition p1 values less than maxvalue);
7876 select * from t66 order by colint;
7877 colint col1
7878 1 09:09:15
7879 2 04:30:01
7880 3 00:59:22
7881 4 05:30:34
7882 alter table t66
7883 reorganize partition p0,p1 into
7884 (partition s1 values less than maxvalue);
7885 select * from t66 order by colint;
7886 colint col1
7887 1 09:09:15
7888 2 04:30:01
7889 3 00:59:22
7890 4 05:30:34
7891 alter table t66
7892 reorganize partition s1 into
7893 (partition p0 values less than (second('18:30:14')),
7894 partition p1 values less than maxvalue);
7895 select * from t66 order by colint;
7896 colint col1
7897 1 09:09:15
7898 2 04:30:01
7899 3 00:59:22
7900 4 05:30:34
7901 -------------------------------------------------------------------------
7902 --- Delete rows and partitions of tables with second(col1)
7903 -------------------------------------------------------------------------
7904 begin;
7905 delete from t1 where col1='14:30:20';
7906 delete from t2 where col1='14:30:20';
7907 delete from t3 where col1='14:30:20';
7908 delete from t4 where col1='14:30:20';
7909 delete from t5 where col1='14:30:20';
7910 delete from t6 where col1='14:30:20';
7911 commit;
7912 select * from t1 order by col1;
7913 col1
7914 10:22:33
7915 select * from t2 order by col1;
7916 col1
7917 10:22:33
7918 21:59:22
7919 select * from t3 order by col1;
7920 col1
7921 10:22:33
7922 21:59:22
7923 select * from t4 order by colint;
7924 colint col1
7925 1 09:09:15
7926 2 04:30:01
7927 3 00:59:22
7928 4 05:30:34
7929 select * from t5 order by colint;
7930 colint col1
7931 1 09:09:15
7932 2 04:30:01
7933 3 00:59:22
7934 4 05:30:34
7935 begin;
7936 insert into t1 values ('14:30:20');
7937 insert into t2 values ('14:30:20');
7938 insert into t3 values ('14:30:20');
7939 insert into t4 values (60,'14:30:20');
7940 insert into t5 values (60,'14:30:20');
7941 insert into t6 values (60,'14:30:20');
7942 commit;
7943 select * from t1 order by col1;
7944 col1
7945 10:22:33
7946 14:30:20
7947 select * from t2 order by col1;
7948 col1
7949 10:22:33
7950 14:30:20
7951 21:59:22
7952 select * from t3 order by col1;
7953 col1
7954 10:22:33
7955 14:30:20
7956 21:59:22
7957 select * from t4 order by colint;
7958 colint col1
7959 1 09:09:15
7960 2 04:30:01
7961 3 00:59:22
7962 4 05:30:34
7963 60 14:30:20
7964 select * from t5 order by colint;
7965 colint col1
7966 1 09:09:15
7967 2 04:30:01
7968 3 00:59:22
7969 4 05:30:34
7970 60 14:30:20
7971 select * from t6 order by colint;
7972 colint col1
7973 1 09:09:15
7974 2 04:30:01
7975 3 00:59:22
7976 4 05:30:34
7977 60 14:30:20
7978 alter table t1 drop partition p0;
7979 alter table t2 drop partition p0;
7980 alter table t4 drop partition p0;
7981 alter table t5 drop partition p0;
7982 alter table t6 drop partition p0;
7983 select * from t1 order by col1;
7984 col1
7985 10:22:33
7986 14:30:20
7987 select * from t2 order by col1;
7988 col1
7989 10:22:33
7990 14:30:20
7991 21:59:22
7992 select * from t3 order by col1;
7993 col1
7994 10:22:33
7995 14:30:20
7996 21:59:22
7997 select * from t4 order by colint;
7998 colint col1
7999 60 14:30:20
8000 select * from t5 order by colint;
8001 colint col1
8002 60 14:30:20
8003 select * from t6 order by colint;
8004 colint col1
8005 60 14:30:20
8006 -------------------------------------------------------------------------
8007 --- Delete rows and partitions of tables with second(col1)
8008 -------------------------------------------------------------------------
8009 begin;
8010 delete from t11 where col1='14:30:20';
8011 delete from t22 where col1='14:30:20';
8012 delete from t33 where col1='14:30:20';
8013 delete from t44 where col1='14:30:20';
8014 delete from t55 where col1='14:30:20';
8015 delete from t66 where col1='14:30:20';
8016 commit;
8017 select * from t11 order by col1;
8018 col1
8019 10:22:33
8020 select * from t22 order by col1;
8021 col1
8022 10:22:33
8023 21:59:22
8024 select * from t33 order by col1;
8025 col1
8026 10:22:33
8027 21:59:22
8028 select * from t44 order by colint;
8029 colint col1
8030 1 09:09:15
8031 2 04:30:01
8032 3 00:59:22
8033 4 05:30:34
8034 select * from t55 order by colint;
8035 colint col1
8036 1 09:09:15
8037 2 04:30:01
8038 3 00:59:22
8039 4 05:30:34
8040 begin;
8041 insert into t11 values ('14:30:20');
8042 insert into t22 values ('14:30:20');
8043 insert into t33 values ('14:30:20');
8044 insert into t44 values (60,'14:30:20');
8045 insert into t55 values (60,'14:30:20');
8046 insert into t66 values (60,'14:30:20');
8047 commit;
8048 select * from t11 order by col1;
8049 col1
8050 10:22:33
8051 14:30:20
8052 select * from t22 order by col1;
8053 col1
8054 10:22:33
8055 14:30:20
8056 21:59:22
8057 select * from t33 order by col1;
8058 col1
8059 10:22:33
8060 14:30:20
8061 21:59:22
8062 select * from t44 order by colint;
8063 colint col1
8064 1 09:09:15
8065 2 04:30:01
8066 3 00:59:22
8067 4 05:30:34
8068 60 14:30:20
8069 select * from t55 order by colint;
8070 colint col1
8071 1 09:09:15
8072 2 04:30:01
8073 3 00:59:22
8074 4 05:30:34
8075 60 14:30:20
8076 select * from t66 order by colint;
8077 colint col1
8078 1 09:09:15
8079 2 04:30:01
8080 3 00:59:22
8081 4 05:30:34
8082 60 14:30:20
8083 alter table t11 drop partition p0;
8084 alter table t22 drop partition p0;
8085 alter table t44 drop partition p0;
8086 alter table t55 drop partition p0;
8087 alter table t66 drop partition p0;
8088 select * from t11 order by col1;
8089 col1
8090 10:22:33
8091 14:30:20
8092 select * from t22 order by col1;
8093 col1
8094 10:22:33
8095 14:30:20
8096 21:59:22
8097 select * from t33 order by col1;
8098 col1
8099 10:22:33
8100 14:30:20
8101 21:59:22
8102 select * from t44 order by colint;
8103 colint col1
8104 60 14:30:20
8105 select * from t55 order by colint;
8106 colint col1
8107 60 14:30:20
8108 select * from t66 order by colint;
8109 colint col1
8110 60 14:30:20
8111 -------------------------
8112 ---- some alter table end
8113 -------------------------
8114 drop table if exists t1 ;
8115 drop table if exists t2 ;
8116 drop table if exists t3 ;
8117 drop table if exists t4 ;
8118 drop table if exists t5 ;
8119 drop table if exists t6 ;
8120 drop table if exists t11 ;
8121 drop table if exists t22 ;
8122 drop table if exists t33 ;
8123 drop table if exists t44 ;
8124 drop table if exists t55 ;
8125 drop table if exists t66 ;
8126 -------------------------------------------------------------------------
8127 --- month(col1) in partition with coltype date
8128 -------------------------------------------------------------------------
8129 drop table if exists t1 ;
8130 drop table if exists t2 ;
8131 drop table if exists t3 ;
8132 drop table if exists t4 ;
8133 drop table if exists t5 ;
8134 drop table if exists t6 ;
8135 -------------------------------------------------------------------------
8136 --- Create tables with month(col1)
8137 -------------------------------------------------------------------------
8138 create table t1 (col1 date) engine='INNODB'
8139 partition by range(month(col1))
8140 (partition p0 values less than (15),
8141 partition p1 values less than maxvalue);
8142 create table t2 (col1 date) engine='INNODB'
8143 partition by list(month(col1))
8144 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
8145 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
8146 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
8147 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
8148 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
8149 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
8150 );
8151 create table t3 (col1 date) engine='INNODB'
8152 partition by hash(month(col1));
8153 create table t4 (colint int, col1 date) engine='INNODB'
8154 partition by range(colint)
8155 subpartition by hash(month(col1)) subpartitions 2
8156 (partition p0 values less than (15),
8157 partition p1 values less than maxvalue);
8158 create table t5 (colint int, col1 date) engine='INNODB'
8159 partition by list(colint)
8160 subpartition by hash(month(col1)) subpartitions 2
8161 (partition p0 values in (1,2,3,4,5,6,7,8,9,10),
8162 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
8163 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
8164 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
8165 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
8166 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
8167 );
8168 create table t6 (colint int, col1 date) engine='INNODB'
8169 partition by range(colint)
8170 (partition p0 values less than (month('2006-10-14')),
8171 partition p1 values less than maxvalue);
8172 -------------------------------------------------------------------------
8173 --- Access tables with month(col1)
8174 -------------------------------------------------------------------------
8175 begin;
8176 insert into t1 values ('2006-01-03');
8177 insert into t1 values ('2006-12-17');
8178 insert into t2 values ('2006-01-03');
8179 insert into t2 values ('2006-12-17');
8180 insert into t2 values ('2006-05-25');
8181 insert into t3 values ('2006-01-03');
8182 insert into t3 values ('2006-12-17');
8183 insert into t3 values ('2006-05-25');
8184 commit;
8185 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4;
8186 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5;
8187 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6;
8188 select month(col1) from t1 order by col1;
8189 month(col1)
8190 1
8191 12
8192 select * from t1 order by col1;
8193 col1
8194 2006-01-03
8195 2006-12-17
8196 select * from t2 order by col1;
8197 col1
8198 2006-01-03
8199 2006-05-25
8200 2006-12-17
8201 select * from t3 order by col1;
8202 col1
8203 2006-01-03
8204 2006-05-25
8205 2006-12-17
8206 select * from t4 order by colint;
8207 colint col1
8208 1 2006-02-03
8209 2 2006-01-17
8210 3 2006-01-25
8211 4 2006-02-05
8212 select * from t5 order by colint;
8213 colint col1
8214 1 2006-02-03
8215 2 2006-01-17
8216 3 2006-01-25
8217 4 2006-02-05
8218 select * from t6 order by colint;
8219 colint col1
8220 1 2006-02-03
8221 2 2006-01-17
8222 3 2006-01-25
8223 4 2006-02-05
8224 begin;
8225 update t1 set col1='2006-11-06' where col1='2006-01-03';
8226 update t2 set col1='2006-11-06' where col1='2006-01-03';
8227 update t3 set col1='2006-11-06' where col1='2006-01-03';
8228 update t4 set col1='2006-11-06' where col1='2006-01-03';
8229 update t5 set col1='2006-11-06' where col1='2006-01-03';
8230 update t6 set col1='2006-11-06' where col1='2006-01-03';
8231 commit;
8232 select * from t1 order by col1;
8233 col1
8234 2006-11-06
8235 2006-12-17
8236 select * from t2 order by col1;
8237 col1
8238 2006-05-25
8239 2006-11-06
8240 2006-12-17
8241 select * from t3 order by col1;
8242 col1
8243 2006-05-25
8244 2006-11-06
8245 2006-12-17
8246 select * from t4 order by colint;
8247 colint col1
8248 1 2006-02-03
8249 2 2006-01-17
8250 3 2006-01-25
8251 4 2006-02-05
8252 select * from t5 order by colint;
8253 colint col1
8254 1 2006-02-03
8255 2 2006-01-17
8256 3 2006-01-25
8257 4 2006-02-05
8258 select * from t6 order by colint;
8259 colint col1
8260 1 2006-02-03
8261 2 2006-01-17
8262 3 2006-01-25
8263 4 2006-02-05
8264 -------------------------------------------------------------------------
8265 --- Alter tables with month(col1)
8266 -------------------------------------------------------------------------
8267 drop table if exists t11 ;
8268 drop table if exists t22 ;
8269 drop table if exists t33 ;
8270 drop table if exists t44 ;
8271 drop table if exists t55 ;
8272 drop table if exists t66 ;
8273 create table t11 engine='INNODB' as select * from t1;
8274 create table t22 engine='INNODB' as select * from t2;
8275 create table t33 engine='INNODB' as select * from t3;
8276 create table t44 engine='INNODB' as select * from t4;
8277 create table t55 engine='INNODB' as select * from t5;
8278 create table t66 engine='INNODB' as select * from t6;
8279 alter table t11
8280 partition by range(month(col1))
8281 (partition p0 values less than (15),
8282 partition p1 values less than maxvalue);
8283 alter table t22
8284 partition by list(month(col1))
8285 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
8286 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
8287 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
8288 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
8289 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
8290 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
8291 );
8292 alter table t33
8293 partition by hash(month(col1));
8294 alter table t44
8295 partition by range(colint)
8296 subpartition by hash(month(col1)) subpartitions 2
8297 (partition p0 values less than (15),
8298 partition p1 values less than maxvalue);
8299 alter table t55
8300 partition by list(colint)
8301 subpartition by hash(month(col1)) subpartitions 2
8302 (partition p0 values in (1,2,3,4,5,6,7,8,9,10),
8303 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
8304 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
8305 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
8306 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
8307 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
8308 );
8309 alter table t66
8310 partition by range(colint)
8311 (partition p0 values less than (month('2006-10-14')),
8312 partition p1 values less than maxvalue);
8313 select * from t11 order by col1;
8314 col1
8315 2006-11-06
8316 2006-12-17
8317 select * from t22 order by col1;
8318 col1
8319 2006-05-25
8320 2006-11-06
8321 2006-12-17
8322 select * from t33 order by col1;
8323 col1
8324 2006-05-25
8325 2006-11-06
8326 2006-12-17
8327 select * from t44 order by colint;
8328 colint col1
8329 1 2006-02-03
8330 2 2006-01-17
8331 3 2006-01-25
8332 4 2006-02-05
8333 select * from t55 order by colint;
8334 colint col1
8335 1 2006-02-03
8336 2 2006-01-17
8337 3 2006-01-25
8338 4 2006-02-05
8339 select * from t66 order by colint;
8340 colint col1
8341 1 2006-02-03
8342 2 2006-01-17
8343 3 2006-01-25
8344 4 2006-02-05
8345 ---------------------------
8346 ---- some alter table begin
8347 ---------------------------
8348 alter table t11
8349 reorganize partition p0,p1 into
8350 (partition s1 values less than maxvalue);
8351 select * from t11 order by col1;
8352 col1
8353 2006-11-06
8354 2006-12-17
8355 alter table t11
8356 reorganize partition s1 into
8357 (partition p0 values less than (15),
8358 partition p1 values less than maxvalue);
8359 select * from t11 order by col1;
8360 col1
8361 2006-11-06
8362 2006-12-17
8363 alter table t55
8364 partition by list(colint)
8365 subpartition by hash(month(col1)) subpartitions 5
8366 (partition p0 values in (1,2,3,4,5,6,7,8,9,10),
8367 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
8368 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
8369 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
8370 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
8371 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
8372 );
8373 show create table t55;
8374 Table Create Table
8375 t55 CREATE TABLE `t55` (
8376 `colint` int(11) DEFAULT NULL,
8377 `col1` date DEFAULT NULL
8378 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
8379 PARTITION BY LIST (`colint`)
8380 SUBPARTITION BY HASH (month(`col1`))
8381 SUBPARTITIONS 5
8382 (PARTITION `p0` VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB,
8383 PARTITION `p1` VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB,
8384 PARTITION `p2` VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB,
8385 PARTITION `p3` VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB,
8386 PARTITION `p4` VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB,
8387 PARTITION `p5` VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB)
8388 select * from t55 order by colint;
8389 colint col1
8390 1 2006-02-03
8391 2 2006-01-17
8392 3 2006-01-25
8393 4 2006-02-05
8394 alter table t66
8395 reorganize partition p0,p1 into
8396 (partition s1 values less than maxvalue);
8397 select * from t66 order by colint;
8398 colint col1
8399 1 2006-02-03
8400 2 2006-01-17
8401 3 2006-01-25
8402 4 2006-02-05
8403 alter table t66
8404 reorganize partition s1 into
8405 (partition p0 values less than (month('2006-10-14')),
8406 partition p1 values less than maxvalue);
8407 select * from t66 order by colint;
8408 colint col1
8409 1 2006-02-03
8410 2 2006-01-17
8411 3 2006-01-25
8412 4 2006-02-05
8413 alter table t66
8414 reorganize partition p0,p1 into
8415 (partition s1 values less than maxvalue);
8416 select * from t66 order by colint;
8417 colint col1
8418 1 2006-02-03
8419 2 2006-01-17
8420 3 2006-01-25
8421 4 2006-02-05
8422 alter table t66
8423 reorganize partition s1 into
8424 (partition p0 values less than (month('2006-10-14')),
8425 partition p1 values less than maxvalue);
8426 select * from t66 order by colint;
8427 colint col1
8428 1 2006-02-03
8429 2 2006-01-17
8430 3 2006-01-25
8431 4 2006-02-05
8432 -------------------------------------------------------------------------
8433 --- Delete rows and partitions of tables with month(col1)
8434 -------------------------------------------------------------------------
8435 begin;
8436 delete from t1 where col1='2006-12-17';
8437 delete from t2 where col1='2006-12-17';
8438 delete from t3 where col1='2006-12-17';
8439 delete from t4 where col1='2006-12-17';
8440 delete from t5 where col1='2006-12-17';
8441 delete from t6 where col1='2006-12-17';
8442 commit;
8443 select * from t1 order by col1;
8444 col1
8445 2006-11-06
8446 select * from t2 order by col1;
8447 col1
8448 2006-05-25
8449 2006-11-06
8450 select * from t3 order by col1;
8451 col1
8452 2006-05-25
8453 2006-11-06
8454 select * from t4 order by colint;
8455 colint col1
8456 1 2006-02-03
8457 2 2006-01-17
8458 3 2006-01-25
8459 4 2006-02-05
8460 select * from t5 order by colint;
8461 colint col1
8462 1 2006-02-03
8463 2 2006-01-17
8464 3 2006-01-25
8465 4 2006-02-05
8466 begin;
8467 insert into t1 values ('2006-12-17');
8468 insert into t2 values ('2006-12-17');
8469 insert into t3 values ('2006-12-17');
8470 insert into t4 values (60,'2006-12-17');
8471 insert into t5 values (60,'2006-12-17');
8472 insert into t6 values (60,'2006-12-17');
8473 commit;
8474 select * from t1 order by col1;
8475 col1
8476 2006-11-06
8477 2006-12-17
8478 select * from t2 order by col1;
8479 col1
8480 2006-05-25
8481 2006-11-06
8482 2006-12-17
8483 select * from t3 order by col1;
8484 col1
8485 2006-05-25
8486 2006-11-06
8487 2006-12-17
8488 select * from t4 order by colint;
8489 colint col1
8490 1 2006-02-03
8491 2 2006-01-17
8492 3 2006-01-25
8493 4 2006-02-05
8494 60 2006-12-17
8495 select * from t5 order by colint;
8496 colint col1
8497 1 2006-02-03
8498 2 2006-01-17
8499 3 2006-01-25
8500 4 2006-02-05
8501 60 2006-12-17
8502 select * from t6 order by colint;
8503 colint col1
8504 1 2006-02-03
8505 2 2006-01-17
8506 3 2006-01-25
8507 4 2006-02-05
8508 60 2006-12-17
8509 alter table t1 drop partition p0;
8510 alter table t2 drop partition p0;
8511 alter table t4 drop partition p0;
8512 alter table t5 drop partition p0;
8513 alter table t6 drop partition p0;
8514 select * from t1 order by col1;
8515 col1
8516 select * from t2 order by col1;
8517 col1
8518 2006-11-06
8519 2006-12-17
8520 select * from t3 order by col1;
8521 col1
8522 2006-05-25
8523 2006-11-06
8524 2006-12-17
8525 select * from t4 order by colint;
8526 colint col1
8527 60 2006-12-17
8528 select * from t5 order by colint;
8529 colint col1
8530 60 2006-12-17
8531 select * from t6 order by colint;
8532 colint col1
8533 60 2006-12-17
8534 -------------------------------------------------------------------------
8535 --- Delete rows and partitions of tables with month(col1)
8536 -------------------------------------------------------------------------
8537 begin;
8538 delete from t11 where col1='2006-12-17';
8539 delete from t22 where col1='2006-12-17';
8540 delete from t33 where col1='2006-12-17';
8541 delete from t44 where col1='2006-12-17';
8542 delete from t55 where col1='2006-12-17';
8543 delete from t66 where col1='2006-12-17';
8544 commit;
8545 select * from t11 order by col1;
8546 col1
8547 2006-11-06
8548 select * from t22 order by col1;
8549 col1
8550 2006-05-25
8551 2006-11-06
8552 select * from t33 order by col1;
8553 col1
8554 2006-05-25
8555 2006-11-06
8556 select * from t44 order by colint;
8557 colint col1
8558 1 2006-02-03
8559 2 2006-01-17
8560 3 2006-01-25
8561 4 2006-02-05
8562 select * from t55 order by colint;
8563 colint col1
8564 1 2006-02-03
8565 2 2006-01-17
8566 3 2006-01-25
8567 4 2006-02-05
8568 begin;
8569 insert into t11 values ('2006-12-17');
8570 insert into t22 values ('2006-12-17');
8571 insert into t33 values ('2006-12-17');
8572 insert into t44 values (60,'2006-12-17');
8573 insert into t55 values (60,'2006-12-17');
8574 insert into t66 values (60,'2006-12-17');
8575 commit;
8576 select * from t11 order by col1;
8577 col1
8578 2006-11-06
8579 2006-12-17
8580 select * from t22 order by col1;
8581 col1
8582 2006-05-25
8583 2006-11-06
8584 2006-12-17
8585 select * from t33 order by col1;
8586 col1
8587 2006-05-25
8588 2006-11-06
8589 2006-12-17
8590 select * from t44 order by colint;
8591 colint col1
8592 1 2006-02-03
8593 2 2006-01-17
8594 3 2006-01-25
8595 4 2006-02-05
8596 60 2006-12-17
8597 select * from t55 order by colint;
8598 colint col1
8599 1 2006-02-03
8600 2 2006-01-17
8601 3 2006-01-25
8602 4 2006-02-05
8603 60 2006-12-17
8604 select * from t66 order by colint;
8605 colint col1
8606 1 2006-02-03
8607 2 2006-01-17
8608 3 2006-01-25
8609 4 2006-02-05
8610 60 2006-12-17
8611 alter table t11 drop partition p0;
8612 alter table t22 drop partition p0;
8613 alter table t44 drop partition p0;
8614 alter table t55 drop partition p0;
8615 alter table t66 drop partition p0;
8616 select * from t11 order by col1;
8617 col1
8618 select * from t22 order by col1;
8619 col1
8620 2006-11-06
8621 2006-12-17
8622 select * from t33 order by col1;
8623 col1
8624 2006-05-25
8625 2006-11-06
8626 2006-12-17
8627 select * from t44 order by colint;
8628 colint col1
8629 60 2006-12-17
8630 select * from t55 order by colint;
8631 colint col1
8632 60 2006-12-17
8633 select * from t66 order by colint;
8634 colint col1
8635 60 2006-12-17
8636 -------------------------
8637 ---- some alter table end
8638 -------------------------
8639 drop table if exists t1 ;
8640 drop table if exists t2 ;
8641 drop table if exists t3 ;
8642 drop table if exists t4 ;
8643 drop table if exists t5 ;
8644 drop table if exists t6 ;
8645 drop table if exists t11 ;
8646 drop table if exists t22 ;
8647 drop table if exists t33 ;
8648 drop table if exists t44 ;
8649 drop table if exists t55 ;
8650 drop table if exists t66 ;
8651 -------------------------------------------------------------------------
8652 --- quarter(col1) in partition with coltype date
8653 -------------------------------------------------------------------------
8654 drop table if exists t1 ;
8655 drop table if exists t2 ;
8656 drop table if exists t3 ;
8657 drop table if exists t4 ;
8658 drop table if exists t5 ;
8659 drop table if exists t6 ;
8660 -------------------------------------------------------------------------
8661 --- Create tables with quarter(col1)
8662 -------------------------------------------------------------------------
8663 create table t1 (col1 date) engine='INNODB'
8664 partition by range(quarter(col1))
8665 (partition p0 values less than (15),
8666 partition p1 values less than maxvalue);
8667 create table t2 (col1 date) engine='INNODB'
8668 partition by list(quarter(col1))
8669 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
8670 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
8671 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
8672 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
8673 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
8674 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
8675 );
8676 create table t3 (col1 date) engine='INNODB'
8677 partition by hash(quarter(col1));
8678 create table t4 (colint int, col1 date) engine='INNODB'
8679 partition by range(colint)
8680 subpartition by hash(quarter(col1)) subpartitions 2
8681 (partition p0 values less than (15),
8682 partition p1 values less than maxvalue);
8683 create table t5 (colint int, col1 date) engine='INNODB'
8684 partition by list(colint)
8685 subpartition by hash(quarter(col1)) subpartitions 2
8686 (partition p0 values in (1,2,3,4,5,6,7,8,9,10),
8687 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
8688 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
8689 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
8690 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
8691 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
8692 );
8693 create table t6 (colint int, col1 date) engine='INNODB'
8694 partition by range(colint)
8695 (partition p0 values less than (quarter('2006-10-14')),
8696 partition p1 values less than maxvalue);
8697 -------------------------------------------------------------------------
8698 --- Access tables with quarter(col1)
8699 -------------------------------------------------------------------------
8700 begin;
8701 insert into t1 values ('2006-01-03');
8702 insert into t1 values ('2006-12-17');
8703 insert into t2 values ('2006-01-03');
8704 insert into t2 values ('2006-12-17');
8705 insert into t2 values ('2006-09-25');
8706 insert into t3 values ('2006-01-03');
8707 insert into t3 values ('2006-12-17');
8708 insert into t3 values ('2006-09-25');
8709 commit;
8710 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4;
8711 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5;
8712 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6;
8713 select quarter(col1) from t1 order by col1;
8714 quarter(col1)
8715 1
8716 4
8717 select * from t1 order by col1;
8718 col1
8719 2006-01-03
8720 2006-12-17
8721 select * from t2 order by col1;
8722 col1
8723 2006-01-03
8724 2006-09-25
8725 2006-12-17
8726 select * from t3 order by col1;
8727 col1
8728 2006-01-03
8729 2006-09-25
8730 2006-12-17
8731 select * from t4 order by colint;
8732 colint col1
8733 1 2006-02-03
8734 2 2006-01-17
8735 3 2006-01-25
8736 4 2006-02-05
8737 select * from t5 order by colint;
8738 colint col1
8739 1 2006-02-03
8740 2 2006-01-17
8741 3 2006-01-25
8742 4 2006-02-05
8743 select * from t6 order by colint;
8744 colint col1
8745 1 2006-02-03
8746 2 2006-01-17
8747 3 2006-01-25
8748 4 2006-02-05
8749 begin;
8750 update t1 set col1='2006-07-30' where col1='2006-01-03';
8751 update t2 set col1='2006-07-30' where col1='2006-01-03';
8752 update t3 set col1='2006-07-30' where col1='2006-01-03';
8753 update t4 set col1='2006-07-30' where col1='2006-01-03';
8754 update t5 set col1='2006-07-30' where col1='2006-01-03';
8755 update t6 set col1='2006-07-30' where col1='2006-01-03';
8756 commit;
8757 select * from t1 order by col1;
8758 col1
8759 2006-07-30
8760 2006-12-17
8761 select * from t2 order by col1;
8762 col1
8763 2006-07-30
8764 2006-09-25
8765 2006-12-17
8766 select * from t3 order by col1;
8767 col1
8768 2006-07-30
8769 2006-09-25
8770 2006-12-17
8771 select * from t4 order by colint;
8772 colint col1
8773 1 2006-02-03
8774 2 2006-01-17
8775 3 2006-01-25
8776 4 2006-02-05
8777 select * from t5 order by colint;
8778 colint col1
8779 1 2006-02-03
8780 2 2006-01-17
8781 3 2006-01-25
8782 4 2006-02-05
8783 select * from t6 order by colint;
8784 colint col1
8785 1 2006-02-03
8786 2 2006-01-17
8787 3 2006-01-25
8788 4 2006-02-05
8789 -------------------------------------------------------------------------
8790 --- Alter tables with quarter(col1)
8791 -------------------------------------------------------------------------
8792 drop table if exists t11 ;
8793 drop table if exists t22 ;
8794 drop table if exists t33 ;
8795 drop table if exists t44 ;
8796 drop table if exists t55 ;
8797 drop table if exists t66 ;
8798 create table t11 engine='INNODB' as select * from t1;
8799 create table t22 engine='INNODB' as select * from t2;
8800 create table t33 engine='INNODB' as select * from t3;
8801 create table t44 engine='INNODB' as select * from t4;
8802 create table t55 engine='INNODB' as select * from t5;
8803 create table t66 engine='INNODB' as select * from t6;
8804 alter table t11
8805 partition by range(quarter(col1))
8806 (partition p0 values less than (15),
8807 partition p1 values less than maxvalue);
8808 alter table t22
8809 partition by list(quarter(col1))
8810 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
8811 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
8812 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
8813 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
8814 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
8815 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
8816 );
8817 alter table t33
8818 partition by hash(quarter(col1));
8819 alter table t44
8820 partition by range(colint)
8821 subpartition by hash(quarter(col1)) subpartitions 2
8822 (partition p0 values less than (15),
8823 partition p1 values less than maxvalue);
8824 alter table t55
8825 partition by list(colint)
8826 subpartition by hash(quarter(col1)) subpartitions 2
8827 (partition p0 values in (1,2,3,4,5,6,7,8,9,10),
8828 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
8829 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
8830 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
8831 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
8832 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
8833 );
8834 alter table t66
8835 partition by range(colint)
8836 (partition p0 values less than (quarter('2006-10-14')),
8837 partition p1 values less than maxvalue);
8838 select * from t11 order by col1;
8839 col1
8840 2006-07-30
8841 2006-12-17
8842 select * from t22 order by col1;
8843 col1
8844 2006-07-30
8845 2006-09-25
8846 2006-12-17
8847 select * from t33 order by col1;
8848 col1
8849 2006-07-30
8850 2006-09-25
8851 2006-12-17
8852 select * from t44 order by colint;
8853 colint col1
8854 1 2006-02-03
8855 2 2006-01-17
8856 3 2006-01-25
8857 4 2006-02-05
8858 select * from t55 order by colint;
8859 colint col1
8860 1 2006-02-03
8861 2 2006-01-17
8862 3 2006-01-25
8863 4 2006-02-05
8864 select * from t66 order by colint;
8865 colint col1
8866 1 2006-02-03
8867 2 2006-01-17
8868 3 2006-01-25
8869 4 2006-02-05
8870 ---------------------------
8871 ---- some alter table begin
8872 ---------------------------
8873 alter table t11
8874 reorganize partition p0,p1 into
8875 (partition s1 values less than maxvalue);
8876 select * from t11 order by col1;
8877 col1
8878 2006-07-30
8879 2006-12-17
8880 alter table t11
8881 reorganize partition s1 into
8882 (partition p0 values less than (15),
8883 partition p1 values less than maxvalue);
8884 select * from t11 order by col1;
8885 col1
8886 2006-07-30
8887 2006-12-17
8888 alter table t55
8889 partition by list(colint)
8890 subpartition by hash(quarter(col1)) subpartitions 5
8891 (partition p0 values in (1,2,3,4,5,6,7,8,9,10),
8892 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
8893 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
8894 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
8895 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
8896 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
8897 );
8898 show create table t55;
8899 Table Create Table
8900 t55 CREATE TABLE `t55` (
8901 `colint` int(11) DEFAULT NULL,
8902 `col1` date DEFAULT NULL
8903 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
8904 PARTITION BY LIST (`colint`)
8905 SUBPARTITION BY HASH (quarter(`col1`))
8906 SUBPARTITIONS 5
8907 (PARTITION `p0` VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB,
8908 PARTITION `p1` VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB,
8909 PARTITION `p2` VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB,
8910 PARTITION `p3` VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB,
8911 PARTITION `p4` VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB,
8912 PARTITION `p5` VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB)
8913 select * from t55 order by colint;
8914 colint col1
8915 1 2006-02-03
8916 2 2006-01-17
8917 3 2006-01-25
8918 4 2006-02-05
8919 alter table t66
8920 reorganize partition p0,p1 into
8921 (partition s1 values less than maxvalue);
8922 select * from t66 order by colint;
8923 colint col1
8924 1 2006-02-03
8925 2 2006-01-17
8926 3 2006-01-25
8927 4 2006-02-05
8928 alter table t66
8929 reorganize partition s1 into
8930 (partition p0 values less than (quarter('2006-10-14')),
8931 partition p1 values less than maxvalue);
8932 select * from t66 order by colint;
8933 colint col1
8934 1 2006-02-03
8935 2 2006-01-17
8936 3 2006-01-25
8937 4 2006-02-05
8938 alter table t66
8939 reorganize partition p0,p1 into
8940 (partition s1 values less than maxvalue);
8941 select * from t66 order by colint;
8942 colint col1
8943 1 2006-02-03
8944 2 2006-01-17
8945 3 2006-01-25
8946 4 2006-02-05
8947 alter table t66
8948 reorganize partition s1 into
8949 (partition p0 values less than (quarter('2006-10-14')),
8950 partition p1 values less than maxvalue);
8951 select * from t66 order by colint;
8952 colint col1
8953 1 2006-02-03
8954 2 2006-01-17
8955 3 2006-01-25
8956 4 2006-02-05
8957 -------------------------------------------------------------------------
8958 --- Delete rows and partitions of tables with quarter(col1)
8959 -------------------------------------------------------------------------
8960 begin;
8961 delete from t1 where col1='2006-12-17';
8962 delete from t2 where col1='2006-12-17';
8963 delete from t3 where col1='2006-12-17';
8964 delete from t4 where col1='2006-12-17';
8965 delete from t5 where col1='2006-12-17';
8966 delete from t6 where col1='2006-12-17';
8967 commit;
8968 select * from t1 order by col1;
8969 col1
8970 2006-07-30
8971 select * from t2 order by col1;
8972 col1
8973 2006-07-30
8974 2006-09-25
8975 select * from t3 order by col1;
8976 col1
8977 2006-07-30
8978 2006-09-25
8979 select * from t4 order by colint;
8980 colint col1
8981 1 2006-02-03
8982 2 2006-01-17
8983 3 2006-01-25
8984 4 2006-02-05
8985 select * from t5 order by colint;
8986 colint col1
8987 1 2006-02-03
8988 2 2006-01-17
8989 3 2006-01-25
8990 4 2006-02-05
8991 begin;
8992 insert into t1 values ('2006-12-17');
8993 insert into t2 values ('2006-12-17');
8994 insert into t3 values ('2006-12-17');
8995 insert into t4 values (60,'2006-12-17');
8996 insert into t5 values (60,'2006-12-17');
8997 insert into t6 values (60,'2006-12-17');
8998 commit;
8999 select * from t1 order by col1;
9000 col1
9001 2006-07-30
9002 2006-12-17
9003 select * from t2 order by col1;
9004 col1
9005 2006-07-30
9006 2006-09-25
9007 2006-12-17
9008 select * from t3 order by col1;
9009 col1
9010 2006-07-30
9011 2006-09-25
9012 2006-12-17
9013 select * from t4 order by colint;
9014 colint col1
9015 1 2006-02-03
9016 2 2006-01-17
9017 3 2006-01-25
9018 4 2006-02-05
9019 60 2006-12-17
9020 select * from t5 order by colint;
9021 colint col1
9022 1 2006-02-03
9023 2 2006-01-17
9024 3 2006-01-25
9025 4 2006-02-05
9026 60 2006-12-17
9027 select * from t6 order by colint;
9028 colint col1
9029 1 2006-02-03
9030 2 2006-01-17
9031 3 2006-01-25
9032 4 2006-02-05
9033 60 2006-12-17
9034 alter table t1 drop partition p0;
9035 alter table t2 drop partition p0;
9036 alter table t4 drop partition p0;
9037 alter table t5 drop partition p0;
9038 alter table t6 drop partition p0;
9039 select * from t1 order by col1;
9040 col1
9041 select * from t2 order by col1;
9042 col1
9043 select * from t3 order by col1;
9044 col1
9045 2006-07-30
9046 2006-09-25
9047 2006-12-17
9048 select * from t4 order by colint;
9049 colint col1
9050 60 2006-12-17
9051 select * from t5 order by colint;
9052 colint col1
9053 60 2006-12-17
9054 select * from t6 order by colint;
9055 colint col1
9056 4 2006-02-05
9057 60 2006-12-17
9058 -------------------------------------------------------------------------
9059 --- Delete rows and partitions of tables with quarter(col1)
9060 -------------------------------------------------------------------------
9061 begin;
9062 delete from t11 where col1='2006-12-17';
9063 delete from t22 where col1='2006-12-17';
9064 delete from t33 where col1='2006-12-17';
9065 delete from t44 where col1='2006-12-17';
9066 delete from t55 where col1='2006-12-17';
9067 delete from t66 where col1='2006-12-17';
9068 commit;
9069 select * from t11 order by col1;
9070 col1
9071 2006-07-30
9072 select * from t22 order by col1;
9073 col1
9074 2006-07-30
9075 2006-09-25
9076 select * from t33 order by col1;
9077 col1
9078 2006-07-30
9079 2006-09-25
9080 select * from t44 order by colint;
9081 colint col1
9082 1 2006-02-03
9083 2 2006-01-17
9084 3 2006-01-25
9085 4 2006-02-05
9086 select * from t55 order by colint;
9087 colint col1
9088 1 2006-02-03
9089 2 2006-01-17
9090 3 2006-01-25
9091 4 2006-02-05
9092 begin;
9093 insert into t11 values ('2006-12-17');
9094 insert into t22 values ('2006-12-17');
9095 insert into t33 values ('2006-12-17');
9096 insert into t44 values (60,'2006-12-17');
9097 insert into t55 values (60,'2006-12-17');
9098 insert into t66 values (60,'2006-12-17');
9099 commit;
9100 select * from t11 order by col1;
9101 col1
9102 2006-07-30
9103 2006-12-17
9104 select * from t22 order by col1;
9105 col1
9106 2006-07-30
9107 2006-09-25
9108 2006-12-17
9109 select * from t33 order by col1;
9110 col1
9111 2006-07-30
9112 2006-09-25
9113 2006-12-17
9114 select * from t44 order by colint;
9115 colint col1
9116 1 2006-02-03
9117 2 2006-01-17
9118 3 2006-01-25
9119 4 2006-02-05
9120 60 2006-12-17
9121 select * from t55 order by colint;
9122 colint col1
9123 1 2006-02-03
9124 2 2006-01-17
9125 3 2006-01-25
9126 4 2006-02-05
9127 60 2006-12-17
9128 select * from t66 order by colint;
9129 colint col1
9130 1 2006-02-03
9131 2 2006-01-17
9132 3 2006-01-25
9133 4 2006-02-05
9134 60 2006-12-17
9135 alter table t11 drop partition p0;
9136 alter table t22 drop partition p0;
9137 alter table t44 drop partition p0;
9138 alter table t55 drop partition p0;
9139 alter table t66 drop partition p0;
9140 select * from t11 order by col1;
9141 col1
9142 select * from t22 order by col1;
9143 col1
9144 select * from t33 order by col1;
9145 col1
9146 2006-07-30
9147 2006-09-25
9148 2006-12-17
9149 select * from t44 order by colint;
9150 colint col1
9151 60 2006-12-17
9152 select * from t55 order by colint;
9153 colint col1
9154 60 2006-12-17
9155 select * from t66 order by colint;
9156 colint col1
9157 4 2006-02-05
9158 60 2006-12-17
9159 -------------------------
9160 ---- some alter table end
9161 -------------------------
9162 drop table if exists t1 ;
9163 drop table if exists t2 ;
9164 drop table if exists t3 ;
9165 drop table if exists t4 ;
9166 drop table if exists t5 ;
9167 drop table if exists t6 ;
9168 drop table if exists t11 ;
9169 drop table if exists t22 ;
9170 drop table if exists t33 ;
9171 drop table if exists t44 ;
9172 drop table if exists t55 ;
9173 drop table if exists t66 ;
9174 -------------------------------------------------------------------------
9175 --- weekday(col1) in partition with coltype date
9176 -------------------------------------------------------------------------
9177 drop table if exists t1 ;
9178 drop table if exists t2 ;
9179 drop table if exists t3 ;
9180 drop table if exists t4 ;
9181 drop table if exists t5 ;
9182 drop table if exists t6 ;
9183 -------------------------------------------------------------------------
9184 --- Create tables with weekday(col1)
9185 -------------------------------------------------------------------------
9186 create table t1 (col1 date) engine='INNODB'
9187 partition by range(weekday(col1))
9188 (partition p0 values less than (15),
9189 partition p1 values less than maxvalue);
9190 create table t2 (col1 date) engine='INNODB'
9191 partition by list(weekday(col1))
9192 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
9193 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
9194 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
9195 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
9196 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
9197 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
9198 );
9199 create table t3 (col1 date) engine='INNODB'
9200 partition by hash(weekday(col1));
9201 create table t4 (colint int, col1 date) engine='INNODB'
9202 partition by range(colint)
9203 subpartition by hash(weekday(col1)) subpartitions 2
9204 (partition p0 values less than (15),
9205 partition p1 values less than maxvalue);
9206 create table t5 (colint int, col1 date) engine='INNODB'
9207 partition by list(colint)
9208 subpartition by hash(weekday(col1)) subpartitions 2
9209 (partition p0 values in (1,2,3,4,5,6,7,8,9,10),
9210 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
9211 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
9212 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
9213 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
9214 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
9215 );
9216 create table t6 (colint int, col1 date) engine='INNODB'
9217 partition by range(colint)
9218 (partition p0 values less than (weekday('2006-10-14')),
9219 partition p1 values less than maxvalue);
9220 -------------------------------------------------------------------------
9221 --- Access tables with weekday(col1)
9222 -------------------------------------------------------------------------
9223 begin;
9224 insert into t1 values ('2006-12-03');
9225 insert into t1 values ('2006-11-17');
9226 insert into t2 values ('2006-12-03');
9227 insert into t2 values ('2006-11-17');
9228 insert into t2 values ('2006-05-25');
9229 insert into t3 values ('2006-12-03');
9230 insert into t3 values ('2006-11-17');
9231 insert into t3 values ('2006-05-25');
9232 commit;
9233 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4;
9234 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5;
9235 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6;
9236 select weekday(col1) from t1 order by col1;
9237 weekday(col1)
9238 4
9239 6
9240 select * from t1 order by col1;
9241 col1
9242 2006-11-17
9243 2006-12-03
9244 select * from t2 order by col1;
9245 col1
9246 2006-05-25
9247 2006-11-17
9248 2006-12-03
9249 select * from t3 order by col1;
9250 col1
9251 2006-05-25
9252 2006-11-17
9253 2006-12-03
9254 select * from t4 order by colint;
9255 colint col1
9256 1 2006-02-03
9257 2 2006-01-17
9258 3 2006-01-25
9259 4 2006-02-05
9260 select * from t5 order by colint;
9261 colint col1
9262 1 2006-02-03
9263 2 2006-01-17
9264 3 2006-01-25
9265 4 2006-02-05
9266 select * from t6 order by colint;
9267 colint col1
9268 1 2006-02-03
9269 2 2006-01-17
9270 3 2006-01-25
9271 4 2006-02-05
9272 begin;
9273 update t1 set col1='2006-02-06' where col1='2006-12-03';
9274 update t2 set col1='2006-02-06' where col1='2006-12-03';
9275 update t3 set col1='2006-02-06' where col1='2006-12-03';
9276 update t4 set col1='2006-02-06' where col1='2006-12-03';
9277 update t5 set col1='2006-02-06' where col1='2006-12-03';
9278 update t6 set col1='2006-02-06' where col1='2006-12-03';
9279 commit;
9280 select * from t1 order by col1;
9281 col1
9282 2006-02-06
9283 2006-11-17
9284 select * from t2 order by col1;
9285 col1
9286 2006-02-06
9287 2006-05-25
9288 2006-11-17
9289 select * from t3 order by col1;
9290 col1
9291 2006-02-06
9292 2006-05-25
9293 2006-11-17
9294 select * from t4 order by colint;
9295 colint col1
9296 1 2006-02-03
9297 2 2006-01-17
9298 3 2006-01-25
9299 4 2006-02-05
9300 select * from t5 order by colint;
9301 colint col1
9302 1 2006-02-03
9303 2 2006-01-17
9304 3 2006-01-25
9305 4 2006-02-05
9306 select * from t6 order by colint;
9307 colint col1
9308 1 2006-02-03
9309 2 2006-01-17
9310 3 2006-01-25
9311 4 2006-02-05
9312 -------------------------------------------------------------------------
9313 --- Alter tables with weekday(col1)
9314 -------------------------------------------------------------------------
9315 drop table if exists t11 ;
9316 drop table if exists t22 ;
9317 drop table if exists t33 ;
9318 drop table if exists t44 ;
9319 drop table if exists t55 ;
9320 drop table if exists t66 ;
9321 create table t11 engine='INNODB' as select * from t1;
9322 create table t22 engine='INNODB' as select * from t2;
9323 create table t33 engine='INNODB' as select * from t3;
9324 create table t44 engine='INNODB' as select * from t4;
9325 create table t55 engine='INNODB' as select * from t5;
9326 create table t66 engine='INNODB' as select * from t6;
9327 alter table t11
9328 partition by range(weekday(col1))
9329 (partition p0 values less than (15),
9330 partition p1 values less than maxvalue);
9331 alter table t22
9332 partition by list(weekday(col1))
9333 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
9334 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
9335 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
9336 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
9337 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
9338 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
9339 );
9340 alter table t33
9341 partition by hash(weekday(col1));
9342 alter table t44
9343 partition by range(colint)
9344 subpartition by hash(weekday(col1)) subpartitions 2
9345 (partition p0 values less than (15),
9346 partition p1 values less than maxvalue);
9347 alter table t55
9348 partition by list(colint)
9349 subpartition by hash(weekday(col1)) subpartitions 2
9350 (partition p0 values in (1,2,3,4,5,6,7,8,9,10),
9351 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
9352 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
9353 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
9354 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
9355 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
9356 );
9357 alter table t66
9358 partition by range(colint)
9359 (partition p0 values less than (weekday('2006-10-14')),
9360 partition p1 values less than maxvalue);
9361 select * from t11 order by col1;
9362 col1
9363 2006-02-06
9364 2006-11-17
9365 select * from t22 order by col1;
9366 col1
9367 2006-02-06
9368 2006-05-25
9369 2006-11-17
9370 select * from t33 order by col1;
9371 col1
9372 2006-02-06
9373 2006-05-25
9374 2006-11-17
9375 select * from t44 order by colint;
9376 colint col1
9377 1 2006-02-03
9378 2 2006-01-17
9379 3 2006-01-25
9380 4 2006-02-05
9381 select * from t55 order by colint;
9382 colint col1
9383 1 2006-02-03
9384 2 2006-01-17
9385 3 2006-01-25
9386 4 2006-02-05
9387 select * from t66 order by colint;
9388 colint col1
9389 1 2006-02-03
9390 2 2006-01-17
9391 3 2006-01-25
9392 4 2006-02-05
9393 ---------------------------
9394 ---- some alter table begin
9395 ---------------------------
9396 alter table t11
9397 reorganize partition p0,p1 into
9398 (partition s1 values less than maxvalue);
9399 select * from t11 order by col1;
9400 col1
9401 2006-02-06
9402 2006-11-17
9403 alter table t11
9404 reorganize partition s1 into
9405 (partition p0 values less than (15),
9406 partition p1 values less than maxvalue);
9407 select * from t11 order by col1;
9408 col1
9409 2006-02-06
9410 2006-11-17
9411 alter table t55
9412 partition by list(colint)
9413 subpartition by hash(weekday(col1)) subpartitions 5
9414 (partition p0 values in (1,2,3,4,5,6,7,8,9,10),
9415 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
9416 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
9417 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
9418 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
9419 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
9420 );
9421 show create table t55;
9422 Table Create Table
9423 t55 CREATE TABLE `t55` (
9424 `colint` int(11) DEFAULT NULL,
9425 `col1` date DEFAULT NULL
9426 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
9427 PARTITION BY LIST (`colint`)
9428 SUBPARTITION BY HASH (weekday(`col1`))
9429 SUBPARTITIONS 5
9430 (PARTITION `p0` VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB,
9431 PARTITION `p1` VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB,
9432 PARTITION `p2` VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB,
9433 PARTITION `p3` VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB,
9434 PARTITION `p4` VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB,
9435 PARTITION `p5` VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB)
9436 select * from t55 order by colint;
9437 colint col1
9438 1 2006-02-03
9439 2 2006-01-17
9440 3 2006-01-25
9441 4 2006-02-05
9442 alter table t66
9443 reorganize partition p0,p1 into
9444 (partition s1 values less than maxvalue);
9445 select * from t66 order by colint;
9446 colint col1
9447 1 2006-02-03
9448 2 2006-01-17
9449 3 2006-01-25
9450 4 2006-02-05
9451 alter table t66
9452 reorganize partition s1 into
9453 (partition p0 values less than (weekday('2006-10-14')),
9454 partition p1 values less than maxvalue);
9455 select * from t66 order by colint;
9456 colint col1
9457 1 2006-02-03
9458 2 2006-01-17
9459 3 2006-01-25
9460 4 2006-02-05
9461 alter table t66
9462 reorganize partition p0,p1 into
9463 (partition s1 values less than maxvalue);
9464 select * from t66 order by colint;
9465 colint col1
9466 1 2006-02-03
9467 2 2006-01-17
9468 3 2006-01-25
9469 4 2006-02-05
9470 alter table t66
9471 reorganize partition s1 into
9472 (partition p0 values less than (weekday('2006-10-14')),
9473 partition p1 values less than maxvalue);
9474 select * from t66 order by colint;
9475 colint col1
9476 1 2006-02-03
9477 2 2006-01-17
9478 3 2006-01-25
9479 4 2006-02-05
9480 -------------------------------------------------------------------------
9481 --- Delete rows and partitions of tables with weekday(col1)
9482 -------------------------------------------------------------------------
9483 begin;
9484 delete from t1 where col1='2006-11-17';
9485 delete from t2 where col1='2006-11-17';
9486 delete from t3 where col1='2006-11-17';
9487 delete from t4 where col1='2006-11-17';
9488 delete from t5 where col1='2006-11-17';
9489 delete from t6 where col1='2006-11-17';
9490 commit;
9491 select * from t1 order by col1;
9492 col1
9493 2006-02-06
9494 select * from t2 order by col1;
9495 col1
9496 2006-02-06
9497 2006-05-25
9498 select * from t3 order by col1;
9499 col1
9500 2006-02-06
9501 2006-05-25
9502 select * from t4 order by colint;
9503 colint col1
9504 1 2006-02-03
9505 2 2006-01-17
9506 3 2006-01-25
9507 4 2006-02-05
9508 select * from t5 order by colint;
9509 colint col1
9510 1 2006-02-03
9511 2 2006-01-17
9512 3 2006-01-25
9513 4 2006-02-05
9514 begin;
9515 insert into t1 values ('2006-11-17');
9516 insert into t2 values ('2006-11-17');
9517 insert into t3 values ('2006-11-17');
9518 insert into t4 values (60,'2006-11-17');
9519 insert into t5 values (60,'2006-11-17');
9520 insert into t6 values (60,'2006-11-17');
9521 commit;
9522 select * from t1 order by col1;
9523 col1
9524 2006-02-06
9525 2006-11-17
9526 select * from t2 order by col1;
9527 col1
9528 2006-02-06
9529 2006-05-25
9530 2006-11-17
9531 select * from t3 order by col1;
9532 col1
9533 2006-02-06
9534 2006-05-25
9535 2006-11-17
9536 select * from t4 order by colint;
9537 colint col1
9538 1 2006-02-03
9539 2 2006-01-17
9540 3 2006-01-25
9541 4 2006-02-05
9542 60 2006-11-17
9543 select * from t5 order by colint;
9544 colint col1
9545 1 2006-02-03
9546 2 2006-01-17
9547 3 2006-01-25
9548 4 2006-02-05
9549 60 2006-11-17
9550 select * from t6 order by colint;
9551 colint col1
9552 1 2006-02-03
9553 2 2006-01-17
9554 3 2006-01-25
9555 4 2006-02-05
9556 60 2006-11-17
9557 alter table t1 drop partition p0;
9558 alter table t2 drop partition p0;
9559 alter table t4 drop partition p0;
9560 alter table t5 drop partition p0;
9561 alter table t6 drop partition p0;
9562 select * from t1 order by col1;
9563 col1
9564 select * from t2 order by col1;
9565 col1
9566 select * from t3 order by col1;
9567 col1
9568 2006-02-06
9569 2006-05-25
9570 2006-11-17
9571 select * from t4 order by colint;
9572 colint col1
9573 60 2006-11-17
9574 select * from t5 order by colint;
9575 colint col1
9576 60 2006-11-17
9577 select * from t6 order by colint;
9578 colint col1
9579 60 2006-11-17
9580 -------------------------------------------------------------------------
9581 --- Delete rows and partitions of tables with weekday(col1)
9582 -------------------------------------------------------------------------
9583 begin;
9584 delete from t11 where col1='2006-11-17';
9585 delete from t22 where col1='2006-11-17';
9586 delete from t33 where col1='2006-11-17';
9587 delete from t44 where col1='2006-11-17';
9588 delete from t55 where col1='2006-11-17';
9589 delete from t66 where col1='2006-11-17';
9590 commit;
9591 select * from t11 order by col1;
9592 col1
9593 2006-02-06
9594 select * from t22 order by col1;
9595 col1
9596 2006-02-06
9597 2006-05-25
9598 select * from t33 order by col1;
9599 col1
9600 2006-02-06
9601 2006-05-25
9602 select * from t44 order by colint;
9603 colint col1
9604 1 2006-02-03
9605 2 2006-01-17
9606 3 2006-01-25
9607 4 2006-02-05
9608 select * from t55 order by colint;
9609 colint col1
9610 1 2006-02-03
9611 2 2006-01-17
9612 3 2006-01-25
9613 4 2006-02-05
9614 begin;
9615 insert into t11 values ('2006-11-17');
9616 insert into t22 values ('2006-11-17');
9617 insert into t33 values ('2006-11-17');
9618 insert into t44 values (60,'2006-11-17');
9619 insert into t55 values (60,'2006-11-17');
9620 insert into t66 values (60,'2006-11-17');
9621 commit;
9622 select * from t11 order by col1;
9623 col1
9624 2006-02-06
9625 2006-11-17
9626 select * from t22 order by col1;
9627 col1
9628 2006-02-06
9629 2006-05-25
9630 2006-11-17
9631 select * from t33 order by col1;
9632 col1
9633 2006-02-06
9634 2006-05-25
9635 2006-11-17
9636 select * from t44 order by colint;
9637 colint col1
9638 1 2006-02-03
9639 2 2006-01-17
9640 3 2006-01-25
9641 4 2006-02-05
9642 60 2006-11-17
9643 select * from t55 order by colint;
9644 colint col1
9645 1 2006-02-03
9646 2 2006-01-17
9647 3 2006-01-25
9648 4 2006-02-05
9649 60 2006-11-17
9650 select * from t66 order by colint;
9651 colint col1
9652 1 2006-02-03
9653 2 2006-01-17
9654 3 2006-01-25
9655 4 2006-02-05
9656 60 2006-11-17
9657 alter table t11 drop partition p0;
9658 alter table t22 drop partition p0;
9659 alter table t44 drop partition p0;
9660 alter table t55 drop partition p0;
9661 alter table t66 drop partition p0;
9662 select * from t11 order by col1;
9663 col1
9664 select * from t22 order by col1;
9665 col1
9666 select * from t33 order by col1;
9667 col1
9668 2006-02-06
9669 2006-05-25
9670 2006-11-17
9671 select * from t44 order by colint;
9672 colint col1
9673 60 2006-11-17
9674 select * from t55 order by colint;
9675 colint col1
9676 60 2006-11-17
9677 select * from t66 order by colint;
9678 colint col1
9679 60 2006-11-17
9680 -------------------------
9681 ---- some alter table end
9682 -------------------------
9683 drop table if exists t1 ;
9684 drop table if exists t2 ;
9685 drop table if exists t3 ;
9686 drop table if exists t4 ;
9687 drop table if exists t5 ;
9688 drop table if exists t6 ;
9689 drop table if exists t11 ;
9690 drop table if exists t22 ;
9691 drop table if exists t33 ;
9692 drop table if exists t44 ;
9693 drop table if exists t55 ;
9694 drop table if exists t66 ;
9695 -------------------------------------------------------------------------
9696 --- year(col1)-1990 in partition with coltype date
9697 -------------------------------------------------------------------------
9698 drop table if exists t1 ;
9699 drop table if exists t2 ;
9700 drop table if exists t3 ;
9701 drop table if exists t4 ;
9702 drop table if exists t5 ;
9703 drop table if exists t6 ;
9704 -------------------------------------------------------------------------
9705 --- Create tables with year(col1)-1990
9706 -------------------------------------------------------------------------
9707 create table t1 (col1 date) engine='INNODB'
9708 partition by range(year(col1)-1990)
9709 (partition p0 values less than (15),
9710 partition p1 values less than maxvalue);
9711 create table t2 (col1 date) engine='INNODB'
9712 partition by list(year(col1)-1990)
9713 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
9714 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
9715 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
9716 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
9717 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
9718 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
9719 );
9720 create table t3 (col1 date) engine='INNODB'
9721 partition by hash(year(col1)-1990);
9722 create table t4 (colint int, col1 date) engine='INNODB'
9723 partition by range(colint)
9724 subpartition by hash(year(col1)-1990) subpartitions 2
9725 (partition p0 values less than (15),
9726 partition p1 values less than maxvalue);
9727 create table t5 (colint int, col1 date) engine='INNODB'
9728 partition by list(colint)
9729 subpartition by hash(year(col1)-1990) subpartitions 2
9730 (partition p0 values in (1,2,3,4,5,6,7,8,9,10),
9731 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
9732 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
9733 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
9734 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
9735 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
9736 );
9737 create table t6 (colint int, col1 date) engine='INNODB'
9738 partition by range(colint)
9739 (partition p0 values less than (year('2005-10-14')-1990),
9740 partition p1 values less than maxvalue);
9741 -------------------------------------------------------------------------
9742 --- Access tables with year(col1)-1990
9743 -------------------------------------------------------------------------
9744 begin;
9745 insert into t1 values ('1996-01-03');
9746 insert into t1 values ('2000-02-17');
9747 insert into t2 values ('1996-01-03');
9748 insert into t2 values ('2000-02-17');
9749 insert into t2 values ('2004-05-25');
9750 insert into t3 values ('1996-01-03');
9751 insert into t3 values ('2000-02-17');
9752 insert into t3 values ('2004-05-25');
9753 commit;
9754 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4;
9755 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5;
9756 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6;
9757 select year(col1)-1990 from t1 order by col1;
9758 year(col1)-1990
9759 6
9760 10
9761 select * from t1 order by col1;
9762 col1
9763 1996-01-03
9764 2000-02-17
9765 select * from t2 order by col1;
9766 col1
9767 1996-01-03
9768 2000-02-17
9769 2004-05-25
9770 select * from t3 order by col1;
9771 col1
9772 1996-01-03
9773 2000-02-17
9774 2004-05-25
9775 select * from t4 order by colint;
9776 colint col1
9777 1 2006-02-03
9778 2 2006-01-17
9779 3 2006-01-25
9780 4 2006-02-05
9781 select * from t5 order by colint;
9782 colint col1
9783 1 2006-02-03
9784 2 2006-01-17
9785 3 2006-01-25
9786 4 2006-02-05
9787 select * from t6 order by colint;
9788 colint col1
9789 1 2006-02-03
9790 2 2006-01-17
9791 3 2006-01-25
9792 4 2006-02-05
9793 begin;
9794 update t1 set col1='2002-02-15' where col1='1996-01-03';
9795 update t2 set col1='2002-02-15' where col1='1996-01-03';
9796 update t3 set col1='2002-02-15' where col1='1996-01-03';
9797 update t4 set col1='2002-02-15' where col1='1996-01-03';
9798 update t5 set col1='2002-02-15' where col1='1996-01-03';
9799 update t6 set col1='2002-02-15' where col1='1996-01-03';
9800 commit;
9801 select * from t1 order by col1;
9802 col1
9803 2000-02-17
9804 2002-02-15
9805 select * from t2 order by col1;
9806 col1
9807 2000-02-17
9808 2002-02-15
9809 2004-05-25
9810 select * from t3 order by col1;
9811 col1
9812 2000-02-17
9813 2002-02-15
9814 2004-05-25
9815 select * from t4 order by colint;
9816 colint col1
9817 1 2006-02-03
9818 2 2006-01-17
9819 3 2006-01-25
9820 4 2006-02-05
9821 select * from t5 order by colint;
9822 colint col1
9823 1 2006-02-03
9824 2 2006-01-17
9825 3 2006-01-25
9826 4 2006-02-05
9827 select * from t6 order by colint;
9828 colint col1
9829 1 2006-02-03
9830 2 2006-01-17
9831 3 2006-01-25
9832 4 2006-02-05
9833 -------------------------------------------------------------------------
9834 --- Alter tables with year(col1)-1990
9835 -------------------------------------------------------------------------
9836 drop table if exists t11 ;
9837 drop table if exists t22 ;
9838 drop table if exists t33 ;
9839 drop table if exists t44 ;
9840 drop table if exists t55 ;
9841 drop table if exists t66 ;
9842 create table t11 engine='INNODB' as select * from t1;
9843 create table t22 engine='INNODB' as select * from t2;
9844 create table t33 engine='INNODB' as select * from t3;
9845 create table t44 engine='INNODB' as select * from t4;
9846 create table t55 engine='INNODB' as select * from t5;
9847 create table t66 engine='INNODB' as select * from t6;
9848 alter table t11
9849 partition by range(year(col1)-1990)
9850 (partition p0 values less than (15),
9851 partition p1 values less than maxvalue);
9852 alter table t22
9853 partition by list(year(col1)-1990)
9854 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
9855 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
9856 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
9857 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
9858 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
9859 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
9860 );
9861 alter table t33
9862 partition by hash(year(col1)-1990);
9863 alter table t44
9864 partition by range(colint)
9865 subpartition by hash(year(col1)-1990) subpartitions 2
9866 (partition p0 values less than (15),
9867 partition p1 values less than maxvalue);
9868 alter table t55
9869 partition by list(colint)
9870 subpartition by hash(year(col1)-1990) subpartitions 2
9871 (partition p0 values in (1,2,3,4,5,6,7,8,9,10),
9872 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
9873 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
9874 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
9875 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
9876 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
9877 );
9878 alter table t66
9879 partition by range(colint)
9880 (partition p0 values less than (year('2005-10-14')-1990),
9881 partition p1 values less than maxvalue);
9882 select * from t11 order by col1;
9883 col1
9884 2000-02-17
9885 2002-02-15
9886 select * from t22 order by col1;
9887 col1
9888 2000-02-17
9889 2002-02-15
9890 2004-05-25
9891 select * from t33 order by col1;
9892 col1
9893 2000-02-17
9894 2002-02-15
9895 2004-05-25
9896 select * from t44 order by colint;
9897 colint col1
9898 1 2006-02-03
9899 2 2006-01-17
9900 3 2006-01-25
9901 4 2006-02-05
9902 select * from t55 order by colint;
9903 colint col1
9904 1 2006-02-03
9905 2 2006-01-17
9906 3 2006-01-25
9907 4 2006-02-05
9908 select * from t66 order by colint;
9909 colint col1
9910 1 2006-02-03
9911 2 2006-01-17
9912 3 2006-01-25
9913 4 2006-02-05
9914 ---------------------------
9915 ---- some alter table begin
9916 ---------------------------
9917 alter table t11
9918 reorganize partition p0,p1 into
9919 (partition s1 values less than maxvalue);
9920 select * from t11 order by col1;
9921 col1
9922 2000-02-17
9923 2002-02-15
9924 alter table t11
9925 reorganize partition s1 into
9926 (partition p0 values less than (15),
9927 partition p1 values less than maxvalue);
9928 select * from t11 order by col1;
9929 col1
9930 2000-02-17
9931 2002-02-15
9932 alter table t55
9933 partition by list(colint)
9934 subpartition by hash(year(col1)-1990) subpartitions 5
9935 (partition p0 values in (1,2,3,4,5,6,7,8,9,10),
9936 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
9937 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
9938 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
9939 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
9940 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
9941 );
9942 show create table t55;
9943 Table Create Table
9944 t55 CREATE TABLE `t55` (
9945 `colint` int(11) DEFAULT NULL,
9946 `col1` date DEFAULT NULL
9947 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
9948 PARTITION BY LIST (`colint`)
9949 SUBPARTITION BY HASH (year(`col1`) - 1990)
9950 SUBPARTITIONS 5
9951 (PARTITION `p0` VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB,
9952 PARTITION `p1` VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB,
9953 PARTITION `p2` VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB,
9954 PARTITION `p3` VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB,
9955 PARTITION `p4` VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB,
9956 PARTITION `p5` VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB)
9957 select * from t55 order by colint;
9958 colint col1
9959 1 2006-02-03
9960 2 2006-01-17
9961 3 2006-01-25
9962 4 2006-02-05
9963 alter table t66
9964 reorganize partition p0,p1 into
9965 (partition s1 values less than maxvalue);
9966 select * from t66 order by colint;
9967 colint col1
9968 1 2006-02-03
9969 2 2006-01-17
9970 3 2006-01-25
9971 4 2006-02-05
9972 alter table t66
9973 reorganize partition s1 into
9974 (partition p0 values less than (year('2005-10-14')-1990),
9975 partition p1 values less than maxvalue);
9976 select * from t66 order by colint;
9977 colint col1
9978 1 2006-02-03
9979 2 2006-01-17
9980 3 2006-01-25
9981 4 2006-02-05
9982 alter table t66
9983 reorganize partition p0,p1 into
9984 (partition s1 values less than maxvalue);
9985 select * from t66 order by colint;
9986 colint col1
9987 1 2006-02-03
9988 2 2006-01-17
9989 3 2006-01-25
9990 4 2006-02-05
9991 alter table t66
9992 reorganize partition s1 into
9993 (partition p0 values less than (year('2005-10-14')-1990),
9994 partition p1 values less than maxvalue);
9995 select * from t66 order by colint;
9996 colint col1
9997 1 2006-02-03
9998 2 2006-01-17
9999 3 2006-01-25
10000 4 2006-02-05
10001 -------------------------------------------------------------------------
10002 --- Delete rows and partitions of tables with year(col1)-1990
10003 -------------------------------------------------------------------------
10004 begin;
10005 delete from t1 where col1='2000-02-17';
10006 delete from t2 where col1='2000-02-17';
10007 delete from t3 where col1='2000-02-17';
10008 delete from t4 where col1='2000-02-17';
10009 delete from t5 where col1='2000-02-17';
10010 delete from t6 where col1='2000-02-17';
10011 commit;
10012 select * from t1 order by col1;
10013 col1
10014 2002-02-15
10015 select * from t2 order by col1;
10016 col1
10017 2002-02-15
10018 2004-05-25
10019 select * from t3 order by col1;
10020 col1
10021 2002-02-15
10022 2004-05-25
10023 select * from t4 order by colint;
10024 colint col1
10025 1 2006-02-03
10026 2 2006-01-17
10027 3 2006-01-25
10028 4 2006-02-05
10029 select * from t5 order by colint;
10030 colint col1
10031 1 2006-02-03
10032 2 2006-01-17
10033 3 2006-01-25
10034 4 2006-02-05
10035 begin;
10036 insert into t1 values ('2000-02-17');
10037 insert into t2 values ('2000-02-17');
10038 insert into t3 values ('2000-02-17');
10039 insert into t4 values (60,'2000-02-17');
10040 insert into t5 values (60,'2000-02-17');
10041 insert into t6 values (60,'2000-02-17');
10042 commit;
10043 select * from t1 order by col1;
10044 col1
10045 2000-02-17
10046 2002-02-15
10047 select * from t2 order by col1;
10048 col1
10049 2000-02-17
10050 2002-02-15
10051 2004-05-25
10052 select * from t3 order by col1;
10053 col1
10054 2000-02-17
10055 2002-02-15
10056 2004-05-25
10057 select * from t4 order by colint;
10058 colint col1
10059 1 2006-02-03
10060 2 2006-01-17
10061 3 2006-01-25
10062 4 2006-02-05
10063 60 2000-02-17
10064 select * from t5 order by colint;
10065 colint col1
10066 1 2006-02-03
10067 2 2006-01-17
10068 3 2006-01-25
10069 4 2006-02-05
10070 60 2000-02-17
10071 select * from t6 order by colint;
10072 colint col1
10073 1 2006-02-03
10074 2 2006-01-17
10075 3 2006-01-25
10076 4 2006-02-05
10077 60 2000-02-17
10078 alter table t1 drop partition p0;
10079 alter table t2 drop partition p0;
10080 alter table t4 drop partition p0;
10081 alter table t5 drop partition p0;
10082 alter table t6 drop partition p0;
10083 select * from t1 order by col1;
10084 col1
10085 select * from t2 order by col1;
10086 col1
10087 2002-02-15
10088 2004-05-25
10089 select * from t3 order by col1;
10090 col1
10091 2000-02-17
10092 2002-02-15
10093 2004-05-25
10094 select * from t4 order by colint;
10095 colint col1
10096 60 2000-02-17
10097 select * from t5 order by colint;
10098 colint col1
10099 60 2000-02-17
10100 select * from t6 order by colint;
10101 colint col1
10102 60 2000-02-17
10103 -------------------------------------------------------------------------
10104 --- Delete rows and partitions of tables with year(col1)-1990
10105 -------------------------------------------------------------------------
10106 begin;
10107 delete from t11 where col1='2000-02-17';
10108 delete from t22 where col1='2000-02-17';
10109 delete from t33 where col1='2000-02-17';
10110 delete from t44 where col1='2000-02-17';
10111 delete from t55 where col1='2000-02-17';
10112 delete from t66 where col1='2000-02-17';
10113 commit;
10114 select * from t11 order by col1;
10115 col1
10116 2002-02-15
10117 select * from t22 order by col1;
10118 col1
10119 2002-02-15
10120 2004-05-25
10121 select * from t33 order by col1;
10122 col1
10123 2002-02-15
10124 2004-05-25
10125 select * from t44 order by colint;
10126 colint col1
10127 1 2006-02-03
10128 2 2006-01-17
10129 3 2006-01-25
10130 4 2006-02-05
10131 select * from t55 order by colint;
10132 colint col1
10133 1 2006-02-03
10134 2 2006-01-17
10135 3 2006-01-25
10136 4 2006-02-05
10137 begin;
10138 insert into t11 values ('2000-02-17');
10139 insert into t22 values ('2000-02-17');
10140 insert into t33 values ('2000-02-17');
10141 insert into t44 values (60,'2000-02-17');
10142 insert into t55 values (60,'2000-02-17');
10143 insert into t66 values (60,'2000-02-17');
10144 commit;
10145 select * from t11 order by col1;
10146 col1
10147 2000-02-17
10148 2002-02-15
10149 select * from t22 order by col1;
10150 col1
10151 2000-02-17
10152 2002-02-15
10153 2004-05-25
10154 select * from t33 order by col1;
10155 col1
10156 2000-02-17
10157 2002-02-15
10158 2004-05-25
10159 select * from t44 order by colint;
10160 colint col1
10161 1 2006-02-03
10162 2 2006-01-17
10163 3 2006-01-25
10164 4 2006-02-05
10165 60 2000-02-17
10166 select * from t55 order by colint;
10167 colint col1
10168 1 2006-02-03
10169 2 2006-01-17
10170 3 2006-01-25
10171 4 2006-02-05
10172 60 2000-02-17
10173 select * from t66 order by colint;
10174 colint col1
10175 1 2006-02-03
10176 2 2006-01-17
10177 3 2006-01-25
10178 4 2006-02-05
10179 60 2000-02-17
10180 alter table t11 drop partition p0;
10181 alter table t22 drop partition p0;
10182 alter table t44 drop partition p0;
10183 alter table t55 drop partition p0;
10184 alter table t66 drop partition p0;
10185 select * from t11 order by col1;
10186 col1
10187 select * from t22 order by col1;
10188 col1
10189 2002-02-15
10190 2004-05-25
10191 select * from t33 order by col1;
10192 col1
10193 2000-02-17
10194 2002-02-15
10195 2004-05-25
10196 select * from t44 order by colint;
10197 colint col1
10198 60 2000-02-17
10199 select * from t55 order by colint;
10200 colint col1
10201 60 2000-02-17
10202 select * from t66 order by colint;
10203 colint col1
10204 60 2000-02-17
10205 -------------------------
10206 ---- some alter table end
10207 -------------------------
10208 drop table if exists t1 ;
10209 drop table if exists t2 ;
10210 drop table if exists t3 ;
10211 drop table if exists t4 ;
10212 drop table if exists t5 ;
10213 drop table if exists t6 ;
10214 drop table if exists t11 ;
10215 drop table if exists t22 ;
10216 drop table if exists t33 ;
10217 drop table if exists t44 ;
10218 drop table if exists t55 ;
10219 drop table if exists t66 ;
10220 -------------------------------------------------------------------------
10221 --- yearweek(col1)-200600 in partition with coltype date
10222 -------------------------------------------------------------------------
10223 drop table if exists t1 ;
10224 drop table if exists t2 ;
10225 drop table if exists t3 ;
10226 drop table if exists t4 ;
10227 drop table if exists t5 ;
10228 drop table if exists t6 ;
10229 -------------------------------------------------------------------------
10230 --- Create tables with yearweek(col1)-200600
10231 -------------------------------------------------------------------------
10232 create table t1 (col1 date) engine='INNODB'
10233 partition by range(yearweek(col1)-200600)
10234 (partition p0 values less than (15),
10235 partition p1 values less than maxvalue);
10236 create table t2 (col1 date) engine='INNODB'
10237 partition by list(yearweek(col1)-200600)
10238 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
10239 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
10240 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
10241 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
10242 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
10243 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
10244 );
10245 create table t3 (col1 date) engine='INNODB'
10246 partition by hash(yearweek(col1)-200600);
10247 create table t4 (colint int, col1 date) engine='INNODB'
10248 partition by range(colint)
10249 subpartition by hash(yearweek(col1)-200600) subpartitions 2
10250 (partition p0 values less than (15),
10251 partition p1 values less than maxvalue);
10252 create table t5 (colint int, col1 date) engine='INNODB'
10253 partition by list(colint)
10254 subpartition by hash(yearweek(col1)-200600) subpartitions 2
10255 (partition p0 values in (1,2,3,4,5,6,7,8,9,10),
10256 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
10257 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
10258 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
10259 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
10260 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
10261 );
10262 create table t6 (colint int, col1 date) engine='INNODB'
10263 partition by range(colint)
10264 (partition p0 values less than (yearweek('2006-10-14')-200600),
10265 partition p1 values less than maxvalue);
10266 -------------------------------------------------------------------------
10267 --- Access tables with yearweek(col1)-200600
10268 -------------------------------------------------------------------------
10269 begin;
10270 insert into t1 values ('2006-01-03');
10271 insert into t1 values ('2006-08-17');
10272 insert into t2 values ('2006-01-03');
10273 insert into t2 values ('2006-08-17');
10274 insert into t2 values ('2006-03-25');
10275 insert into t3 values ('2006-01-03');
10276 insert into t3 values ('2006-08-17');
10277 insert into t3 values ('2006-03-25');
10278 commit;
10279 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4;
10280 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5;
10281 load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6;
10282 select yearweek(col1)-200600 from t1 order by col1;
10283 yearweek(col1)-200600
10284 1
10285 33
10286 select * from t1 order by col1;
10287 col1
10288 2006-01-03
10289 2006-08-17
10290 select * from t2 order by col1;
10291 col1
10292 2006-01-03
10293 2006-03-25
10294 2006-08-17
10295 select * from t3 order by col1;
10296 col1
10297 2006-01-03
10298 2006-03-25
10299 2006-08-17
10300 select * from t4 order by colint;
10301 colint col1
10302 1 2006-02-03
10303 2 2006-01-17
10304 3 2006-01-25
10305 4 2006-02-05
10306 select * from t5 order by colint;
10307 colint col1
10308 1 2006-02-03
10309 2 2006-01-17
10310 3 2006-01-25
10311 4 2006-02-05
10312 select * from t6 order by colint;
10313 colint col1
10314 1 2006-02-03
10315 2 2006-01-17
10316 3 2006-01-25
10317 4 2006-02-05
10318 begin;
10319 update t1 set col1='2006-11-15' where col1='2006-01-03';
10320 update t2 set col1='2006-11-15' where col1='2006-01-03';
10321 update t3 set col1='2006-11-15' where col1='2006-01-03';
10322 update t4 set col1='2006-11-15' where col1='2006-01-03';
10323 update t5 set col1='2006-11-15' where col1='2006-01-03';
10324 update t6 set col1='2006-11-15' where col1='2006-01-03';
10325 commit;
10326 select * from t1 order by col1;
10327 col1
10328 2006-08-17
10329 2006-11-15
10330 select * from t2 order by col1;
10331 col1
10332 2006-03-25
10333 2006-08-17
10334 2006-11-15
10335 select * from t3 order by col1;
10336 col1
10337 2006-03-25
10338 2006-08-17
10339 2006-11-15
10340 select * from t4 order by colint;
10341 colint col1
10342 1 2006-02-03
10343 2 2006-01-17
10344 3 2006-01-25
10345 4 2006-02-05
10346 select * from t5 order by colint;
10347 colint col1
10348 1 2006-02-03
10349 2 2006-01-17
10350 3 2006-01-25
10351 4 2006-02-05
10352 select * from t6 order by colint;
10353 colint col1
10354 1 2006-02-03
10355 2 2006-01-17
10356 3 2006-01-25
10357 4 2006-02-05
10358 -------------------------------------------------------------------------
10359 --- Alter tables with yearweek(col1)-200600
10360 -------------------------------------------------------------------------
10361 drop table if exists t11 ;
10362 drop table if exists t22 ;
10363 drop table if exists t33 ;
10364 drop table if exists t44 ;
10365 drop table if exists t55 ;
10366 drop table if exists t66 ;
10367 create table t11 engine='INNODB' as select * from t1;
10368 create table t22 engine='INNODB' as select * from t2;
10369 create table t33 engine='INNODB' as select * from t3;
10370 create table t44 engine='INNODB' as select * from t4;
10371 create table t55 engine='INNODB' as select * from t5;
10372 create table t66 engine='INNODB' as select * from t6;
10373 alter table t11
10374 partition by range(yearweek(col1)-200600)
10375 (partition p0 values less than (15),
10376 partition p1 values less than maxvalue);
10377 alter table t22
10378 partition by list(yearweek(col1)-200600)
10379 (partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
10380 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
10381 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
10382 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
10383 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
10384 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
10385 );
10386 alter table t33
10387 partition by hash(yearweek(col1)-200600);
10388 alter table t44
10389 partition by range(colint)
10390 subpartition by hash(yearweek(col1)-200600) subpartitions 2
10391 (partition p0 values less than (15),
10392 partition p1 values less than maxvalue);
10393 alter table t55
10394 partition by list(colint)
10395 subpartition by hash(yearweek(col1)-200600) subpartitions 2
10396 (partition p0 values in (1,2,3,4,5,6,7,8,9,10),
10397 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
10398 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
10399 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
10400 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
10401 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
10402 );
10403 alter table t66
10404 partition by range(colint)
10405 (partition p0 values less than (yearweek('2006-10-14')-200600),
10406 partition p1 values less than maxvalue);
10407 select * from t11 order by col1;
10408 col1
10409 2006-08-17
10410 2006-11-15
10411 select * from t22 order by col1;
10412 col1
10413 2006-03-25
10414 2006-08-17
10415 2006-11-15
10416 select * from t33 order by col1;
10417 col1
10418 2006-03-25
10419 2006-08-17
10420 2006-11-15
10421 select * from t44 order by colint;
10422 colint col1
10423 1 2006-02-03
10424 2 2006-01-17
10425 3 2006-01-25
10426 4 2006-02-05
10427 select * from t55 order by colint;
10428 colint col1
10429 1 2006-02-03
10430 2 2006-01-17
10431 3 2006-01-25
10432 4 2006-02-05
10433 select * from t66 order by colint;
10434 colint col1
10435 1 2006-02-03
10436 2 2006-01-17
10437 3 2006-01-25
10438 4 2006-02-05
10439 ---------------------------
10440 ---- some alter table begin
10441 ---------------------------
10442 alter table t11
10443 reorganize partition p0,p1 into
10444 (partition s1 values less than maxvalue);
10445 select * from t11 order by col1;
10446 col1
10447 2006-08-17
10448 2006-11-15
10449 alter table t11
10450 reorganize partition s1 into
10451 (partition p0 values less than (15),
10452 partition p1 values less than maxvalue);
10453 select * from t11 order by col1;
10454 col1
10455 2006-08-17
10456 2006-11-15
10457 alter table t55
10458 partition by list(colint)
10459 subpartition by hash(yearweek(col1)-200600) subpartitions 5
10460 (partition p0 values in (1,2,3,4,5,6,7,8,9,10),
10461 partition p1 values in (11,12,13,14,15,16,17,18,19,20),
10462 partition p2 values in (21,22,23,24,25,26,27,28,29,30),
10463 partition p3 values in (31,32,33,34,35,36,37,38,39,40),
10464 partition p4 values in (41,42,43,44,45,46,47,48,49,50),
10465 partition p5 values in (51,52,53,54,55,56,57,58,59,60)
10466 );
10467 show create table t55;
10468 Table Create Table
10469 t55 CREATE TABLE `t55` (
10470 `colint` int(11) DEFAULT NULL,
10471 `col1` date DEFAULT NULL
10472 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
10473 PARTITION BY LIST (`colint`)
10474 SUBPARTITION BY HASH (yearweek(`col1`,0) - 200600)
10475 SUBPARTITIONS 5
10476 (PARTITION `p0` VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB,
10477 PARTITION `p1` VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB,
10478 PARTITION `p2` VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB,
10479 PARTITION `p3` VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB,
10480 PARTITION `p4` VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB,
10481 PARTITION `p5` VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB)
10482 select * from t55 order by colint;
10483 colint col1
10484 1 2006-02-03
10485 2 2006-01-17
10486 3 2006-01-25
10487 4 2006-02-05
10488 alter table t66
10489 reorganize partition p0,p1 into
10490 (partition s1 values less than maxvalue);
10491 select * from t66 order by colint;
10492 colint col1
10493 1 2006-02-03
10494 2 2006-01-17
10495 3 2006-01-25
10496 4 2006-02-05
10497 alter table t66
10498 reorganize partition s1 into
10499 (partition p0 values less than (yearweek('2006-10-14')-200600),
10500 partition p1 values less than maxvalue);
10501 select * from t66 order by colint;
10502 colint col1
10503 1 2006-02-03
10504 2 2006-01-17
10505 3 2006-01-25
10506 4 2006-02-05
10507 alter table t66
10508 reorganize partition p0,p1 into
10509 (partition s1 values less than maxvalue);
10510 select * from t66 order by colint;
10511 colint col1
10512 1 2006-02-03
10513 2 2006-01-17
10514 3 2006-01-25
10515 4 2006-02-05
10516 alter table t66
10517 reorganize partition s1 into
10518 (partition p0 values less than (yearweek('2006-10-14')-200600),
10519 partition p1 values less than maxvalue);
10520 select * from t66 order by colint;
10521 colint col1
10522 1 2006-02-03
10523 2 2006-01-17
10524 3 2006-01-25
10525 4 2006-02-05
10526 -------------------------------------------------------------------------
10527 --- Delete rows and partitions of tables with yearweek(col1)-200600
10528 -------------------------------------------------------------------------
10529 begin;
10530 delete from t1 where col1='2006-08-17';
10531 delete from t2 where col1='2006-08-17';
10532 delete from t3 where col1='2006-08-17';
10533 delete from t4 where col1='2006-08-17';
10534 delete from t5 where col1='2006-08-17';
10535 delete from t6 where col1='2006-08-17';
10536 commit;
10537 select * from t1 order by col1;
10538 col1
10539 2006-11-15
10540 select * from t2 order by col1;
10541 col1
10542 2006-03-25
10543 2006-11-15
10544 select * from t3 order by col1;
10545 col1
10546 2006-03-25
10547 2006-11-15
10548 select * from t4 order by colint;
10549 colint col1
10550 1 2006-02-03
10551 2 2006-01-17
10552 3 2006-01-25
10553 4 2006-02-05
10554 select * from t5 order by colint;
10555 colint col1
10556 1 2006-02-03
10557 2 2006-01-17
10558 3 2006-01-25
10559 4 2006-02-05
10560 begin;
10561 insert into t1 values ('2006-08-17');
10562 insert into t2 values ('2006-08-17');
10563 insert into t3 values ('2006-08-17');
10564 insert into t4 values (60,'2006-08-17');
10565 insert into t5 values (60,'2006-08-17');
10566 insert into t6 values (60,'2006-08-17');
10567 commit;
10568 select * from t1 order by col1;
10569 col1
10570 2006-08-17
10571 2006-11-15
10572 select * from t2 order by col1;
10573 col1
10574 2006-03-25
10575 2006-08-17
10576 2006-11-15
10577 select * from t3 order by col1;
10578 col1
10579 2006-03-25
10580 2006-08-17
10581 2006-11-15
10582 select * from t4 order by colint;
10583 colint col1
10584 1 2006-02-03
10585 2 2006-01-17
10586 3 2006-01-25
10587 4 2006-02-05
10588 60 2006-08-17
10589 select * from t5 order by colint;
10590 colint col1
10591 1 2006-02-03
10592 2 2006-01-17
10593 3 2006-01-25
10594 4 2006-02-05
10595 60 2006-08-17
10596 select * from t6 order by colint;
10597 colint col1
10598 1 2006-02-03
10599 2 2006-01-17
10600 3 2006-01-25
10601 4 2006-02-05
10602 60 2006-08-17
10603 alter table t1 drop partition p0;
10604 alter table t2 drop partition p0;
10605 alter table t4 drop partition p0;
10606 alter table t5 drop partition p0;
10607 alter table t6 drop partition p0;
10608 select * from t1 order by col1;
10609 col1
10610 2006-08-17
10611 2006-11-15
10612 select * from t2 order by col1;
10613 col1
10614 2006-03-25
10615 2006-08-17
10616 2006-11-15
10617 select * from t3 order by col1;
10618 col1
10619 2006-03-25
10620 2006-08-17
10621 2006-11-15
10622 select * from t4 order by colint;
10623 colint col1
10624 60 2006-08-17
10625 select * from t5 order by colint;
10626 colint col1
10627 60 2006-08-17
10628 select * from t6 order by colint;
10629 colint col1
10630 60 2006-08-17
10631 -------------------------------------------------------------------------
10632 --- Delete rows and partitions of tables with yearweek(col1)-200600
10633 -------------------------------------------------------------------------
10634 begin;
10635 delete from t11 where col1='2006-08-17';
10636 delete from t22 where col1='2006-08-17';
10637 delete from t33 where col1='2006-08-17';
10638 delete from t44 where col1='2006-08-17';
10639 delete from t55 where col1='2006-08-17';
10640 delete from t66 where col1='2006-08-17';
10641 commit;
10642 select * from t11 order by col1;
10643 col1
10644 2006-11-15
10645 select * from t22 order by col1;
10646 col1
10647 2006-03-25
10648 2006-11-15
10649 select * from t33 order by col1;
10650 col1
10651 2006-03-25
10652 2006-11-15
10653 select * from t44 order by colint;
10654 colint col1
10655 1 2006-02-03
10656 2 2006-01-17
10657 3 2006-01-25
10658 4 2006-02-05
10659 select * from t55 order by colint;
10660 colint col1
10661 1 2006-02-03
10662 2 2006-01-17
10663 3 2006-01-25
10664 4 2006-02-05
10665 begin;
10666 insert into t11 values ('2006-08-17');
10667 insert into t22 values ('2006-08-17');
10668 insert into t33 values ('2006-08-17');
10669 insert into t44 values (60,'2006-08-17');
10670 insert into t55 values (60,'2006-08-17');
10671 insert into t66 values (60,'2006-08-17');
10672 commit;
10673 select * from t11 order by col1;
10674 col1
10675 2006-08-17
10676 2006-11-15
10677 select * from t22 order by col1;
10678 col1
10679 2006-03-25
10680 2006-08-17
10681 2006-11-15
10682 select * from t33 order by col1;
10683 col1
10684 2006-03-25
10685 2006-08-17
10686 2006-11-15
10687 select * from t44 order by colint;
10688 colint col1
10689 1 2006-02-03
10690 2 2006-01-17
10691 3 2006-01-25
10692 4 2006-02-05
10693 60 2006-08-17
10694 select * from t55 order by colint;
10695 colint col1
10696 1 2006-02-03
10697 2 2006-01-17
10698 3 2006-01-25
10699 4 2006-02-05
10700 60 2006-08-17
10701 select * from t66 order by colint;
10702 colint col1
10703 1 2006-02-03
10704 2 2006-01-17
10705 3 2006-01-25
10706 4 2006-02-05
10707 60 2006-08-17
10708 alter table t11 drop partition p0;
10709 alter table t22 drop partition p0;
10710 alter table t44 drop partition p0;
10711 alter table t55 drop partition p0;
10712 alter table t66 drop partition p0;
10713 select * from t11 order by col1;
10714 col1
10715 2006-08-17
10716 2006-11-15
10717 select * from t22 order by col1;
10718 col1
10719 2006-03-25
10720 2006-08-17
10721 2006-11-15
10722 select * from t33 order by col1;
10723 col1
10724 2006-03-25
10725 2006-08-17
10726 2006-11-15
10727 select * from t44 order by colint;
10728 colint col1
10729 60 2006-08-17
10730 select * from t55 order by colint;
10731 colint col1
10732 60 2006-08-17
10733 select * from t66 order by colint;
10734 colint col1
10735 60 2006-08-17
10736 -------------------------
10737 ---- some alter table end
10738 -------------------------
10739 drop table if exists t1 ;
10740 drop table if exists t2 ;
10741 drop table if exists t3 ;
10742 drop table if exists t4 ;
10743 drop table if exists t5 ;
10744 drop table if exists t6 ;
10745 drop table if exists t11 ;
10746 drop table if exists t22 ;
10747 drop table if exists t33 ;
10748 drop table if exists t44 ;
10749 drop table if exists t55 ;
10750 drop table if exists t66 ;