From: | maurice(dot)walshe(at)poptel(dot)coop (Maurice Walshe) |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Pl/pgSQL trigger failing and i ant see why |
Date: | 2002-07-25 15:02:03 |
Message-ID: | 534cf093.0207250702.3acfa53@posting.google.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
maurice(dot)walshe(at)poptel(dot)coop (Maurice Walshe) wrote in message news:<534cf093(dot)0207240525(dot)755d88d3(at)posting(dot)google(dot)com>...
> HI all
> I have read the skimpy docs on postgres triggers and whilst I can
> get a simple trigger working when I try to call a Pl/pgsql function
> to return the value I want to set one of the foields in NEW to it wont
> work.
I have narowed it down a bit it now seems that
NEW only works (postgres 7.1.3) from some types of
variables when I try and get the message subject and headers.
like this....
CREATE FUNCTION SetMsgParent () returns OPAQUE as '
DECLARE
mymsgid INTEGER;
myHeader TEXT;
mySubject TEXT;
newparent INTEGER;
BEGIN
mymsgid := NEW.messageid_;
myHeader := NEW.hdrall_;
mySubject := NEW.hdrsubject_;
RAISE NOTICE ''FIND BEFORE VERSION calling setmsgparent(%)'', mymsgid;
RAISE NOTICE ''memebrid(%)'', NEW.memberid_;
RAISE NOTICE ''hdrall(%)'', NEW.hdrall_;
RAISE NOTICE ''calling setmsgparent(%)'', NEW.hdrsubject_;
NEW.immediateparentid_ := FindRealParent(mymsgid,NEW.hdrall_, NEW.hdrsubject_) ;
RETURN NEW ;
END;
' LANGUAGE 'plpgsql';
NEW.memberid_ is ok and NEW.hdrall_ and NEW.hdrsubject_ are NULL (hdrall_ is
a TEXT hdrsubject_ is varchar(200))
I have tried this as a before and an after trigger
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Sullivan | 2002-07-25 15:04:17 | Re: erserver |
Previous Message | Darren Ferguson | 2002-07-25 14:18:37 | Re: How to covert 'char' to 'inet' |