Re: C functions, arguments, and ssh oh my! - Mailing list pgsql-general

From Tom Lane
Subject Re: C functions, arguments, and ssh oh my!
Date
Msg-id 14952.985722700@sss.pgh.pa.us
Whole thread Raw
In response to C functions, arguments, and ssh oh my!  (Joel Dudley <Joel.Dudley@DevelopOnline.com>)
List pgsql-general
Joel Dudley <Joel.Dudley@DevelopOnline.com> writes:
> what it does with those is builds a command string for an external app that
> is called with system() and exits 0. I know this is strange and ugly but I
> need to trigger this external app when an insert is made into a user table.

This seems an extremely dubious practice.  If the transaction doing the
insert is later rolled back, the insert effectively never happened ---
but the effects of your external app will still be there.  I'd suggest
thinking twice about your whole system design, if it requires this.

You can mitigate the problem a little bit by making the trigger an
AFTER trigger, so that it's only fired when we are about to commit the
transaction.  But there's still a possibility of trouble if a later
AFTER trigger decides to abort.

            regards, tom lane

pgsql-general by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: C functions, arguments, and ssh oh my!
Next
From: Hunter Hillegas
Date:
Subject: Logging Queries