Subject Re: Call external program with trigger
Author Adam
--- In, Jocelyn Bernier
<jbernier@...> wrote:
> I know this must have been a question asked many times but couldn't
> the answer on the net. I would like to know if it is possible to
call an
> external program with trigger ?

Yes it is possible, but it is usually a bad idea.

An external function can be written in your language of choice and
compiled to a .dll or .so file. These functions should be lightweight
and must be threadsafe. You can declare them in your database, after
which time you can call them from normal queries or PSQL (triggers or

There is no technical reason that an external function could not call
an appropriate API call on the host OS to launch a process, but it is
a can of worms IMO. You need to consider resources and performance.
You need to consider stability. You need to consider security. You
need to realise this is using a feature in a way that is normally
discouraged and therefore understand it may change in the future.