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();