Subject Re: [firebird-support] Re: Some feedback of my 2.5 experience
Author Ann Harrison
On Fri, Jun 3, 2011 at 6:56 AM, technisoft2005
<preber@...> wrote:
>
>>
>> >>  IF (NEW.ID IS NULL) THEN
>> >>    NEW.ID = GEN_ID(GEN_CUSTOMERINCIDENTS_ID,0);
>>
>> >Should be
>> >IF (NEW.ID IS NULL) THEN
>> >    NEW.ID = GEN_ID(GEN_CUSTOMERINCIDENTS_ID,1);
>>

> Be careful, this might just be 'valid' code. Think of a 2 table setup where there is a one-to-one relationship. Table A gets the ID from the generator, incrementing it, Table B inserts using the same ID to link to table A.

> Of course this would be dangerous in a multi-user situation and depends on the insertion sequence, but if the operattions on table A are serialized it might just work without causing any problems.

"Just might work" is a low standard, and I would qualify "without
causing any problems"
with "until the next person working on the code forgets that it
depends on an unreliable
mechanism." In short, find some other way to pass the key from one
insert to the next.
Don't count on generator stabilty.

Good luck,

Ann