From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Christopher Murtagh <christopher(dot)murtagh(at)mcgill(dot)ca> |
Cc: | Martijn van Oosterhout <kleptog(at)svana(dot)org>, "Jim C(dot) Nasby" <decibel(at)decibel(dot)org>, Douglas McNaught <doug(at)mcnaught(dot)org>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Trigger that spawns forked process |
Date: | 2005-05-11 18:44:56 |
Message-ID: | 13860.1115837096@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Christopher Murtagh <christopher(dot)murtagh(at)mcgill(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Douglas McNaught | 2005-05-11 18:51:12 | Re: [GENERAL] Storing database in WORM devices |
Previous Message | Ruben Oliveira | 2005-05-11 18:39:27 | Re: UPDATE Inserts New Rows |