Re: Before/After trigger sequencing questiont

Поиск
Список
Период
Сортировка
От Pierre-Frédéric Caillaud
Тема Re: Before/After trigger sequencing questiont
Дата
Msg-id opsbug4srgcq72hf@musicbox
обсуждение исходный текст
Ответ на Re: Before/After trigger sequencing questiont  (Mike Nolan <nolan@gw.tssi.com>)
Список 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 по дате отправления:

Предыдущее
От: Michael Glaesemann
Дата:
Сообщение: Re: Everlasting SQL query
Следующее
От: Pierre-Frédéric Caillaud
Дата:
Сообщение: Re: altering a table to set serial function