- Mailing list pgsql-novice

From Fontenot, Paul
Subject
Date
Msg-id 230BCAB977308F43BD851AFAE55A86413D6CAE@phx01018.bannerhealth.com
Whole thread Raw
List pgsql-novice
I guess I didn't quite have it figured out. I insert a dummy record to
test and this is what I get:
syslog=> insert into syslogtb values
('syslog','info','2003-05-15','13:57:46','john81','%PIX-1-106021: Deny
udp');
NOTICE:  Error occurred while executing PL/pgSQL function
checksyslogmail
NOTICE:  line 7 at assignment
ERROR:  query "SELECT  'The following message was recieved from the PIX
on ', syslogtb.date,' at ', syslogtb.time, ' :',syslogtb.message,' '"
returned more than one row
syslog=>

The function looks like this:
-----------------------------------------------------
create function CheckSyslogMail() returns opaque as '
DECLARE
        logRec RECORD;
        textMessage text;
BEGIN
        select into logRec date,time,message from syslogtb where message
= NEW.messa
ge;
        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.fonteno
t@bannerhealth.com'',''PIX Logserver message'', textMessage);
        end if;
        return NEW;
END;' language 'plpgsql';
-----------------------------------------------------

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

Thanks for your help

***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: "Fontenot, Paul"
Date:
Subject: Function / trigger
Next
From: Nabil Sayegh
Date:
Subject: select only default