Subject Re: [firebird-support] Re: Maintaining proper generator values
Author Doug Chamberlin
At 11/12/2003 04:36 AM (Wednesday), Svein Erling wrote:
>Doug, I see that your approach is pretty safe, but
>
>SET <GeneratorName> TO <Max+20>
>
>still has a small, theoretical chance of creating problems, whereas
>
>GEN_ID(<GeneratorName>, <Max-PreviousGeneratorValue>)
>
>should always be safe provided PreviousGeneratorValue is less than or
>equal to Max (well, up to the maximum value a generator can hold).

I see that. Will use it in next project, for sure.

(I assume that even in a stored procedure the short interval between
obtaining the PreviousGeneratorValue and resetting it via GEN_ID() might
theoretically be unsafe but insignificantly so. In any event it looks like
the best we can accomplish with the tools at hand.)