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