Function / trigger

From: "Fontenot, Paul" <Paul(dot)Fontenot(at)bannerhealth(dot)com>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: Function / trigger
Date: 2003-05-15 18:21:07
Message-ID: 230BCAB977308F43BD851AFAE55A86413D6CAC@phx01018.bannerhealth.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

After much hair fell on the floor - from my pulling it out, I think I
have this one figured out...

I have this function:
--------------------------------------------------------
create function CheckSyslogMail() returns opaque as '
DECLARE
logRec RECORD;
textMessage text;
BEGIN
select into logRec date,time,message from syslogtb where message
= NEW.message;
if logRec.message like ''%PIX-1-106021: Deny udp%'' then
textMessage := ''The following message was recieved from
the PIX on '', syslogtb.date,'' at '', syslogtb.time, '' :'
',syslogtb.message,'' '';
perform pgmail(''Log Server
<psql(at)bannerhealth(dot)com>'',''paul(dot)fontenot(at)bannerhealth(dot)com'',''PIX
Logserver message'',
textMessage);
end if;
return NEW;
END;' language 'plpgsql';
--------------------------------------------------------

And this trigger:
--------------------------------------------------------
CREATE TRIGGER trgCheckSyslogMail
AFTER INSERT OR UPDATE ON syslogtb FOR EACH ROW
EXECUTE PROCEDURE checksyslogmail();
--------------------------------------------------------

And want to know if this will send an email. I can't really test this, I
have to wait for the PIX to generate that particular message.

Thanks,
Paul

***PRIVILEGED & CONFIDENTIAL***
Unless expressly stated otherwise, this message (and any attachment(s)
thereto) is confidential and may be privileged. It is intended for the
addressee(s) only. If you are not an addressee, any disclosure or
copying of the contents of this e-mail or any action taken (or not
taken) in reliance on it is strictly prohibited. If you are not an
addressee, please inform sender immediately and delete this message from
your system.

Browse pgsql-novice by date

  From Date Subject
Next Message Fontenot, Paul 2003-05-15 19:53:57
Previous Message Sudheesh Krishnankutty 2003-05-15 11:45:13 MD5 encryption how to store in database