Search Postgresql Archives

Re: Trigger that spawns forked process

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Christopher Murtagh <christopher.murtagh@xxxxxxxxx> 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

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux