Syntax check for functions? - Mailing list pgsql-general

From Andreas Schlegel
Subject Syntax check for functions?
Date
Msg-id 3D2DBF0B.1090903@software.b.uunet.de
Whole thread Raw
Responses Re: Syntax check for functions?  (Stephane Bortzmeyer <bortzmeyer@nic.fr>)
List 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();


pgsql-general by date:

Previous
From: "João" Paulo Batistella
Date:
Subject: Type TEXT
Next
From: Chris Albertson
Date:
Subject: Re: Query Speed!!!