Re: Trigger that spawns forked process

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Trigger that spawns forked process
Дата
Msg-id 13860.1115837096@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Trigger that spawns forked process  (Christopher Murtagh <christopher.murtagh@mcgill.ca>)
Список pgsql-general
Christopher Murtagh <christopher.murtagh@mcgill.ca> writes:
> So, if I made a slight modification to my script to this instead:

> CREATE or REPLACE function exec_test() returns void as '
> unless (defined ($pid=fork)) {
>      die "cannot fork: $!";
> }
> unless ($pid) {
>      $cmd="/path/to/some/script.pl";
>      exec "$cmd";
> }
> RETURN;
> ' language plperlu;

>  Is this less objectionable?

Well, it's better, but you need to think about what happens if the exec
fails (eg, script is not where you thought).  Does plperl let you get at
abort(), or some other way of terminating the process other than exit()?

There still remains the point that this violates transaction semantics,
in that an aborted transaction may still have caused things to happen
outside the database.

            regards, tom lane

В списке pgsql-general по дате отправления:

Предыдущее
От: Ruben Oliveira
Дата:
Сообщение: Re: UPDATE Inserts New Rows
Следующее
От: Douglas McNaught
Дата:
Сообщение: Re: Storing database in WORM devices