~ubuntu-branches/ubuntu/lucid/mysql-dfsg-5.1/lucid-security

« back to all changes in this revision

Viewing changes to mysql-test/suite/parts/r/part_supported_sql_func_myisam.result

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2012-02-22 22:33:55 UTC
  • mto: (1.2.1) (37.1.1 lucid-security)
  • mto: This revision was merged to the branch mainline in revision 36.
  • Revision ID: package-import@ubuntu.com-20120222223355-ku1tb4r70osci6v2
Tags: upstream-5.1.61
ImportĀ upstreamĀ versionĀ 5.1.61

Show diffs side-by-side

added added

removed removed

Lines of Context:
5425
5425
drop table if exists t55 ;
5426
5426
drop table if exists t66 ;
5427
5427
-------------------------------------------------------------------------
5428
 
---  dayofyear(col1)  in partition with coltype  char(30)
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 dayofyear(col1)
5438
 
-------------------------------------------------------------------------
5439
 
create table t1 (col1 char(30)) engine='MYISAM' 
5440
 
partition by range(dayofyear(col1)) 
5441
 
(partition p0 values less than (15),
5442
 
partition p1 values less than maxvalue);
5443
 
create table t2 (col1 char(30)) engine='MYISAM' 
5444
 
partition by list(dayofyear(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 char(30)) engine='MYISAM' 
5453
 
partition by hash(dayofyear(col1));
5454
 
create table t4 (colint int, col1 char(30)) engine='MYISAM' 
5455
 
partition by range(colint) 
5456
 
subpartition by hash(dayofyear(col1)) subpartitions 2 
5457
 
(partition p0 values less than (15),
5458
 
partition p1 values less than maxvalue);
5459
 
create table t5 (colint int, col1 char(30)) engine='MYISAM' 
5460
 
partition by list(colint)
5461
 
subpartition by hash(dayofyear(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 char(30)) engine='MYISAM' 
5470
 
partition by range(colint) 
5471
 
(partition p0 values less than (dayofyear('2006-12-25')),
5472
 
partition p1 values less than maxvalue);
5473
 
-------------------------------------------------------------------------
5474
 
---  Access tables with dayofyear(col1) 
5475
 
-------------------------------------------------------------------------
5476
 
insert into t1 values ('2006-01-03');
5477
 
insert into t1 values ('2006-01-17');
5478
 
insert into t2 values ('2006-01-03');
5479
 
insert into t2 values ('2006-01-17');
5480
 
insert into t2 values ('2006-02-25');
5481
 
insert into t3 values ('2006-01-03');
5482
 
insert into t3 values ('2006-01-17');
5483
 
insert into t3 values ('2006-02-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 dayofyear(col1) from t1 order by col1;
5488
 
dayofyear(col1)
5489
 
3
5490
 
17
5491
 
select * from t1 order by col1;
5492
 
col1
5493
 
2006-01-03
5494
 
2006-01-17
5495
 
select * from t2 order by col1;
5496
 
col1
5497
 
2006-01-03
5498
 
2006-01-17
5499
 
2006-02-25
5500
 
select * from t3 order by col1;
5501
 
col1
5502
 
2006-01-03
5503
 
2006-01-17
5504
 
2006-02-25
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-01-17
5532
 
2006-02-05
5533
 
select * from t2 order by col1;
5534
 
col1
5535
 
2006-01-17
5536
 
2006-02-05
5537
 
2006-02-25
5538
 
select * from t3 order by col1;
5539
 
col1
5540
 
2006-01-17
5541
 
2006-02-05
5542
 
2006-02-25
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 dayofyear(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='MYISAM' as select * from t1;
5571
 
create table t22 engine='MYISAM' as select * from t2;
5572
 
create table t33 engine='MYISAM' as select * from t3;
5573
 
create table t44 engine='MYISAM' as select * from t4;
5574
 
create table t55 engine='MYISAM' as select * from t5;
5575
 
create table t66 engine='MYISAM' as select * from t6;
5576
 
alter table t11
5577
 
partition by range(dayofyear(col1)) 
5578
 
(partition p0 values less than (15),
5579
 
partition p1 values less than maxvalue);
5580
 
alter table t22
5581
 
partition by list(dayofyear(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(dayofyear(col1));
5591
 
alter table t44
5592
 
partition by range(colint) 
5593
 
subpartition by hash(dayofyear(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(dayofyear(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 (dayofyear('2006-12-25')),
5609
 
partition p1 values less than maxvalue);
5610
 
select * from t11 order by col1;
5611
 
col1
5612
 
2006-01-17
5613
 
2006-02-05
5614
 
select * from t22 order by col1;
5615
 
col1
5616
 
2006-01-17
5617
 
2006-02-05
5618
 
2006-02-25
5619
 
select * from t33 order by col1;
5620
 
col1
5621
 
2006-01-17
5622
 
2006-02-05
5623
 
2006-02-25
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-01-17
5651
 
2006-02-05
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-01-17
5659
 
2006-02-05
5660
 
alter table t55
5661
 
partition by list(colint)
5662
 
subpartition by hash(dayofyear(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(11) DEFAULT NULL,
5674
 
  `col1` char(30) DEFAULT NULL
5675
 
) ENGINE=MyISAM DEFAULT CHARSET=latin1
5676
 
/*!50100 PARTITION BY LIST (colint)
5677
 
SUBPARTITION BY HASH (dayofyear(col1))
5678
 
SUBPARTITIONS 5
5679
 
(PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM,
5680
 
 PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM,
5681
 
 PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM,
5682
 
 PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM,
5683
 
 PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM,
5684
 
 PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
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 (dayofyear('2006-12-25')),
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 (dayofyear('2006-12-25')),
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 dayofyear(col1)
5731
 
-------------------------------------------------------------------------
5732
 
delete from t1 where col1='2006-01-17';
5733
 
delete from t2 where col1='2006-01-17';
5734
 
delete from t3 where col1='2006-01-17';
5735
 
delete from t4 where col1='2006-01-17';
5736
 
delete from t5 where col1='2006-01-17';
5737
 
delete from t6 where col1='2006-01-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-02-05
5744
 
2006-02-25
5745
 
select * from t3 order by col1;
5746
 
col1
5747
 
2006-02-05
5748
 
2006-02-25
5749
 
select * from t4 order by colint;
5750
 
colint  col1
5751
 
1       2006-02-03
5752
 
3       2006-01-25
5753
 
4       2006-02-05
5754
 
select * from t5 order by colint;
5755
 
colint  col1
5756
 
1       2006-02-03
5757
 
3       2006-01-25
5758
 
4       2006-02-05
5759
 
insert into t1 values ('2006-01-17');
5760
 
insert into t2 values ('2006-01-17');
5761
 
insert into t3 values ('2006-01-17');
5762
 
insert into t4 values (60,'2006-01-17');
5763
 
insert into t5 values (60,'2006-01-17');
5764
 
insert into t6 values (60,'2006-01-17');
5765
 
select * from t1 order by col1;
5766
 
col1
5767
 
2006-01-17
5768
 
2006-02-05
5769
 
select * from t2 order by col1;
5770
 
col1
5771
 
2006-01-17
5772
 
2006-02-05
5773
 
2006-02-25
5774
 
select * from t3 order by col1;
5775
 
col1
5776
 
2006-01-17
5777
 
2006-02-05
5778
 
2006-02-25
5779
 
select * from t4 order by colint;
5780
 
colint  col1
5781
 
1       2006-02-03
5782
 
3       2006-01-25
5783
 
4       2006-02-05
5784
 
60      2006-01-17
5785
 
select * from t5 order by colint;
5786
 
colint  col1
5787
 
1       2006-02-03
5788
 
3       2006-01-25
5789
 
4       2006-02-05
5790
 
60      2006-01-17
5791
 
select * from t6 order by colint;
5792
 
colint  col1
5793
 
1       2006-02-03
5794
 
3       2006-01-25
5795
 
4       2006-02-05
5796
 
60      2006-01-17
5797
 
alter table t1 drop partition p0;
5798
 
alter table t2 drop partition p0;
5799
 
alter table t4 drop partition p0;
5800
 
alter table t5 drop partition p0;
5801
 
alter table t6 drop partition p0;
5802
 
select * from t1 order by col1;
5803
 
col1
5804
 
2006-01-17
5805
 
2006-02-05
5806
 
select * from t2 order by col1;
5807
 
col1
5808
 
2006-01-17
5809
 
2006-02-05
5810
 
2006-02-25
5811
 
select * from t3 order by col1;
5812
 
col1
5813
 
2006-01-17
5814
 
2006-02-05
5815
 
2006-02-25
5816
 
select * from t4 order by colint;
5817
 
colint  col1
5818
 
60      2006-01-17
5819
 
select * from t5 order by colint;
5820
 
colint  col1
5821
 
60      2006-01-17
5822
 
select * from t6 order by colint;
5823
 
colint  col1
5824
 
-------------------------------------------------------------------------
5825
 
---  Delete rows and partitions of tables with dayofyear(col1)
5826
 
-------------------------------------------------------------------------
5827
 
delete from t11 where col1='2006-01-17';
5828
 
delete from t22 where col1='2006-01-17';
5829
 
delete from t33 where col1='2006-01-17';
5830
 
delete from t44 where col1='2006-01-17';
5831
 
delete from t55 where col1='2006-01-17';
5832
 
delete from t66 where col1='2006-01-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-02-05
5839
 
2006-02-25
5840
 
select * from t33 order by col1;
5841
 
col1
5842
 
2006-02-05
5843
 
2006-02-25
5844
 
select * from t44 order by colint;
5845
 
colint  col1
5846
 
1       2006-02-03
5847
 
3       2006-01-25
5848
 
4       2006-02-05
5849
 
select * from t55 order by colint;
5850
 
colint  col1
5851
 
1       2006-02-03
5852
 
3       2006-01-25
5853
 
4       2006-02-05
5854
 
insert into t11 values ('2006-01-17');
5855
 
insert into t22 values ('2006-01-17');
5856
 
insert into t33 values ('2006-01-17');
5857
 
insert into t44 values (60,'2006-01-17');
5858
 
insert into t55 values (60,'2006-01-17');
5859
 
insert into t66 values (60,'2006-01-17');
5860
 
select * from t11 order by col1;
5861
 
col1
5862
 
2006-01-17
5863
 
2006-02-05
5864
 
select * from t22 order by col1;
5865
 
col1
5866
 
2006-01-17
5867
 
2006-02-05
5868
 
2006-02-25
5869
 
select * from t33 order by col1;
5870
 
col1
5871
 
2006-01-17
5872
 
2006-02-05
5873
 
2006-02-25
5874
 
select * from t44 order by colint;
5875
 
colint  col1
5876
 
1       2006-02-03
5877
 
3       2006-01-25
5878
 
4       2006-02-05
5879
 
60      2006-01-17
5880
 
select * from t55 order by colint;
5881
 
colint  col1
5882
 
1       2006-02-03
5883
 
3       2006-01-25
5884
 
4       2006-02-05
5885
 
60      2006-01-17
5886
 
select * from t66 order by colint;
5887
 
colint  col1
5888
 
1       2006-02-03
5889
 
3       2006-01-25
5890
 
4       2006-02-05
5891
 
60      2006-01-17
5892
 
alter table t11 drop partition p0;
5893
 
alter table t22 drop partition p0;
5894
 
alter table t44 drop partition p0;
5895
 
alter table t55 drop partition p0;
5896
 
alter table t66 drop partition p0;
5897
 
select * from t11 order by col1;
5898
 
col1
5899
 
2006-01-17
5900
 
2006-02-05
5901
 
select * from t22 order by col1;
5902
 
col1
5903
 
2006-01-17
5904
 
2006-02-05
5905
 
2006-02-25
5906
 
select * from t33 order by col1;
5907
 
col1
5908
 
2006-01-17
5909
 
2006-02-05
5910
 
2006-02-25
5911
 
select * from t44 order by colint;
5912
 
colint  col1
5913
 
60      2006-01-17
5914
 
select * from t55 order by colint;
5915
 
colint  col1
5916
 
60      2006-01-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
5428
---  extract(month from col1)  in partition with coltype  date
5936
5429
-------------------------------------------------------------------------
5937
5430
drop table if exists t1 ;
8489
7982
drop table if exists t55 ;
8490
7983
drop table if exists t66 ;
8491
7984
-------------------------------------------------------------------------
8492
 
---  second(col1)  in partition with coltype  char(30)
8493
 
-------------------------------------------------------------------------
8494
 
drop table if exists t1 ;
8495
 
drop table if exists t2 ;
8496
 
drop table if exists t3 ;
8497
 
drop table if exists t4 ;
8498
 
drop table if exists t5 ;
8499
 
drop table if exists t6 ;
8500
 
-------------------------------------------------------------------------
8501
 
---  Create tables with second(col1)
8502
 
-------------------------------------------------------------------------
8503
 
create table t1 (col1 char(30)) engine='MYISAM' 
8504
 
partition by range(second(col1)) 
8505
 
(partition p0 values less than (15),
8506
 
partition p1 values less than maxvalue);
8507
 
create table t2 (col1 char(30)) engine='MYISAM' 
8508
 
partition by list(second(col1)) 
8509
 
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
8510
 
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
8511
 
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
8512
 
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
8513
 
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
8514
 
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
8515
 
);
8516
 
create table t3 (col1 char(30)) engine='MYISAM' 
8517
 
partition by hash(second(col1));
8518
 
create table t4 (colint int, col1 char(30)) engine='MYISAM' 
8519
 
partition by range(colint) 
8520
 
subpartition by hash(second(col1)) subpartitions 2 
8521
 
(partition p0 values less than (15),
8522
 
partition p1 values less than maxvalue);
8523
 
create table t5 (colint int, col1 char(30)) engine='MYISAM' 
8524
 
partition by list(colint)
8525
 
subpartition by hash(second(col1)) subpartitions 2 
8526
 
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
8527
 
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
8528
 
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
8529
 
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
8530
 
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
8531
 
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
8532
 
);
8533
 
create table t6 (colint int, col1 char(30)) engine='MYISAM' 
8534
 
partition by range(colint) 
8535
 
(partition p0 values less than (second('18:30:14')),
8536
 
partition p1 values less than maxvalue);
8537
 
-------------------------------------------------------------------------
8538
 
---  Access tables with second(col1) 
8539
 
-------------------------------------------------------------------------
8540
 
insert into t1 values ('09:09:09');
8541
 
insert into t1 values ('14:30:20');
8542
 
insert into t2 values ('09:09:09');
8543
 
insert into t2 values ('14:30:20');
8544
 
insert into t2 values ('21:59:22');
8545
 
insert into t3 values ('09:09:09');
8546
 
insert into t3 values ('14:30:20');
8547
 
insert into t3 values ('21:59:22');
8548
 
load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t4;
8549
 
load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t5;
8550
 
load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t6;
8551
 
select second(col1) from t1 order by col1;
8552
 
second(col1)
8553
 
9
8554
 
20
8555
 
select * from t1 order by col1;
8556
 
col1
8557
 
09:09:09
8558
 
14:30:20
8559
 
select * from t2 order by col1;
8560
 
col1
8561
 
09:09:09
8562
 
14:30:20
8563
 
21:59:22
8564
 
select * from t3 order by col1;
8565
 
col1
8566
 
09:09:09
8567
 
14:30:20
8568
 
21:59:22
8569
 
select * from t4 order by colint;
8570
 
colint  col1
8571
 
1       09:09:15.000002
8572
 
2       04:30:01.000018
8573
 
3       00:59:22.000024
8574
 
4       05:30:34.000037
8575
 
select * from t5 order by colint;
8576
 
colint  col1
8577
 
1       09:09:15.000002
8578
 
2       04:30:01.000018
8579
 
3       00:59:22.000024
8580
 
4       05:30:34.000037
8581
 
select * from t6 order by colint;
8582
 
colint  col1
8583
 
1       09:09:15.000002
8584
 
2       04:30:01.000018
8585
 
3       00:59:22.000024
8586
 
4       05:30:34.000037
8587
 
update t1 set col1='10:22:33' where col1='09:09:09';
8588
 
update t2 set col1='10:22:33' where col1='09:09:09';
8589
 
update t3 set col1='10:22:33' where col1='09:09:09';
8590
 
update t4 set col1='10:22:33' where col1='09:09:09';
8591
 
update t5 set col1='10:22:33' where col1='09:09:09';
8592
 
update t6 set col1='10:22:33' where col1='09:09:09';
8593
 
select * from t1 order by col1;
8594
 
col1
8595
 
10:22:33
8596
 
14:30:20
8597
 
select * from t2 order by col1;
8598
 
col1
8599
 
10:22:33
8600
 
14:30:20
8601
 
21:59:22
8602
 
select * from t3 order by col1;
8603
 
col1
8604
 
10:22:33
8605
 
14:30:20
8606
 
21:59:22
8607
 
select * from t4 order by colint;
8608
 
colint  col1
8609
 
1       09:09:15.000002
8610
 
2       04:30:01.000018
8611
 
3       00:59:22.000024
8612
 
4       05:30:34.000037
8613
 
select * from t5 order by colint;
8614
 
colint  col1
8615
 
1       09:09:15.000002
8616
 
2       04:30:01.000018
8617
 
3       00:59:22.000024
8618
 
4       05:30:34.000037
8619
 
select * from t6 order by colint;
8620
 
colint  col1
8621
 
1       09:09:15.000002
8622
 
2       04:30:01.000018
8623
 
3       00:59:22.000024
8624
 
4       05:30:34.000037
8625
 
-------------------------------------------------------------------------
8626
 
---  Alter tables with second(col1)
8627
 
-------------------------------------------------------------------------
8628
 
drop table if exists t11 ;
8629
 
drop table if exists t22 ;
8630
 
drop table if exists t33 ;
8631
 
drop table if exists t44 ;
8632
 
drop table if exists t55 ;
8633
 
drop table if exists t66 ;
8634
 
create table t11 engine='MYISAM' as select * from t1;
8635
 
create table t22 engine='MYISAM' as select * from t2;
8636
 
create table t33 engine='MYISAM' as select * from t3;
8637
 
create table t44 engine='MYISAM' as select * from t4;
8638
 
create table t55 engine='MYISAM' as select * from t5;
8639
 
create table t66 engine='MYISAM' as select * from t6;
8640
 
alter table t11
8641
 
partition by range(second(col1)) 
8642
 
(partition p0 values less than (15),
8643
 
partition p1 values less than maxvalue);
8644
 
alter table t22
8645
 
partition by list(second(col1)) 
8646
 
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
8647
 
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
8648
 
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
8649
 
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
8650
 
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
8651
 
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
8652
 
);
8653
 
alter table t33
8654
 
partition by hash(second(col1));
8655
 
alter table t44
8656
 
partition by range(colint) 
8657
 
subpartition by hash(second(col1)) subpartitions 2 
8658
 
(partition p0 values less than (15),
8659
 
partition p1 values less than maxvalue);
8660
 
alter table t55
8661
 
partition by list(colint)
8662
 
subpartition by hash(second(col1)) subpartitions 2 
8663
 
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
8664
 
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
8665
 
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
8666
 
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
8667
 
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
8668
 
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
8669
 
);
8670
 
alter table t66
8671
 
partition by range(colint) 
8672
 
(partition p0 values less than (second('18:30:14')),
8673
 
partition p1 values less than maxvalue);
8674
 
select * from t11 order by col1;
8675
 
col1
8676
 
10:22:33
8677
 
14:30:20
8678
 
select * from t22 order by col1;
8679
 
col1
8680
 
10:22:33
8681
 
14:30:20
8682
 
21:59:22
8683
 
select * from t33 order by col1;
8684
 
col1
8685
 
10:22:33
8686
 
14:30:20
8687
 
21:59:22
8688
 
select * from t44 order by colint;
8689
 
colint  col1
8690
 
1       09:09:15.000002
8691
 
2       04:30:01.000018
8692
 
3       00:59:22.000024
8693
 
4       05:30:34.000037
8694
 
select * from t55 order by colint;
8695
 
colint  col1
8696
 
1       09:09:15.000002
8697
 
2       04:30:01.000018
8698
 
3       00:59:22.000024
8699
 
4       05:30:34.000037
8700
 
select * from t66 order by colint;
8701
 
colint  col1
8702
 
1       09:09:15.000002
8703
 
2       04:30:01.000018
8704
 
3       00:59:22.000024
8705
 
4       05:30:34.000037
8706
 
---------------------------
8707
 
---- some alter table begin
8708
 
---------------------------
8709
 
alter table t11
8710
 
reorganize partition p0,p1 into
8711
 
(partition s1 values less than maxvalue);
8712
 
select * from t11 order by col1;
8713
 
col1
8714
 
10:22:33
8715
 
14:30:20
8716
 
alter table t11
8717
 
reorganize partition s1 into
8718
 
(partition p0 values less than (15),
8719
 
partition p1 values less than maxvalue);
8720
 
select * from t11 order by col1;
8721
 
col1
8722
 
10:22:33
8723
 
14:30:20
8724
 
alter table t55
8725
 
partition by list(colint)
8726
 
subpartition by hash(second(col1)) subpartitions 5 
8727
 
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
8728
 
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
8729
 
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
8730
 
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
8731
 
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
8732
 
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
8733
 
);
8734
 
show create table t55;
8735
 
Table   Create Table
8736
 
t55     CREATE TABLE `t55` (
8737
 
  `colint` int(11) DEFAULT NULL,
8738
 
  `col1` char(30) DEFAULT NULL
8739
 
) ENGINE=MyISAM DEFAULT CHARSET=latin1
8740
 
/*!50100 PARTITION BY LIST (colint)
8741
 
SUBPARTITION BY HASH (second(col1))
8742
 
SUBPARTITIONS 5
8743
 
(PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM,
8744
 
 PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM,
8745
 
 PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM,
8746
 
 PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM,
8747
 
 PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM,
8748
 
 PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
8749
 
select * from t55 order by colint;
8750
 
colint  col1
8751
 
1       09:09:15.000002
8752
 
2       04:30:01.000018
8753
 
3       00:59:22.000024
8754
 
4       05:30:34.000037
8755
 
alter table t66
8756
 
reorganize partition p0,p1 into
8757
 
(partition s1 values less than maxvalue);
8758
 
select * from t66 order by colint;
8759
 
colint  col1
8760
 
1       09:09:15.000002
8761
 
2       04:30:01.000018
8762
 
3       00:59:22.000024
8763
 
4       05:30:34.000037
8764
 
alter table t66
8765
 
reorganize partition s1 into
8766
 
(partition p0 values less than (second('18:30:14')),
8767
 
partition p1 values less than maxvalue);
8768
 
select * from t66 order by colint;
8769
 
colint  col1
8770
 
1       09:09:15.000002
8771
 
2       04:30:01.000018
8772
 
3       00:59:22.000024
8773
 
4       05:30:34.000037
8774
 
alter table t66
8775
 
reorganize partition p0,p1 into
8776
 
(partition s1 values less than maxvalue);
8777
 
select * from t66 order by colint;
8778
 
colint  col1
8779
 
1       09:09:15.000002
8780
 
2       04:30:01.000018
8781
 
3       00:59:22.000024
8782
 
4       05:30:34.000037
8783
 
alter table t66
8784
 
reorganize partition s1 into
8785
 
(partition p0 values less than (second('18:30:14')),
8786
 
partition p1 values less than maxvalue);
8787
 
select * from t66 order by colint;
8788
 
colint  col1
8789
 
1       09:09:15.000002
8790
 
2       04:30:01.000018
8791
 
3       00:59:22.000024
8792
 
4       05:30:34.000037
8793
 
-------------------------------------------------------------------------
8794
 
---  Delete rows and partitions of tables with second(col1)
8795
 
-------------------------------------------------------------------------
8796
 
delete from t1 where col1='14:30:20';
8797
 
delete from t2 where col1='14:30:20';
8798
 
delete from t3 where col1='14:30:20';
8799
 
delete from t4 where col1='14:30:20';
8800
 
delete from t5 where col1='14:30:20';
8801
 
delete from t6 where col1='14:30:20';
8802
 
select * from t1 order by col1;
8803
 
col1
8804
 
10:22:33
8805
 
select * from t2 order by col1;
8806
 
col1
8807
 
10:22:33
8808
 
21:59:22
8809
 
select * from t3 order by col1;
8810
 
col1
8811
 
10:22:33
8812
 
21:59:22
8813
 
select * from t4 order by colint;
8814
 
colint  col1
8815
 
1       09:09:15.000002
8816
 
2       04:30:01.000018
8817
 
3       00:59:22.000024
8818
 
4       05:30:34.000037
8819
 
select * from t5 order by colint;
8820
 
colint  col1
8821
 
1       09:09:15.000002
8822
 
2       04:30:01.000018
8823
 
3       00:59:22.000024
8824
 
4       05:30:34.000037
8825
 
insert into t1 values ('14:30:20');
8826
 
insert into t2 values ('14:30:20');
8827
 
insert into t3 values ('14:30:20');
8828
 
insert into t4 values (60,'14:30:20');
8829
 
insert into t5 values (60,'14:30:20');
8830
 
insert into t6 values (60,'14:30:20');
8831
 
select * from t1 order by col1;
8832
 
col1
8833
 
10:22:33
8834
 
14:30:20
8835
 
select * from t2 order by col1;
8836
 
col1
8837
 
10:22:33
8838
 
14:30:20
8839
 
21:59:22
8840
 
select * from t3 order by col1;
8841
 
col1
8842
 
10:22:33
8843
 
14:30:20
8844
 
21:59:22
8845
 
select * from t4 order by colint;
8846
 
colint  col1
8847
 
1       09:09:15.000002
8848
 
2       04:30:01.000018
8849
 
3       00:59:22.000024
8850
 
4       05:30:34.000037
8851
 
60      14:30:20
8852
 
select * from t5 order by colint;
8853
 
colint  col1
8854
 
1       09:09:15.000002
8855
 
2       04:30:01.000018
8856
 
3       00:59:22.000024
8857
 
4       05:30:34.000037
8858
 
60      14:30:20
8859
 
select * from t6 order by colint;
8860
 
colint  col1
8861
 
1       09:09:15.000002
8862
 
2       04:30:01.000018
8863
 
3       00:59:22.000024
8864
 
4       05:30:34.000037
8865
 
60      14:30:20
8866
 
alter table t1 drop partition p0;
8867
 
alter table t2 drop partition p0;
8868
 
alter table t4 drop partition p0;
8869
 
alter table t5 drop partition p0;
8870
 
alter table t6 drop partition p0;
8871
 
select * from t1 order by col1;
8872
 
col1
8873
 
10:22:33
8874
 
14:30:20
8875
 
select * from t2 order by col1;
8876
 
col1
8877
 
10:22:33
8878
 
14:30:20
8879
 
21:59:22
8880
 
select * from t3 order by col1;
8881
 
col1
8882
 
10:22:33
8883
 
14:30:20
8884
 
21:59:22
8885
 
select * from t4 order by colint;
8886
 
colint  col1
8887
 
60      14:30:20
8888
 
select * from t5 order by colint;
8889
 
colint  col1
8890
 
60      14:30:20
8891
 
select * from t6 order by colint;
8892
 
colint  col1
8893
 
60      14:30:20
8894
 
-------------------------------------------------------------------------
8895
 
---  Delete rows and partitions of tables with second(col1)
8896
 
-------------------------------------------------------------------------
8897
 
delete from t11 where col1='14:30:20';
8898
 
delete from t22 where col1='14:30:20';
8899
 
delete from t33 where col1='14:30:20';
8900
 
delete from t44 where col1='14:30:20';
8901
 
delete from t55 where col1='14:30:20';
8902
 
delete from t66 where col1='14:30:20';
8903
 
select * from t11 order by col1;
8904
 
col1
8905
 
10:22:33
8906
 
select * from t22 order by col1;
8907
 
col1
8908
 
10:22:33
8909
 
21:59:22
8910
 
select * from t33 order by col1;
8911
 
col1
8912
 
10:22:33
8913
 
21:59:22
8914
 
select * from t44 order by colint;
8915
 
colint  col1
8916
 
1       09:09:15.000002
8917
 
2       04:30:01.000018
8918
 
3       00:59:22.000024
8919
 
4       05:30:34.000037
8920
 
select * from t55 order by colint;
8921
 
colint  col1
8922
 
1       09:09:15.000002
8923
 
2       04:30:01.000018
8924
 
3       00:59:22.000024
8925
 
4       05:30:34.000037
8926
 
insert into t11 values ('14:30:20');
8927
 
insert into t22 values ('14:30:20');
8928
 
insert into t33 values ('14:30:20');
8929
 
insert into t44 values (60,'14:30:20');
8930
 
insert into t55 values (60,'14:30:20');
8931
 
insert into t66 values (60,'14:30:20');
8932
 
select * from t11 order by col1;
8933
 
col1
8934
 
10:22:33
8935
 
14:30:20
8936
 
select * from t22 order by col1;
8937
 
col1
8938
 
10:22:33
8939
 
14:30:20
8940
 
21:59:22
8941
 
select * from t33 order by col1;
8942
 
col1
8943
 
10:22:33
8944
 
14:30:20
8945
 
21:59:22
8946
 
select * from t44 order by colint;
8947
 
colint  col1
8948
 
1       09:09:15.000002
8949
 
2       04:30:01.000018
8950
 
3       00:59:22.000024
8951
 
4       05:30:34.000037
8952
 
60      14:30:20
8953
 
select * from t55 order by colint;
8954
 
colint  col1
8955
 
1       09:09:15.000002
8956
 
2       04:30:01.000018
8957
 
3       00:59:22.000024
8958
 
4       05:30:34.000037
8959
 
60      14:30:20
8960
 
select * from t66 order by colint;
8961
 
colint  col1
8962
 
1       09:09:15.000002
8963
 
2       04:30:01.000018
8964
 
3       00:59:22.000024
8965
 
4       05:30:34.000037
8966
 
60      14:30:20
8967
 
alter table t11 drop partition p0;
8968
 
alter table t22 drop partition p0;
8969
 
alter table t44 drop partition p0;
8970
 
alter table t55 drop partition p0;
8971
 
alter table t66 drop partition p0;
8972
 
select * from t11 order by col1;
8973
 
col1
8974
 
10:22:33
8975
 
14:30:20
8976
 
select * from t22 order by col1;
8977
 
col1
8978
 
10:22:33
8979
 
14:30:20
8980
 
21:59:22
8981
 
select * from t33 order by col1;
8982
 
col1
8983
 
10:22:33
8984
 
14:30:20
8985
 
21:59:22
8986
 
select * from t44 order by colint;
8987
 
colint  col1
8988
 
60      14:30:20
8989
 
select * from t55 order by colint;
8990
 
colint  col1
8991
 
60      14:30:20
8992
 
select * from t66 order by colint;
8993
 
colint  col1
8994
 
60      14:30:20
8995
 
-------------------------
8996
 
---- some alter table end
8997
 
-------------------------
8998
 
drop table if exists t1 ;
8999
 
drop table if exists t2 ;
9000
 
drop table if exists t3 ;
9001
 
drop table if exists t4 ;
9002
 
drop table if exists t5 ;
9003
 
drop table if exists t6 ;
9004
 
drop table if exists t11 ;
9005
 
drop table if exists t22 ;
9006
 
drop table if exists t33 ;
9007
 
drop table if exists t44 ;
9008
 
drop table if exists t55 ;
9009
 
drop table if exists t66 ;
9010
 
-------------------------------------------------------------------------
9011
7985
---  month(col1)  in partition with coltype  date
9012
7986
-------------------------------------------------------------------------
9013
7987
drop table if exists t1 ;
10549
9523
drop table if exists t55 ;
10550
9524
drop table if exists t66 ;
10551
9525
-------------------------------------------------------------------------
10552
 
---  to_days(col1)-to_days('2006-01-01')  in partition with coltype  date
10553
 
-------------------------------------------------------------------------
10554
 
drop table if exists t1 ;
10555
 
drop table if exists t2 ;
10556
 
drop table if exists t3 ;
10557
 
drop table if exists t4 ;
10558
 
drop table if exists t5 ;
10559
 
drop table if exists t6 ;
10560
 
-------------------------------------------------------------------------
10561
 
---  Create tables with to_days(col1)-to_days('2006-01-01')
10562
 
-------------------------------------------------------------------------
10563
 
create table t1 (col1 date) engine='MYISAM' 
10564
 
partition by range(to_days(col1)-to_days('2006-01-01')) 
10565
 
(partition p0 values less than (15),
10566
 
partition p1 values less than maxvalue);
10567
 
create table t2 (col1 date) engine='MYISAM' 
10568
 
partition by list(to_days(col1)-to_days('2006-01-01')) 
10569
 
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
10570
 
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
10571
 
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
10572
 
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
10573
 
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
10574
 
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
10575
 
);
10576
 
create table t3 (col1 date) engine='MYISAM' 
10577
 
partition by hash(to_days(col1)-to_days('2006-01-01'));
10578
 
create table t4 (colint int, col1 date) engine='MYISAM' 
10579
 
partition by range(colint) 
10580
 
subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 2 
10581
 
(partition p0 values less than (15),
10582
 
partition p1 values less than maxvalue);
10583
 
create table t5 (colint int, col1 date) engine='MYISAM' 
10584
 
partition by list(colint)
10585
 
subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 2 
10586
 
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
10587
 
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
10588
 
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
10589
 
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
10590
 
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
10591
 
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
10592
 
);
10593
 
create table t6 (colint int, col1 date) engine='MYISAM' 
10594
 
partition by range(colint) 
10595
 
(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')),
10596
 
partition p1 values less than maxvalue);
10597
 
-------------------------------------------------------------------------
10598
 
---  Access tables with to_days(col1)-to_days('2006-01-01') 
10599
 
-------------------------------------------------------------------------
10600
 
insert into t1 values ('2006-02-03');
10601
 
insert into t1 values ('2006-01-17');
10602
 
insert into t2 values ('2006-02-03');
10603
 
insert into t2 values ('2006-01-17');
10604
 
insert into t2 values ('2006-01-25');
10605
 
insert into t3 values ('2006-02-03');
10606
 
insert into t3 values ('2006-01-17');
10607
 
insert into t3 values ('2006-01-25');
10608
 
load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4;
10609
 
load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5;
10610
 
load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6;
10611
 
select to_days(col1)-to_days('2006-01-01') from t1 order by col1;
10612
 
to_days(col1)-to_days('2006-01-01')
10613
 
16
10614
 
33
10615
 
select * from t1 order by col1;
10616
 
col1
10617
 
2006-01-17
10618
 
2006-02-03
10619
 
select * from t2 order by col1;
10620
 
col1
10621
 
2006-01-17
10622
 
2006-01-25
10623
 
2006-02-03
10624
 
select * from t3 order by col1;
10625
 
col1
10626
 
2006-01-17
10627
 
2006-01-25
10628
 
2006-02-03
10629
 
select * from t4 order by colint;
10630
 
colint  col1
10631
 
1       2006-02-03
10632
 
2       2006-01-17
10633
 
3       2006-01-25
10634
 
4       2006-02-05
10635
 
select * from t5 order by colint;
10636
 
colint  col1
10637
 
1       2006-02-03
10638
 
2       2006-01-17
10639
 
3       2006-01-25
10640
 
4       2006-02-05
10641
 
select * from t6 order by colint;
10642
 
colint  col1
10643
 
1       2006-02-03
10644
 
2       2006-01-17
10645
 
3       2006-01-25
10646
 
4       2006-02-05
10647
 
update t1 set col1='2006-02-06' where col1='2006-02-03';
10648
 
update t2 set col1='2006-02-06' where col1='2006-02-03';
10649
 
update t3 set col1='2006-02-06' where col1='2006-02-03';
10650
 
update t4 set col1='2006-02-06' where col1='2006-02-03';
10651
 
update t5 set col1='2006-02-06' where col1='2006-02-03';
10652
 
update t6 set col1='2006-02-06' where col1='2006-02-03';
10653
 
select * from t1 order by col1;
10654
 
col1
10655
 
2006-01-17
10656
 
2006-02-06
10657
 
select * from t2 order by col1;
10658
 
col1
10659
 
2006-01-17
10660
 
2006-01-25
10661
 
2006-02-06
10662
 
select * from t3 order by col1;
10663
 
col1
10664
 
2006-01-17
10665
 
2006-01-25
10666
 
2006-02-06
10667
 
select * from t4 order by colint;
10668
 
colint  col1
10669
 
1       2006-02-06
10670
 
2       2006-01-17
10671
 
3       2006-01-25
10672
 
4       2006-02-05
10673
 
select * from t5 order by colint;
10674
 
colint  col1
10675
 
1       2006-02-06
10676
 
2       2006-01-17
10677
 
3       2006-01-25
10678
 
4       2006-02-05
10679
 
select * from t6 order by colint;
10680
 
colint  col1
10681
 
1       2006-02-06
10682
 
2       2006-01-17
10683
 
3       2006-01-25
10684
 
4       2006-02-05
10685
 
-------------------------------------------------------------------------
10686
 
---  Alter tables with to_days(col1)-to_days('2006-01-01')
10687
 
-------------------------------------------------------------------------
10688
 
drop table if exists t11 ;
10689
 
drop table if exists t22 ;
10690
 
drop table if exists t33 ;
10691
 
drop table if exists t44 ;
10692
 
drop table if exists t55 ;
10693
 
drop table if exists t66 ;
10694
 
create table t11 engine='MYISAM' as select * from t1;
10695
 
create table t22 engine='MYISAM' as select * from t2;
10696
 
create table t33 engine='MYISAM' as select * from t3;
10697
 
create table t44 engine='MYISAM' as select * from t4;
10698
 
create table t55 engine='MYISAM' as select * from t5;
10699
 
create table t66 engine='MYISAM' as select * from t6;
10700
 
alter table t11
10701
 
partition by range(to_days(col1)-to_days('2006-01-01')) 
10702
 
(partition p0 values less than (15),
10703
 
partition p1 values less than maxvalue);
10704
 
alter table t22
10705
 
partition by list(to_days(col1)-to_days('2006-01-01')) 
10706
 
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
10707
 
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
10708
 
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
10709
 
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
10710
 
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
10711
 
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
10712
 
);
10713
 
alter table t33
10714
 
partition by hash(to_days(col1)-to_days('2006-01-01'));
10715
 
alter table t44
10716
 
partition by range(colint) 
10717
 
subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 2 
10718
 
(partition p0 values less than (15),
10719
 
partition p1 values less than maxvalue);
10720
 
alter table t55
10721
 
partition by list(colint)
10722
 
subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 2 
10723
 
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
10724
 
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
10725
 
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
10726
 
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
10727
 
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
10728
 
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
10729
 
);
10730
 
alter table t66
10731
 
partition by range(colint) 
10732
 
(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')),
10733
 
partition p1 values less than maxvalue);
10734
 
select * from t11 order by col1;
10735
 
col1
10736
 
2006-01-17
10737
 
2006-02-06
10738
 
select * from t22 order by col1;
10739
 
col1
10740
 
2006-01-17
10741
 
2006-01-25
10742
 
2006-02-06
10743
 
select * from t33 order by col1;
10744
 
col1
10745
 
2006-01-17
10746
 
2006-01-25
10747
 
2006-02-06
10748
 
select * from t44 order by colint;
10749
 
colint  col1
10750
 
1       2006-02-06
10751
 
2       2006-01-17
10752
 
3       2006-01-25
10753
 
4       2006-02-05
10754
 
select * from t55 order by colint;
10755
 
colint  col1
10756
 
1       2006-02-06
10757
 
2       2006-01-17
10758
 
3       2006-01-25
10759
 
4       2006-02-05
10760
 
select * from t66 order by colint;
10761
 
colint  col1
10762
 
1       2006-02-06
10763
 
2       2006-01-17
10764
 
3       2006-01-25
10765
 
4       2006-02-05
10766
 
---------------------------
10767
 
---- some alter table begin
10768
 
---------------------------
10769
 
alter table t11
10770
 
reorganize partition p0,p1 into
10771
 
(partition s1 values less than maxvalue);
10772
 
select * from t11 order by col1;
10773
 
col1
10774
 
2006-01-17
10775
 
2006-02-06
10776
 
alter table t11
10777
 
reorganize partition s1 into
10778
 
(partition p0 values less than (15),
10779
 
partition p1 values less than maxvalue);
10780
 
select * from t11 order by col1;
10781
 
col1
10782
 
2006-01-17
10783
 
2006-02-06
10784
 
alter table t55
10785
 
partition by list(colint)
10786
 
subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 5 
10787
 
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
10788
 
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
10789
 
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
10790
 
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
10791
 
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
10792
 
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
10793
 
);
10794
 
show create table t55;
10795
 
Table   Create Table
10796
 
t55     CREATE TABLE `t55` (
10797
 
  `colint` int(11) DEFAULT NULL,
10798
 
  `col1` date DEFAULT NULL
10799
 
) ENGINE=MyISAM DEFAULT CHARSET=latin1
10800
 
/*!50100 PARTITION BY LIST (colint)
10801
 
SUBPARTITION BY HASH (to_days(col1)-to_days('2006-01-01'))
10802
 
SUBPARTITIONS 5
10803
 
(PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM,
10804
 
 PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM,
10805
 
 PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM,
10806
 
 PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM,
10807
 
 PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM,
10808
 
 PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
10809
 
select * from t55 order by colint;
10810
 
colint  col1
10811
 
1       2006-02-06
10812
 
2       2006-01-17
10813
 
3       2006-01-25
10814
 
4       2006-02-05
10815
 
alter table t66
10816
 
reorganize partition p0,p1 into
10817
 
(partition s1 values less than maxvalue);
10818
 
select * from t66 order by colint;
10819
 
colint  col1
10820
 
1       2006-02-06
10821
 
2       2006-01-17
10822
 
3       2006-01-25
10823
 
4       2006-02-05
10824
 
alter table t66
10825
 
reorganize partition s1 into
10826
 
(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')),
10827
 
partition p1 values less than maxvalue);
10828
 
select * from t66 order by colint;
10829
 
colint  col1
10830
 
1       2006-02-06
10831
 
2       2006-01-17
10832
 
3       2006-01-25
10833
 
4       2006-02-05
10834
 
alter table t66
10835
 
reorganize partition p0,p1 into
10836
 
(partition s1 values less than maxvalue);
10837
 
select * from t66 order by colint;
10838
 
colint  col1
10839
 
1       2006-02-06
10840
 
2       2006-01-17
10841
 
3       2006-01-25
10842
 
4       2006-02-05
10843
 
alter table t66
10844
 
reorganize partition s1 into
10845
 
(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')),
10846
 
partition p1 values less than maxvalue);
10847
 
select * from t66 order by colint;
10848
 
colint  col1
10849
 
1       2006-02-06
10850
 
2       2006-01-17
10851
 
3       2006-01-25
10852
 
4       2006-02-05
10853
 
-------------------------------------------------------------------------
10854
 
---  Delete rows and partitions of tables with to_days(col1)-to_days('2006-01-01')
10855
 
-------------------------------------------------------------------------
10856
 
delete from t1 where col1='2006-01-17';
10857
 
delete from t2 where col1='2006-01-17';
10858
 
delete from t3 where col1='2006-01-17';
10859
 
delete from t4 where col1='2006-01-17';
10860
 
delete from t5 where col1='2006-01-17';
10861
 
delete from t6 where col1='2006-01-17';
10862
 
select * from t1 order by col1;
10863
 
col1
10864
 
2006-02-06
10865
 
select * from t2 order by col1;
10866
 
col1
10867
 
2006-01-25
10868
 
2006-02-06
10869
 
select * from t3 order by col1;
10870
 
col1
10871
 
2006-01-25
10872
 
2006-02-06
10873
 
select * from t4 order by colint;
10874
 
colint  col1
10875
 
1       2006-02-06
10876
 
3       2006-01-25
10877
 
4       2006-02-05
10878
 
select * from t5 order by colint;
10879
 
colint  col1
10880
 
1       2006-02-06
10881
 
3       2006-01-25
10882
 
4       2006-02-05
10883
 
insert into t1 values ('2006-01-17');
10884
 
insert into t2 values ('2006-01-17');
10885
 
insert into t3 values ('2006-01-17');
10886
 
insert into t4 values (60,'2006-01-17');
10887
 
insert into t5 values (60,'2006-01-17');
10888
 
insert into t6 values (60,'2006-01-17');
10889
 
select * from t1 order by col1;
10890
 
col1
10891
 
2006-01-17
10892
 
2006-02-06
10893
 
select * from t2 order by col1;
10894
 
col1
10895
 
2006-01-17
10896
 
2006-01-25
10897
 
2006-02-06
10898
 
select * from t3 order by col1;
10899
 
col1
10900
 
2006-01-17
10901
 
2006-01-25
10902
 
2006-02-06
10903
 
select * from t4 order by colint;
10904
 
colint  col1
10905
 
1       2006-02-06
10906
 
3       2006-01-25
10907
 
4       2006-02-05
10908
 
60      2006-01-17
10909
 
select * from t5 order by colint;
10910
 
colint  col1
10911
 
1       2006-02-06
10912
 
3       2006-01-25
10913
 
4       2006-02-05
10914
 
60      2006-01-17
10915
 
select * from t6 order by colint;
10916
 
colint  col1
10917
 
1       2006-02-06
10918
 
3       2006-01-25
10919
 
4       2006-02-05
10920
 
60      2006-01-17
10921
 
alter table t1 drop partition p0;
10922
 
alter table t2 drop partition p0;
10923
 
alter table t4 drop partition p0;
10924
 
alter table t5 drop partition p0;
10925
 
alter table t6 drop partition p0;
10926
 
select * from t1 order by col1;
10927
 
col1
10928
 
2006-01-17
10929
 
2006-02-06
10930
 
select * from t2 order by col1;
10931
 
col1
10932
 
2006-01-17
10933
 
2006-01-25
10934
 
2006-02-06
10935
 
select * from t3 order by col1;
10936
 
col1
10937
 
2006-01-17
10938
 
2006-01-25
10939
 
2006-02-06
10940
 
select * from t4 order by colint;
10941
 
colint  col1
10942
 
60      2006-01-17
10943
 
select * from t5 order by colint;
10944
 
colint  col1
10945
 
60      2006-01-17
10946
 
select * from t6 order by colint;
10947
 
colint  col1
10948
 
60      2006-01-17
10949
 
-------------------------------------------------------------------------
10950
 
---  Delete rows and partitions of tables with to_days(col1)-to_days('2006-01-01')
10951
 
-------------------------------------------------------------------------
10952
 
delete from t11 where col1='2006-01-17';
10953
 
delete from t22 where col1='2006-01-17';
10954
 
delete from t33 where col1='2006-01-17';
10955
 
delete from t44 where col1='2006-01-17';
10956
 
delete from t55 where col1='2006-01-17';
10957
 
delete from t66 where col1='2006-01-17';
10958
 
select * from t11 order by col1;
10959
 
col1
10960
 
2006-02-06
10961
 
select * from t22 order by col1;
10962
 
col1
10963
 
2006-01-25
10964
 
2006-02-06
10965
 
select * from t33 order by col1;
10966
 
col1
10967
 
2006-01-25
10968
 
2006-02-06
10969
 
select * from t44 order by colint;
10970
 
colint  col1
10971
 
1       2006-02-06
10972
 
3       2006-01-25
10973
 
4       2006-02-05
10974
 
select * from t55 order by colint;
10975
 
colint  col1
10976
 
1       2006-02-06
10977
 
3       2006-01-25
10978
 
4       2006-02-05
10979
 
insert into t11 values ('2006-01-17');
10980
 
insert into t22 values ('2006-01-17');
10981
 
insert into t33 values ('2006-01-17');
10982
 
insert into t44 values (60,'2006-01-17');
10983
 
insert into t55 values (60,'2006-01-17');
10984
 
insert into t66 values (60,'2006-01-17');
10985
 
select * from t11 order by col1;
10986
 
col1
10987
 
2006-01-17
10988
 
2006-02-06
10989
 
select * from t22 order by col1;
10990
 
col1
10991
 
2006-01-17
10992
 
2006-01-25
10993
 
2006-02-06
10994
 
select * from t33 order by col1;
10995
 
col1
10996
 
2006-01-17
10997
 
2006-01-25
10998
 
2006-02-06
10999
 
select * from t44 order by colint;
11000
 
colint  col1
11001
 
1       2006-02-06
11002
 
3       2006-01-25
11003
 
4       2006-02-05
11004
 
60      2006-01-17
11005
 
select * from t55 order by colint;
11006
 
colint  col1
11007
 
1       2006-02-06
11008
 
3       2006-01-25
11009
 
4       2006-02-05
11010
 
60      2006-01-17
11011
 
select * from t66 order by colint;
11012
 
colint  col1
11013
 
1       2006-02-06
11014
 
3       2006-01-25
11015
 
4       2006-02-05
11016
 
60      2006-01-17
11017
 
alter table t11 drop partition p0;
11018
 
alter table t22 drop partition p0;
11019
 
alter table t44 drop partition p0;
11020
 
alter table t55 drop partition p0;
11021
 
alter table t66 drop partition p0;
11022
 
select * from t11 order by col1;
11023
 
col1
11024
 
2006-01-17
11025
 
2006-02-06
11026
 
select * from t22 order by col1;
11027
 
col1
11028
 
2006-01-17
11029
 
2006-01-25
11030
 
2006-02-06
11031
 
select * from t33 order by col1;
11032
 
col1
11033
 
2006-01-17
11034
 
2006-01-25
11035
 
2006-02-06
11036
 
select * from t44 order by colint;
11037
 
colint  col1
11038
 
60      2006-01-17
11039
 
select * from t55 order by colint;
11040
 
colint  col1
11041
 
60      2006-01-17
11042
 
select * from t66 order by colint;
11043
 
colint  col1
11044
 
60      2006-01-17
11045
 
-------------------------
11046
 
---- some alter table end
11047
 
-------------------------
11048
 
drop table if exists t1 ;
11049
 
drop table if exists t2 ;
11050
 
drop table if exists t3 ;
11051
 
drop table if exists t4 ;
11052
 
drop table if exists t5 ;
11053
 
drop table if exists t6 ;
11054
 
drop table if exists t11 ;
11055
 
drop table if exists t22 ;
11056
 
drop table if exists t33 ;
11057
 
drop table if exists t44 ;
11058
 
drop table if exists t55 ;
11059
 
drop table if exists t66 ;
11060
 
-------------------------------------------------------------------------
11061
 
---  datediff(col1, '2006-01-01')  in partition with coltype  date
11062
 
-------------------------------------------------------------------------
11063
 
drop table if exists t1 ;
11064
 
drop table if exists t2 ;
11065
 
drop table if exists t3 ;
11066
 
drop table if exists t4 ;
11067
 
drop table if exists t5 ;
11068
 
drop table if exists t6 ;
11069
 
-------------------------------------------------------------------------
11070
 
---  Create tables with datediff(col1, '2006-01-01')
11071
 
-------------------------------------------------------------------------
11072
 
create table t1 (col1 date) engine='MYISAM' 
11073
 
partition by range(datediff(col1, '2006-01-01')) 
11074
 
(partition p0 values less than (15),
11075
 
partition p1 values less than maxvalue);
11076
 
create table t2 (col1 date) engine='MYISAM' 
11077
 
partition by list(datediff(col1, '2006-01-01')) 
11078
 
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
11079
 
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
11080
 
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
11081
 
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
11082
 
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
11083
 
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
11084
 
);
11085
 
create table t3 (col1 date) engine='MYISAM' 
11086
 
partition by hash(datediff(col1, '2006-01-01'));
11087
 
create table t4 (colint int, col1 date) engine='MYISAM' 
11088
 
partition by range(colint) 
11089
 
subpartition by hash(datediff(col1, '2006-01-01')) subpartitions 2 
11090
 
(partition p0 values less than (15),
11091
 
partition p1 values less than maxvalue);
11092
 
create table t5 (colint int, col1 date) engine='MYISAM' 
11093
 
partition by list(colint)
11094
 
subpartition by hash(datediff(col1, '2006-01-01')) subpartitions 2 
11095
 
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
11096
 
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
11097
 
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
11098
 
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
11099
 
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
11100
 
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
11101
 
);
11102
 
create table t6 (colint int, col1 date) engine='MYISAM' 
11103
 
partition by range(colint) 
11104
 
(partition p0 values less than (datediff('2006-02-02', '2006-01-01')),
11105
 
partition p1 values less than maxvalue);
11106
 
-------------------------------------------------------------------------
11107
 
---  Access tables with datediff(col1, '2006-01-01') 
11108
 
-------------------------------------------------------------------------
11109
 
insert into t1 values ('2006-02-03');
11110
 
insert into t1 values ('2006-01-17');
11111
 
insert into t2 values ('2006-02-03');
11112
 
insert into t2 values ('2006-01-17');
11113
 
insert into t2 values ('2006-01-25');
11114
 
insert into t3 values ('2006-02-03');
11115
 
insert into t3 values ('2006-01-17');
11116
 
insert into t3 values ('2006-01-25');
11117
 
load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4;
11118
 
load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5;
11119
 
load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6;
11120
 
select datediff(col1, '2006-01-01') from t1 order by col1;
11121
 
datediff(col1, '2006-01-01')
11122
 
16
11123
 
33
11124
 
select * from t1 order by col1;
11125
 
col1
11126
 
2006-01-17
11127
 
2006-02-03
11128
 
select * from t2 order by col1;
11129
 
col1
11130
 
2006-01-17
11131
 
2006-01-25
11132
 
2006-02-03
11133
 
select * from t3 order by col1;
11134
 
col1
11135
 
2006-01-17
11136
 
2006-01-25
11137
 
2006-02-03
11138
 
select * from t4 order by colint;
11139
 
colint  col1
11140
 
1       2006-02-03
11141
 
2       2006-01-17
11142
 
3       2006-01-25
11143
 
4       2006-02-05
11144
 
select * from t5 order by colint;
11145
 
colint  col1
11146
 
1       2006-02-03
11147
 
2       2006-01-17
11148
 
3       2006-01-25
11149
 
4       2006-02-05
11150
 
select * from t6 order by colint;
11151
 
colint  col1
11152
 
1       2006-02-03
11153
 
2       2006-01-17
11154
 
3       2006-01-25
11155
 
4       2006-02-05
11156
 
update t1 set col1='2006-02-06' where col1='2006-02-03';
11157
 
update t2 set col1='2006-02-06' where col1='2006-02-03';
11158
 
update t3 set col1='2006-02-06' where col1='2006-02-03';
11159
 
update t4 set col1='2006-02-06' where col1='2006-02-03';
11160
 
update t5 set col1='2006-02-06' where col1='2006-02-03';
11161
 
update t6 set col1='2006-02-06' where col1='2006-02-03';
11162
 
select * from t1 order by col1;
11163
 
col1
11164
 
2006-01-17
11165
 
2006-02-06
11166
 
select * from t2 order by col1;
11167
 
col1
11168
 
2006-01-17
11169
 
2006-01-25
11170
 
2006-02-06
11171
 
select * from t3 order by col1;
11172
 
col1
11173
 
2006-01-17
11174
 
2006-01-25
11175
 
2006-02-06
11176
 
select * from t4 order by colint;
11177
 
colint  col1
11178
 
1       2006-02-06
11179
 
2       2006-01-17
11180
 
3       2006-01-25
11181
 
4       2006-02-05
11182
 
select * from t5 order by colint;
11183
 
colint  col1
11184
 
1       2006-02-06
11185
 
2       2006-01-17
11186
 
3       2006-01-25
11187
 
4       2006-02-05
11188
 
select * from t6 order by colint;
11189
 
colint  col1
11190
 
1       2006-02-06
11191
 
2       2006-01-17
11192
 
3       2006-01-25
11193
 
4       2006-02-05
11194
 
-------------------------------------------------------------------------
11195
 
---  Alter tables with datediff(col1, '2006-01-01')
11196
 
-------------------------------------------------------------------------
11197
 
drop table if exists t11 ;
11198
 
drop table if exists t22 ;
11199
 
drop table if exists t33 ;
11200
 
drop table if exists t44 ;
11201
 
drop table if exists t55 ;
11202
 
drop table if exists t66 ;
11203
 
create table t11 engine='MYISAM' as select * from t1;
11204
 
create table t22 engine='MYISAM' as select * from t2;
11205
 
create table t33 engine='MYISAM' as select * from t3;
11206
 
create table t44 engine='MYISAM' as select * from t4;
11207
 
create table t55 engine='MYISAM' as select * from t5;
11208
 
create table t66 engine='MYISAM' as select * from t6;
11209
 
alter table t11
11210
 
partition by range(datediff(col1, '2006-01-01')) 
11211
 
(partition p0 values less than (15),
11212
 
partition p1 values less than maxvalue);
11213
 
alter table t22
11214
 
partition by list(datediff(col1, '2006-01-01')) 
11215
 
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
11216
 
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
11217
 
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
11218
 
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
11219
 
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
11220
 
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
11221
 
);
11222
 
alter table t33
11223
 
partition by hash(datediff(col1, '2006-01-01'));
11224
 
alter table t44
11225
 
partition by range(colint) 
11226
 
subpartition by hash(datediff(col1, '2006-01-01')) subpartitions 2 
11227
 
(partition p0 values less than (15),
11228
 
partition p1 values less than maxvalue);
11229
 
alter table t55
11230
 
partition by list(colint)
11231
 
subpartition by hash(datediff(col1, '2006-01-01')) subpartitions 2 
11232
 
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
11233
 
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
11234
 
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
11235
 
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
11236
 
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
11237
 
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
11238
 
);
11239
 
alter table t66
11240
 
partition by range(colint) 
11241
 
(partition p0 values less than (datediff('2006-02-02', '2006-01-01')),
11242
 
partition p1 values less than maxvalue);
11243
 
select * from t11 order by col1;
11244
 
col1
11245
 
2006-01-17
11246
 
2006-02-06
11247
 
select * from t22 order by col1;
11248
 
col1
11249
 
2006-01-17
11250
 
2006-01-25
11251
 
2006-02-06
11252
 
select * from t33 order by col1;
11253
 
col1
11254
 
2006-01-17
11255
 
2006-01-25
11256
 
2006-02-06
11257
 
select * from t44 order by colint;
11258
 
colint  col1
11259
 
1       2006-02-06
11260
 
2       2006-01-17
11261
 
3       2006-01-25
11262
 
4       2006-02-05
11263
 
select * from t55 order by colint;
11264
 
colint  col1
11265
 
1       2006-02-06
11266
 
2       2006-01-17
11267
 
3       2006-01-25
11268
 
4       2006-02-05
11269
 
select * from t66 order by colint;
11270
 
colint  col1
11271
 
1       2006-02-06
11272
 
2       2006-01-17
11273
 
3       2006-01-25
11274
 
4       2006-02-05
11275
 
---------------------------
11276
 
---- some alter table begin
11277
 
---------------------------
11278
 
alter table t11
11279
 
reorganize partition p0,p1 into
11280
 
(partition s1 values less than maxvalue);
11281
 
select * from t11 order by col1;
11282
 
col1
11283
 
2006-01-17
11284
 
2006-02-06
11285
 
alter table t11
11286
 
reorganize partition s1 into
11287
 
(partition p0 values less than (15),
11288
 
partition p1 values less than maxvalue);
11289
 
select * from t11 order by col1;
11290
 
col1
11291
 
2006-01-17
11292
 
2006-02-06
11293
 
alter table t55
11294
 
partition by list(colint)
11295
 
subpartition by hash(datediff(col1, '2006-01-01')) subpartitions 5 
11296
 
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
11297
 
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
11298
 
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
11299
 
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
11300
 
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
11301
 
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
11302
 
);
11303
 
show create table t55;
11304
 
Table   Create Table
11305
 
t55     CREATE TABLE `t55` (
11306
 
  `colint` int(11) DEFAULT NULL,
11307
 
  `col1` date DEFAULT NULL
11308
 
) ENGINE=MyISAM DEFAULT CHARSET=latin1
11309
 
/*!50100 PARTITION BY LIST (colint)
11310
 
SUBPARTITION BY HASH (datediff(col1, '2006-01-01'))
11311
 
SUBPARTITIONS 5
11312
 
(PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM,
11313
 
 PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM,
11314
 
 PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM,
11315
 
 PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM,
11316
 
 PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM,
11317
 
 PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
11318
 
select * from t55 order by colint;
11319
 
colint  col1
11320
 
1       2006-02-06
11321
 
2       2006-01-17
11322
 
3       2006-01-25
11323
 
4       2006-02-05
11324
 
alter table t66
11325
 
reorganize partition p0,p1 into
11326
 
(partition s1 values less than maxvalue);
11327
 
select * from t66 order by colint;
11328
 
colint  col1
11329
 
1       2006-02-06
11330
 
2       2006-01-17
11331
 
3       2006-01-25
11332
 
4       2006-02-05
11333
 
alter table t66
11334
 
reorganize partition s1 into
11335
 
(partition p0 values less than (datediff('2006-02-02', '2006-01-01')),
11336
 
partition p1 values less than maxvalue);
11337
 
select * from t66 order by colint;
11338
 
colint  col1
11339
 
1       2006-02-06
11340
 
2       2006-01-17
11341
 
3       2006-01-25
11342
 
4       2006-02-05
11343
 
alter table t66
11344
 
reorganize partition p0,p1 into
11345
 
(partition s1 values less than maxvalue);
11346
 
select * from t66 order by colint;
11347
 
colint  col1
11348
 
1       2006-02-06
11349
 
2       2006-01-17
11350
 
3       2006-01-25
11351
 
4       2006-02-05
11352
 
alter table t66
11353
 
reorganize partition s1 into
11354
 
(partition p0 values less than (datediff('2006-02-02', '2006-01-01')),
11355
 
partition p1 values less than maxvalue);
11356
 
select * from t66 order by colint;
11357
 
colint  col1
11358
 
1       2006-02-06
11359
 
2       2006-01-17
11360
 
3       2006-01-25
11361
 
4       2006-02-05
11362
 
-------------------------------------------------------------------------
11363
 
---  Delete rows and partitions of tables with datediff(col1, '2006-01-01')
11364
 
-------------------------------------------------------------------------
11365
 
delete from t1 where col1='2006-01-17';
11366
 
delete from t2 where col1='2006-01-17';
11367
 
delete from t3 where col1='2006-01-17';
11368
 
delete from t4 where col1='2006-01-17';
11369
 
delete from t5 where col1='2006-01-17';
11370
 
delete from t6 where col1='2006-01-17';
11371
 
select * from t1 order by col1;
11372
 
col1
11373
 
2006-02-06
11374
 
select * from t2 order by col1;
11375
 
col1
11376
 
2006-01-25
11377
 
2006-02-06
11378
 
select * from t3 order by col1;
11379
 
col1
11380
 
2006-01-25
11381
 
2006-02-06
11382
 
select * from t4 order by colint;
11383
 
colint  col1
11384
 
1       2006-02-06
11385
 
3       2006-01-25
11386
 
4       2006-02-05
11387
 
select * from t5 order by colint;
11388
 
colint  col1
11389
 
1       2006-02-06
11390
 
3       2006-01-25
11391
 
4       2006-02-05
11392
 
insert into t1 values ('2006-01-17');
11393
 
insert into t2 values ('2006-01-17');
11394
 
insert into t3 values ('2006-01-17');
11395
 
insert into t4 values (60,'2006-01-17');
11396
 
insert into t5 values (60,'2006-01-17');
11397
 
insert into t6 values (60,'2006-01-17');
11398
 
select * from t1 order by col1;
11399
 
col1
11400
 
2006-01-17
11401
 
2006-02-06
11402
 
select * from t2 order by col1;
11403
 
col1
11404
 
2006-01-17
11405
 
2006-01-25
11406
 
2006-02-06
11407
 
select * from t3 order by col1;
11408
 
col1
11409
 
2006-01-17
11410
 
2006-01-25
11411
 
2006-02-06
11412
 
select * from t4 order by colint;
11413
 
colint  col1
11414
 
1       2006-02-06
11415
 
3       2006-01-25
11416
 
4       2006-02-05
11417
 
60      2006-01-17
11418
 
select * from t5 order by colint;
11419
 
colint  col1
11420
 
1       2006-02-06
11421
 
3       2006-01-25
11422
 
4       2006-02-05
11423
 
60      2006-01-17
11424
 
select * from t6 order by colint;
11425
 
colint  col1
11426
 
1       2006-02-06
11427
 
3       2006-01-25
11428
 
4       2006-02-05
11429
 
60      2006-01-17
11430
 
alter table t1 drop partition p0;
11431
 
alter table t2 drop partition p0;
11432
 
alter table t4 drop partition p0;
11433
 
alter table t5 drop partition p0;
11434
 
alter table t6 drop partition p0;
11435
 
select * from t1 order by col1;
11436
 
col1
11437
 
2006-01-17
11438
 
2006-02-06
11439
 
select * from t2 order by col1;
11440
 
col1
11441
 
2006-01-17
11442
 
2006-01-25
11443
 
2006-02-06
11444
 
select * from t3 order by col1;
11445
 
col1
11446
 
2006-01-17
11447
 
2006-01-25
11448
 
2006-02-06
11449
 
select * from t4 order by colint;
11450
 
colint  col1
11451
 
60      2006-01-17
11452
 
select * from t5 order by colint;
11453
 
colint  col1
11454
 
60      2006-01-17
11455
 
select * from t6 order by colint;
11456
 
colint  col1
11457
 
60      2006-01-17
11458
 
-------------------------------------------------------------------------
11459
 
---  Delete rows and partitions of tables with datediff(col1, '2006-01-01')
11460
 
-------------------------------------------------------------------------
11461
 
delete from t11 where col1='2006-01-17';
11462
 
delete from t22 where col1='2006-01-17';
11463
 
delete from t33 where col1='2006-01-17';
11464
 
delete from t44 where col1='2006-01-17';
11465
 
delete from t55 where col1='2006-01-17';
11466
 
delete from t66 where col1='2006-01-17';
11467
 
select * from t11 order by col1;
11468
 
col1
11469
 
2006-02-06
11470
 
select * from t22 order by col1;
11471
 
col1
11472
 
2006-01-25
11473
 
2006-02-06
11474
 
select * from t33 order by col1;
11475
 
col1
11476
 
2006-01-25
11477
 
2006-02-06
11478
 
select * from t44 order by colint;
11479
 
colint  col1
11480
 
1       2006-02-06
11481
 
3       2006-01-25
11482
 
4       2006-02-05
11483
 
select * from t55 order by colint;
11484
 
colint  col1
11485
 
1       2006-02-06
11486
 
3       2006-01-25
11487
 
4       2006-02-05
11488
 
insert into t11 values ('2006-01-17');
11489
 
insert into t22 values ('2006-01-17');
11490
 
insert into t33 values ('2006-01-17');
11491
 
insert into t44 values (60,'2006-01-17');
11492
 
insert into t55 values (60,'2006-01-17');
11493
 
insert into t66 values (60,'2006-01-17');
11494
 
select * from t11 order by col1;
11495
 
col1
11496
 
2006-01-17
11497
 
2006-02-06
11498
 
select * from t22 order by col1;
11499
 
col1
11500
 
2006-01-17
11501
 
2006-01-25
11502
 
2006-02-06
11503
 
select * from t33 order by col1;
11504
 
col1
11505
 
2006-01-17
11506
 
2006-01-25
11507
 
2006-02-06
11508
 
select * from t44 order by colint;
11509
 
colint  col1
11510
 
1       2006-02-06
11511
 
3       2006-01-25
11512
 
4       2006-02-05
11513
 
60      2006-01-17
11514
 
select * from t55 order by colint;
11515
 
colint  col1
11516
 
1       2006-02-06
11517
 
3       2006-01-25
11518
 
4       2006-02-05
11519
 
60      2006-01-17
11520
 
select * from t66 order by colint;
11521
 
colint  col1
11522
 
1       2006-02-06
11523
 
3       2006-01-25
11524
 
4       2006-02-05
11525
 
60      2006-01-17
11526
 
alter table t11 drop partition p0;
11527
 
alter table t22 drop partition p0;
11528
 
alter table t44 drop partition p0;
11529
 
alter table t55 drop partition p0;
11530
 
alter table t66 drop partition p0;
11531
 
select * from t11 order by col1;
11532
 
col1
11533
 
2006-01-17
11534
 
2006-02-06
11535
 
select * from t22 order by col1;
11536
 
col1
11537
 
2006-01-17
11538
 
2006-01-25
11539
 
2006-02-06
11540
 
select * from t33 order by col1;
11541
 
col1
11542
 
2006-01-17
11543
 
2006-01-25
11544
 
2006-02-06
11545
 
select * from t44 order by colint;
11546
 
colint  col1
11547
 
60      2006-01-17
11548
 
select * from t55 order by colint;
11549
 
colint  col1
11550
 
60      2006-01-17
11551
 
select * from t66 order by colint;
11552
 
colint  col1
11553
 
60      2006-01-17
11554
 
-------------------------
11555
 
---- some alter table end
11556
 
-------------------------
11557
 
drop table if exists t1 ;
11558
 
drop table if exists t2 ;
11559
 
drop table if exists t3 ;
11560
 
drop table if exists t4 ;
11561
 
drop table if exists t5 ;
11562
 
drop table if exists t6 ;
11563
 
drop table if exists t11 ;
11564
 
drop table if exists t22 ;
11565
 
drop table if exists t33 ;
11566
 
drop table if exists t44 ;
11567
 
drop table if exists t55 ;
11568
 
drop table if exists t66 ;
11569
 
-------------------------------------------------------------------------
11570
9526
---  weekday(col1)  in partition with coltype  date
11571
9527
-------------------------------------------------------------------------
11572
9528
drop table if exists t1 ;