Problems with a Trigger Statement

From: Nathan Schile <nate(at)shiftyeyes(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Problems with a Trigger Statement
Date: 2004-04-15 18:34:00
Message-ID: 407ED598.7030201@shiftyeyes.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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!

Browse pgsql-general by date

  From Date Subject
Next Message Uwe C. Schroeder 2004-04-15 18:35:28 Table Lock issue
Previous Message Joe Lester 2004-04-15 18:27:27 Re: Optimal configuration to eliminate "out of file descriptors" error