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),
);