Re: Before/After trigger sequencing questiont
От | Mike Nolan |
---|---|
Тема | Re: Before/After trigger sequencing questiont |
Дата | |
Msg-id | 200407280732.i6S7WKbM004075@gw.tssi.com обсуждение исходный текст |
Ответ на | Re: Before/After trigger sequencing question (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: Before/After trigger sequencing questiont
Re: Before/After trigger sequencing questiont |
Список | pgsql-general |
> 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
В списке pgsql-general по дате отправления: