List:General Discussion« Previous MessageNext Message »
From:Thimble Smith Date:October 7 1999 3:06am
Subject:Re: double entry on autoincrement field !!!
View as plain text  
At 22:31, 19991006, Werner Stuerenburg wrote:
>I have a table:
>
>CREATE TABLE pferde (
>  id mediumint(8) unsigned DEFAULT '0' NOT NULL auto_increment,
>[...]
>
>On each entry, I receive an email with the data. Today, I get:
>
>           Pferd-Id: 274, Rheinländer angelegt von kid: 405
>           Pferd-Id: 274, Deutsches Reitpony angelegt von kid: 404

Is it possible that Rheinländer was added and then removed right away,
and then Deutsches Reitpony was added next, and you are using MySQL
version 3.22 or earlier?

If so, then that is what happened.  In MySQL 3.22 and earlier, the
auto_increment id is always MAX(id)+1.  So if you delete the row
with the highest id, then its id will be re-used.

MySQL version 3.23 does not re-use auto_increment values, so then you
could be sure that the same id would not be issued twice.

Tim
Thread
double entry on autoincrement field !!!Werner Stuerenburg7 Oct
  • Re: double entry on autoincrement field !!!Thimble Smith7 Oct
  • Re: double entry on autoincrement field !!!Werner Stuerenburg7 Oct
  • Re: double entry on autoincrement field !!!Werner Stuerenburg7 Oct