Subject Re: [IBO] Re: Autoinc field value unknown after insert+post+commit
Author Aage Johansen
jrp_public wrote:
> ...
> The story
> =========
> I noticed that when I do an insert, IBO increments the generator
> value on the server. If I cancel the insert, the increment of
> generator value does not cancelled, so I end up with a skipped number
> each time I cancel.
>
> It looks like the increment of the generator value happens outside my
> transaction, since I also can't undo the increment with a rollback.

Not only "looks like", but is "as designed".

Consider a generator (X) with a value of 10.
Transaction A asks for a new number from X, and gets 11.
Transaction B asks for a new number from X, and gets 12.
Transaction A is rolled back.
Transaction C asks for a new number from X, which number should this be?

We will, of course, get 13. And 11 is lost. And, yes, it must be so.


See the article that P.V. refers to.


--
Aage J.