I want the following trigger to update a related table when ever a
record is inserted/updated. I have the following trigger:
CREATE TRIGGER update_status
AFTER INSERT OR UPDATE
ON public."Bug Status"
FOR EACH ROW
EXECUTE PROCEDURE public.update_status();
Which Calls this function:
CREATE OR REPLACE FUNCTION public.update_status()
RETURNS trigger AS
'
BEGIN
UPDATE public."BugTracking" SET status = NEW.status WHERE
"BugTracking"."Tracking Number" = NEW."Tracking Number"
END;
'
LANGUAGE 'plpgsql' VOLATILE;
When I go to insert a record I receive the following error:
ERROR: syntax error at or near ""
CONTEXT: compile of PL/pgSQL function "update_status" near line 4
Any one know where I am going wrong?? Thanks!