MySQL Forums
Forum List  »  Partitioning

Bug or wrong syntax? Partitioning tables with primary keys AND unique indexes (err: #1482)
Posted by: Brian Lucas
Date: April 20, 2006 05:22PM

I'm attempting to partition a table by primary key. This table also contains a unique index which is seperate from the primary key as well.

When attempting to partition, I get the following error:

-------
ALTER TABLE urls PARTITION BY RANGE(id)(
PARTITION p0 VALUES LESS THAN( 200000 )
...
)

ERROR:
#1481 - A UNIQUE INDEX need to include all fields in the partition function
--------

However, if I convert the unique index to regular index, I can partition the table just fine.

Attempting to convert the index back to unique results in the following error:

ALTER TABLE `urls` DROP INDEX `hash` ,
ADD UNIQUE `hash` ( `canon` ( 24 ) , `path` ( 24 ) )

MySQL said: Documentation
#1481 - A UNIQUE INDEX need to include all fields in the partition function

How do I partition a table by a primary key and still make it have a unique index as well?



Edited 1 time(s). Last edit at 04/20/2006 05:24PM by Brian Lucas.

Options: ReplyQuote


Subject
Views
Written By
Posted
Bug or wrong syntax? Partitioning tables with primary keys AND unique indexes (err: #1482)
3539
April 20, 2006 05:22PM


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.