Subject | RE: [firebird-support] Transaction Context and Triggers |
---|---|
Author | Alan McDonald |
Post date | 2006-03-30T09:32:59Z |
> Alan McDonald wrote:put it this way: several table inserts have the same after insert trigger
>
> > 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?
which inserts a record into the one log table.
genrators are outside T context so I have assumed (?) that whichever trigger
fires first will get the next gen value.
So: insert into table1, after insert trigger inserts into logtable, insert
into table2, after insert trigger inserts into logtable.
I always expect the log table to receive the records created by after insert
triggers in THAT order. But I have seen the log entry for table2 insert get
a lower gen value (in the logtable) than the insert into table1. This argues
that the after insert trigger on table2 fired BEFORE after insert trigger on
table1. How can this be?
>yep - windows Server NT4 Firebird 1.5.3
> > 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.
>
Alan
> --
> Lester Caine - G8HFL
> -----------------------------
> L.S.Caine Electronic Services
> Treasurer - Firebird Foundation Inc.
>
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Visit http://firebird.sourceforge.net and click the Resources item
> on the main (top) menu. Try Knowledgebase and FAQ links !
>
> Also search the knowledgebases at http://www.ibphoenix.com
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Yahoo! Groups Links
>
>
>
>
>
>
>