Bug #32769 Table partition clause not working in create table statement
Submitted: 27 Nov 2007 13:43 Modified: 28 Nov 2007 4:34
Reporter: Gunwant walbe Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Partitions Severity:S3 (Non-critical)
Version:5.1.22 OS:Windows (Windows Xp development machine)
Assigned to: CPU Architecture:Any

[27 Nov 2007 13:43] Gunwant walbe
Description:
Hi ,

I am working on mannual partition of tables.
While creating a table with partition clause , I get an error.

I am using MySql Community Version 5.1.22 on windos xp development machine(32 bit)

The create table script is:

create table `customers`(
 
`CustomerID` varchar(40) not null,
`TimeCreated`  DATETIME  not null default 0,
`TimeModified` datetime not null default 0, 
`isActive`     char(1) not null default 'A',      /* A--Active, I--Inactive*/
`CompanyName`   varchar(100) not null,  
`CompanyDesc`   varchar(200),
`FirstName`      varchar(20) not null,
`MiddleName`     varchar(20) ,
`LastName`       varchar(20) not null,
`FullName`       varchar(30) not null,
`BillAddressAddr`   varchar(300) not null,
`BillAddressCity`    varchar(30) not null,
`BillAddressState`   varchar(30) not null,
`BillAddressPostalCode` varchar(10) not null,
`BillAddressCountry`    varchar(20) not null,
`shipaddress`           varchar(300) not null,
`ShipAddressCity`      varchar(20) not null,
`ShipAddressState`     varchar(20) not null,
`ShipAddressCounty`    varchar(30) not null,
`ShipAddressPostalCode` varchar(10)not null,
`Phone`                varchar(20) not null,
`altPhone`             varchar(20) not null default '0',
`Fax`                 varchar(20) not null default '0',
`email`               varchar(50) not null,
`CreditCardInfoCreditCardNumber`  VARCHAR (25) not null default '0',
`CreditCardInfoExpirationMonth`   INTEGER  not null default 0,
`CreditCardInfoExpirationYear`    INTEGER not null default 0,
`CreditCardInfoNameOnCard`        varchar(50) not null,
`CreditCardInfoCreditCardAddress`  varchar(50)not null,
`CreditCardPostalCode` varchar(10) not null,
`Notes`     varchar(4000) not null DEFAULT '',
PRIMARY KEY(`CustomerID`)

)ENGINE=InnoDB 

PARTITION BY RANGE ( YEAR(TimeCreated) ) (
    PARTITION p0 VALUES LESS THAN (2007),
    PARTITION p1 VALUES LESS THAN (2008),
    PARTITION p2 VALUES LESS THAN (2009),
);

the error message is:

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near ')' at
 line 40

while the same script is working when i remove the partition clause.

How to repeat:
Run this script 

create table `customers`(
 
`CustomerID` varchar(40) not null,
`TimeCreated`  DATETIME  not null default 0,
`TimeModified` datetime not null default 0, 
`isActive`     char(1) not null default 'A',      /* A--Active, I--Inactive*/
`CompanyName`   varchar(100) not null,  
`CompanyDesc`   varchar(200),
`FirstName`      varchar(20) not null,
`MiddleName`     varchar(20) ,
`LastName`       varchar(20) not null,
`FullName`       varchar(30) not null,
`BillAddressAddr`   varchar(300) not null,
`BillAddressCity`    varchar(30) not null,
`BillAddressState`   varchar(30) not null,
`BillAddressPostalCode` varchar(10) not null,
`BillAddressCountry`    varchar(20) not null,
`shipaddress`           varchar(300) not null,
`ShipAddressCity`      varchar(20) not null,
`ShipAddressState`     varchar(20) not null,
`ShipAddressCounty`    varchar(30) not null,
`ShipAddressPostalCode` varchar(10)not null,
`Phone`                varchar(20) not null,
`altPhone`             varchar(20) not null default '0',
`Fax`                 varchar(20) not null default '0',
`email`               varchar(50) not null,
`CreditCardInfoCreditCardNumber`  VARCHAR (25) not null default '0',
`CreditCardInfoExpirationMonth`   INTEGER  not null default 0,
`CreditCardInfoExpirationYear`    INTEGER not null default 0,
`CreditCardInfoNameOnCard`        varchar(50) not null,
`CreditCardInfoCreditCardAddress`  varchar(50)not null,
`CreditCardPostalCode` varchar(10) not null,
`Notes`     varchar(4000) not null DEFAULT '',
PRIMARY KEY(`CustomerID`)

)ENGINE=InnoDB 

PARTITION BY RANGE ( YEAR(TimeCreated) ) (
    PARTITION p0 VALUES LESS THAN (2007),
    PARTITION p1 VALUES LESS THAN (2008),
    PARTITION p2 VALUES LESS THAN (2009),
);
[27 Nov 2007 20:15] MySQL Verification Team
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://dev.mysql.com/doc/ and the instructions on
how to report a bug at http://bugs.mysql.com/how-to-report.php

   PARTITION p2 VALUES LESS THAN (2009), <------ extra comma
);
[28 Nov 2007 4:34] Gunwant walbe
Resolved 

My mistake
thanks