Subject | Re: [firebird-support] Generators |
---|---|
Author | Woody (TMW) |
Post date | 2003-10-11T23:51Z |
> Why a generator doesn't respect transactions?"select
>
> select gen_id(gen1, 1) from table1;
> 1
> select gen_id(gen1, 1) from table1;
> 2
> select gen_id(gen1, 1) from table1;
> 3
> ROLLBACK;
> select gen_id(gen1, 1) from table1;
> 4
> select gen_id(gen1, 1) from table1;
> 5
>
> Doesn't have to be a 1 instead of a 4?
> I'm thinking about producing the unique value for a primary key with
> max(...) + 1 from..."... i know it's not a good idea for eficiency... butit
> works, not?Generators are transaction independent. They provide unique numbers for a
reason. If you need an audible set of numbers, then search for some
algorithms and ideas. There are papers written about them.
Woody (TMW)
Freeware Page: http://users.eonet.net/woodytmw
All computers wait at the same speed.