"Oscar Serrano" <oserra(at)fondos(dot)net> writes:
>>>> I thing I need to create a trigger. And I thing I need to create a
>>>> function that sends an email.
>>>> Is it possible?
>>>> May I do the function that sends the email in Perl?
I don't think you can do this directly from a trigger, unless you want
to add the mail-sending function as a C extension to the backend.
You'll run into security restrictions. All of the higher-level trigger
programming languages we offer are "trusted", which means you can't do
anything that would affect files or programs outside the database.
Sending email is right out.
Of course there's nothing wrong with a C-coded function; the system's
full of them ;-). But you might want to think about other ways.
One possibility is to set up an always-running application that connects
to the database and then just sits there waiting for records to be added
to the table, then sends the email when that happens. You could use a
NOTIFY command (executed by a trigger on the table) to wake up the app
when something happens, so that it doesn't need to take up CPU time
checking the table unnecessarily.
regards, tom lane
In response to
pgsql-interfaces by date
|Next:||From: Richard||Date: 2000-04-06 15:29:44|
|Subject: Re: a trigger that sends an email + returning multiple
|Previous:||From: The Hermit Hacker||Date: 2000-04-06 14:03:50|
|Subject: Ksql Interface ...|