Hey,
I have a problem in Postgres with function and trigger in Postgres V. 7.2.
I''ve created a custom function and trigger to delete delete corrisponding entries from table_b when a row is deleted from table_a.
When I try and issue a delete, I get an error saying
ERROR: fmgr_info: function 82743: cache lookup failed
I did some Google searches pertaining to this subject, most answers point to the Function or trigger referencing an out of date OID. I don't think that this is the case - I've drop and recreated both the trigger and the Function, looked in the pg_trigger table to ensure that the trigger was gone. I also tried creating the function and trigger using different names.
Here is the code:
CREATE FUNCTION delete_from_b () RETURNS OPAQUE AS '
BEGIN
--Check if id is null
IF OLD.id ISNULL THEN
RAISE EXCEPTION \'ID Can not be Null\';
END IF;
--if ID, then delete from table_b table.
delete from table_b where table_a_id=OLD.id;
RETURN OLD;
END;
' LANGUAGE 'plpgsql';
create trigger delete_from_b after DELETE ON table_a FOR EACH ROW EXECUTE PROCEDURE delete_from_b();
Any ideas? If anyone knows of any good Postgres related forums, please let me know.
Thanks,
brad.