> > 2) Make a CHAR (or VARCHAR) AUTO_INCREMENT column with mandatory > > PREFIX. MySQL would then assign values that start with the prefix, > > followed by a sequential number. > > This works already for MyISAM and BDB tables. From the manual: > > CREATE TABLE animals ( > grp ENUM('fish','mammal','bird') NOT NULL, > id MEDIUMINT NOT NULL AUTO_INCREMENT, > name CHAR(30) NOT NULL, > PRIMARY KEY (grp,id) > );
Yes, I know that an index key can span multiple columns. (Does that not work for InnoDB, as you seem to suggest?) But that is not the solution that I seek because of one thing: this would require a careful examination of current code and a change of each and every query that works with the table in question. Imagine how easily one could forget to change DELETE FROM table WHERE id=$ID into DELETE FROM table WHERE id=$ID AND prefix='$prefix' I would have to find every SELECT that uses the table in JOIN, FROM or WHERE, every INSERT, UPDATE, DELETE and REPLACE and even the logic in the scripts that glue these together. I believe that the usefulness of the proposed featureis significant: the transition from single-server to master-master replication would be nearly transparent, with only a slight change of the db schema but no change of program code! Vaclav Dvorak [EMAIL PROTECTED] IDAS, s.r.o. http://www.idas.cz --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php