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