Hi, I've continued trying to solve the problem that I emailed yesterday regarding AUTO_INCREMENT, and I just seem to be going backwards.
The sample database/software that I sent yesterday had a UNIQUE constraint and a couple of SELECT statements. I thought that removing them bizarrely made it all work, but it turns out that it doesn't -- it just takes longer to fail! I've now reduced the problem to the following simple database/program: ------------------------------ CREATE DATABASE test; CREATE TABLE foo ( id INT NOT NULL AUTO_INCREMENT, num INT, str VARCHAR(10), PRIMARY KEY (id) ) TYPE=BDB; ------------------------------ ------------------------------ use strict; use warnings; use DBI; my $dbh = DBI->connect( 'dbi:mysql:test', 'root', '', {AutoCommit => 0, PrintError => 0, RaiseError => 1} ); for (my $deadlocks = 0, my $total = 0, my $i = 1; $i <= 50000; $i++) { $total++; eval { $dbh->do("INSERT INTO foo (num, str) VALUES (1, 'a')"); $dbh->commit(); }; if ($@) { if ($DBI::err == 1213) { $deadlocks++; print "$total: $i: $$: Deadlock! ($deadlocks)\n"; eval { $dbh->rollback(); }; if ($@) { print "Rollback Error! ($@)\n"; last; } redo; } else { print "$total: $i: $$: Error! ($@)\n"; last; } } else { $deadlocks = 0; print "$total: $i: $$: Success!\n"; } } $dbh->disconnect(); ------------------------------ If I run two of these program simultaneously then one of them always exits before the 50,000 iterations are up with the error: Duplicate entry '1' for key 1 Can anybody help explain why? This looks like a bug to me. - Steve --------------------------------------------------------------------- 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