Search Postgresql Archives

Re: Trigger email?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Christopher Browne wrote:

cool_screen_name90001@xxxxxxxxx (CSN) writes:


Is it possible to setup a trigger so that every time a
certain field is changed, an email is sent? Using
pl/pgsql.



Something _like_ that is possible.


you can also do it directly with a trigger if you prefer:

CREATE TRIGGER alert_insert
   AFTER INSERT OR UPDATE ON alert FOR EACH ROW
   EXECUTE PROCEDURE alert_notify();

Where the alert_notify() function would then call pgmail() with a meaningful subject and body etc -- see below

What I would do instead is for the trigger to cause a record to be put
into a table that might be called something like "submit_email".

An asynchronous process (that might look for NOTIFY requests!) would
then rummage thru submit_email to find messages it needs to send.


at which point you could then use pgmail() to send the email

http://sourceforge.net/projects/pgmail/
begin:vcard
fn:Jonathan Hedstrom
n:Hedstrom;Jonathan
org:Downtown Emergency Service Center;Information Services
email;internet:jhedstrom@xxxxxxxx
title:Data Systems Administrator
tel;work:(206) 464-1570 ext. 3014
version:2.1
end:vcard

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faq

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux