MySQL Forums
Forum List  »  Newbie

AUTO_INCREMENT follow max column value
Posted by: loskutak007
Date: August 26, 2004 09:42AM

I have reached troubles with tables with auto incrementing primary keys.
I have two databases, each on different location. On both have same
structure. Users can add new records on both places.
I need to synchronise both database content, but for some reasons
dont want to use MySQL replication tools. (The reasons are serious,
but not place there to metion)

To recognize which records was added on which place, I set AUTO_INCREMENT
values to start with some offset. Assume, I have table with BIGINT primary key
column, so on first location the auto_increment starts from 1 and on the second location starts from 1000000000. In fact I cannot reach this value on first place,
so its safe solution for me.

But trouble occurs, when I import rows from second location to first location,
then there was row with primary key=1000000001 and
then auto_increment value was changed to max(primary_key)+1.

Is there any way to change this MySQL behavior and keep auto_increment
value to follow simple +1 incrementing algoritm without determining current
primary key max value?

Thanks for any response.
Tomas Polak

Options: ReplyQuote

Written By
AUTO_INCREMENT follow max column value
August 26, 2004 09:42AM

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.