MySQL Forums
Forum List  »  Partitioning

Re: Add Partition with Subpartitions
Posted by: Mikael Ronström
Date: July 27, 2006 12:44PM

Hi,
Syntax is correct, the failure is due to bug #19067. This bug was
fixed and pushed to the 5.1 tree in the beginning of June so will
appear in the 5.1.12 release and is already available if you download
the latest 5.1 source.

Rgrds Mikael


Mike Gent Wrote:
-------------------------------------------------------
> I have a table that I can add and delete
> partitions:
>
> CREATE TABLE `AH1` (
> `ID` bigint(20) unsigned NOT NULL,
> `Summary` text NOT NULL,
> `Reported` int(10) unsigned NOT NULL
> ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1
> PARTITION BY RANGE
> (TO_DAYS(FROM_UNIXTIME(Reported)))
> (
> PARTITION p20060701 VALUES LESS THAN
> (TO_DAYS('2006-07-02 00:00:00')),
> PARTITION p20060702 VALUES LESS THAN
> (TO_DAYS('2006-07-03 00:00:00')),
> PARTITION p20060703 VALUES LESS THAN
> (TO_DAYS('2006-07-04 00:00:00')),
> PARTITION p20060704 VALUES LESS THAN
> (TO_DAYS('2006-07-05 00:00:00'))
> );
>
> Both the add and delete functions work as
> expected:
>
> ALTER TABLE AH1 DROP PARTITION p20060701;
> ALTER TABLE AH1 ADD PARTITION (PARTITION p20060705
> VALUES LESS THAN (TO_DAYS('2006-07-06
> 00:00:00')));
>
> If I have another table partitioned the same, but
> also includes subpartitions:
>
> CREATE TABLE `AH2` (
> `ID` bigint(20) unsigned NOT NULL,
> `Summary` text NOT NULL,
> `Reported` int(10) unsigned NOT NULL
> ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1
> PARTITION BY RANGE
> (TO_DAYS(FROM_UNIXTIME(Reported)))
> SUBPARTITION BY KEY (ID)
> SUBPARTITIONS 5 (
> PARTITION p20060701 VALUES LESS THAN
> (TO_DAYS('2006-07-02 00:00:00')),
> PARTITION p20060702 VALUES LESS THAN
> (TO_DAYS('2006-07-03 00:00:00')),
> PARTITION p20060703 VALUES LESS THAN
> (TO_DAYS('2006-07-04 00:00:00')),
> PARTITION p20060704 VALUES LESS THAN
> (TO_DAYS('2006-07-05 00:00:00'))
> );
>
> Deleting a partition works:
>
> ALTER TABLE AH2 DROP PARTITION p20060701;
>
> Adding a new partition crashes MySQL:
>
> ALTER TABLE AH2 ADD PARTITION (PARTITION p20060705
> VALUES LESS THAN (TO_DAYS('2006-07-06
> 00:00:00')));
>
>
> This is definately a bug in that the database
> crashes, but I need to know if this is still the
> correct syntax. Running 5.1.11 on Windows.

Mikael Ronstrom
Senior Software Architect, MySQL AB
My blog: http://mikaelronstrom.blogspot.com

Options: ReplyQuote


Subject
Views
Written By
Posted
5754
July 27, 2006 09:49AM
Re: Add Partition with Subpartitions
2772
July 27, 2006 12:44PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.