Re: Trigger on Update

From: Mike Rylander <mrylander(at)gmail(dot)com>
To: "sunithab(at)travelpost(dot)com" <sunithab(at)travelpost(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Trigger on Update
Date: 2005-07-15 18:36:39
Message-ID: b918cf3d05071511365b89530e@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 7/15/05, sunithab(at)travelpost(dot)com <sunithab(at)travelpost(dot)com> wrote:
[snip]
>
> 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 */

NEW.updated_date = NOW();
RETURN NEW;

> end;
> $body$
> LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;

See http://www.postgresql.org/docs/8.0/interactive/plpgsql-trigger.html

--
Mike Rylander
mrylander(at)gmail(dot)com
GPLS -- PINES Development
Database Developer
http://open-ils.org

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2005-07-15 18:56:42 Re: problem after restoring a backup database on a
Previous Message mark reid 2005-07-15 18:16:42 Re: Trigger on Update