Re: Where is PLbash ?? - Mailing list pgsql-interfaces

From Tom Lane
Subject Re: Where is PLbash ??
Date
Msg-id 11192.1025042503@sss.pgh.pa.us
Whole thread Raw
In response to Re: Where is PLbash ??  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: Where is PLbash ??  (alex@pilosoft.com)
List pgsql-interfaces
Peter Eisentraut <peter_e@gmx.net> writes:
> What is the preferred way to implement non-database side effects, such as
> triggering emails when certain events occur?  We should try to explain
> this somewhere.
> Certainly, PL/sh is not the preferred way.  It's terribly inefficient and
> not nearly portable.

As Jan pointed out, either plperlu or pltclu can accomplish just about
anything you'd want in that line, even without the escape hatch of
firing a shell script.

I think Bruce has correctly identified a documentation deficiency:
there's not any material explaining the transaction-unsafety risks of
using these PLs to do stuff outside the database.  We should talk
about that someplace.

My opinion is that the *preferred* way would involve having a background
client-side task that watches for things to do (eg via NOTIFY/LISTEN),
and then updates the database to indicate that it's done it.  This
doesn't require any unsafe PL programming at all, but it does mean extra
work to set up a suitable client task.  An example would make a great
contrib item ...
        regards, tom lane




pgsql-interfaces by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Where is PLbash ??
Next
From: Jan Wieck
Date:
Subject: Re: Where is PLbash ??