Обсуждение: Send email when new record inserted

Поиск
Список
Период
Сортировка

Send email when new record inserted

От
Nick Tew
Дата:
Hi,

This may seem a trivial task, but im stumped. When a new record is inserted
in one of my psql tables a need an email to be sent to pre-defined users.
The users will be 'interested parties' to the record inserted - therefore
these will be specified in a separate table. Is there a method for
completing this process?

Thanks for your time and help.

Kindest Regards


Nick Tew
Intranet Data Analyst
Phone: 01933 408225
Mobile: 07793 227001
Fax: 01933 408324
Email: nick.tew@budgens.co.uk



**********************************************************************
This e-mail is private and confidential and is for the
addressee only. You are prohibited from using, printing,
distributing or disseminating it or any information contained
in it, save to the intended recipient.
**********************************************************************


Re: Send email when new record inserted

От
Stephan Szabo
Дата:
On Thu, 12 Feb 2004, Nick Tew wrote:

> This may seem a trivial task, but im stumped. When a new record is inserted
> in one of my psql tables a need an email to be sent to pre-defined users.
> The users will be 'interested parties' to the record inserted - therefore
> these will be specified in a separate table. Is there a method for
> completing this process?

You can do this either from a trigger (written in C or an untrusted pl
language) or with a listening application using the listen/notify
interface.  The former has the problem that if the transaction is rolled
back, the email will already have been sent, but that may not be an issue
with your system.  The latter is a bit more involved.