Function / trigger - Mailing list pgsql-novice

From Fontenot, Paul
Subject Function / trigger
Date
Msg-id 230BCAB977308F43BD851AFAE55A86413D6CAC@phx01018.bannerhealth.com
Whole thread Raw
List 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@bannerhealth.com>'',''paul.fontenot@bannerhealth.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.

pgsql-novice by date:

Previous
From: Sudheesh Krishnankutty
Date:
Subject: MD5 encryption how to store in database
Next
From: "Fontenot, Paul"
Date:
Subject: