From: | Andreas Schlegel <schlegel(at)software(dot)b(dot)uunet(dot)de> |
---|---|
To: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Syntax check for functions? |
Date: | 2002-07-11 17:23:23 |
Message-ID: | 3D2DBF0B.1090903@software.b.uunet.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi,
is there any chance to make a syntax check of a function/trigger before
creating it.
I just wrote my first function and trigger in Postgres an dit won't work :-(
I get the error: "fmgr_info: function 541860: cache lookup failed"
May be somebody may have a look on the function and see the error(s).
Is the use of "length(new.extid) = 0" right or do I have to ask "is null"?
Greetings,
Andreas
CREATE FUNCTION trigger_insert_custno_ext()
RETURNS opaque
AS 'BEGIN
IF length(new.extid) = 0
THEN new.extid = new.custno; -- put custno into extid column
END IF;
RETURN new;
END;'
LANGUAGE 'plpgsql';
CREATE TRIGGER trigger_custno_ext
BEFORE INSERT OR UPDATE
ON tCustomer
FOR EACH ROW
EXECUTE PROCEDURE trigger_insert_custno_ext();
From | Date | Subject | |
---|---|---|---|
Next Message | Chris Albertson | 2002-07-11 17:29:38 | Re: Query Speed!!! |
Previous Message | Joo Paulo Batistella | 2002-07-11 17:18:07 | Type TEXT |