Re: Before/After trigger sequencing questiont - Mailing list pgsql-general

From Pierre-Frédéric Caillaud
Subject Re: Before/After trigger sequencing questiont
Date
Msg-id opsbug4srgcq72hf@musicbox
Whole thread Raw
In response to Re: Before/After trigger sequencing questiont  (Mike Nolan <nolan@gw.tssi.com>)
List pgsql-general
    I think you're right : the transaction which updated the rows is not
commited yet when you call your external php procedure, and thus it does
not see the updated rows.

    This is tricky because you can't commit in a plsql function.

    You could add the emails to be sent to a table, which would be looked up
by a cron task sending emails and deleting the records afterwards.

    You could have your perl function (which runs inside your transaction)
pass the data tot the PHP script.

    You could also send your email from Perl.

> 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
>
> ---------------------------(end of broadcast)---------------------------
> TIP 8: explain analyze is your friend
>



pgsql-general by date:

Previous
From: Michael Glaesemann
Date:
Subject: Re: Everlasting SQL query
Next
From: Pierre-Frédéric Caillaud
Date:
Subject: Re: altering a table to set serial function