From: | <sunithab(at)travelpost(dot)com> |
---|---|
To: | <pgsql-general(at)postgresql(dot)org> |
Subject: | Trigger on Update |
Date: | 2005-07-15 18:07:38 |
Message-ID: | 008e01c58968$15fbe140$1301a8c0@sf.vagabond.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Can anybody help me creating a trigger on update trigger with update statement as below.
This trigger fires after update on a table called note to update the updated_date field.
But when the table is updated the trigger is firing recursively.
Anybody know what is the syntax I have to use in update statement.
CREATE TRIGGER "trg_update_note_updated_date" AFTER UPDATE
ON "property"."note" FOR EACH ROW
EXECUTE PROCEDURE "property"."update_note_updated_date_trg"();
CREATE OR REPLACE FUNCTION "property"."update_note_updated_date_trg" () RETURNS trigger AS
$body$
begin
/* New function body */
UPDATE property.note SET updated_date=CURRENT_DATE
WHERE note_id = NEW. note_id;
return null;
end;
$body$
LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;
From | Date | Subject | |
---|---|---|---|
Next Message | Joshua D. Drake | 2005-07-15 18:11:27 | Re: Trigger on Update |
Previous Message | Devrim GUNDUZ | 2005-07-15 18:03:34 | Re: Postgres for Fedora Core 2 OS **************** |