MySQL Forums
Forum List  »  Partitioning

Re: MySQL Partitioning with non integer values using triggers
Posted by: Rick James
Date: September 20, 2009 03:47PM

Clever trick. But there are some issues:

1.
mysql> INSERT INTO userbs (user_id, username)
-> VALUES (5, 'Zoe');
ERROR 1526 (HY000): Table has no partition for value 122
Recommend: PARTITION p3 VALUES LESS THAN (MAXVALUE) #through z (and more)

2. In some MySQL versions, the missing 'dummy' value will cause
ERROR 1364 (HY000): Field 'dummy' doesn't have a default value
Workaround: dummy INT NULL, -- instead of NOT NULL
(One could argue that this is a bug.)

This, together with the trigger, happens to ensure uniqueness of username:
UNIQUE KEY username(username, dummy)

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: MySQL Partitioning with non integer values using triggers
2874
September 20, 2009 03:47PM


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.