In the last episode (Jul 22), Joπo CΓndido de Souza Neto said:
> I've getting something wrong in transaction in Mysql 5.0.22 on
> windows that i don't know way it's happen.
> I've got a script in php which starts a transaction and when if fails
> and rollbacks, the autoincrement do not back.
> If in transaction some field auto increment gets the value 4 and this
> transaction fails, in the next transaction it gets the value 5.
The autoincrement value is metadata outside of any table values and is
not subject to transaction rollback. Consider the case where you
insert one row in each of two separate connections, getting, say,
values 4 and 5. Then you rollback the first one. The autoincrement
counter is now at 6 and you're never going to get another 4. I guess
mysql could decrement the autoincrement counter if only one new row has
been reserved but not committed, but that's a lot of work for little