Re: Send email when new record inserted

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Nick Tew <Nick(dot)Tew(at)Budgens(dot)co(dot)uk>
Cc: "'pgsql-novice(at)postgresql(dot)org'" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Send email when new record inserted
Date: 2004-02-15 19:56:38
Message-ID: 20040215115440.P88869@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

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.

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Rob Mosher 2004-02-15 19:57:35 Changing from NOT NULL to NULL
Previous Message Stephan Szabo 2004-02-15 19:54:27 Re: Fwd: Fwd: Lots of nan's