Subject Re: [firebird-support] Transaction Context and Triggers
Author Lester Caine
Alan McDonald wrote:

> I have tables with foreign keys into other tables.
> In the context of one transaction:
> 1. insert into master
> after insert trigger to insert into a log table
> 2. insert into child with PK of master
> after insert trigger to insert into a log table
> commit transaction
>
> now - up til now, the sequence of insertion into the log table has reflected
> the above sequence. If I order by the log table PK I see this same sequence.
>
> but recently I see that it is possible to get the insertion into the log
> table out of this sequence so the log table records an insertion to the
> child sometimes before it records an insertion into the parent. This reverse
> sequence is obviously not possible into the child first since it would
> (does) raise an FK exception.

By that do you mean that the generator values used for the master and
slave log entries are the wrong way round?

> Q: am I crazy - seeing things?, OR is there never any guarantee of this
> seqence within the context of the same transaction and I've been lucky up to
> now, OR is there a way of ensuring this sequence somehow that I'm not aware
> of?

Knowing how 'crass' windows is at actually handling 'windows message'
order, the next question has to be what versions of OS and Firebird.
I've seen similar problems with windows 'events' so I know that you are
not seeing things, but it would help to know where the fault may lie.

--
Lester Caine - G8HFL
-----------------------------
L.S.Caine Electronic Services
Treasurer - Firebird Foundation Inc.