> Mike Nolan <nolan@gw.tssi.com> writes:
> > I have a before insert trigger that updates a value in another table.
>
> > It appears that I cannot depend upon that update having taken place
> > in an after insert trigger on the first table. (The one with the insert.)
>
> This seems a tad improbable, not to say impossible. Concrete example,
> please?
I can't reproduce it using a simple example, but here's the sequence
of events that happened this morning (on 7.4.1):
1. A record was inserted into a table with about a million rows in it.
2. This insert triggered a before insert procedure that updated several
values in a second table, one with about 580,000 rows in it.
(This was via several different update statements in the trigger
function.)
3. The 'after insert' trigger on the first table calls another procedure
using plperlu which in turn executes an external PHP program that
does a lookup on the 2nd table (using one of the updated values as
a key) then sends some e-mail. It didn't find the record with the
updated value.
In thinking it through while typing typing this note, I think the problem
is that the external PHP program doesn't see record with the updated value
yet because the transaction hasn't been completed.
--
Mike Nolan