Re: C functions, arguments, and ssh oh my!

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Joel Dudley <Joel.Dudley@DevelopOnline.com>
Cc: "'pgsql-general@postgresql.org'" <pgsql-general@postgresql.org>
Date: 2001-03-27T19:51:40Z
Lists: 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