Trigger on Insert to Update only newly inserted fields?

From: "Henry Ortega" <juandelacruz(at)gmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Trigger on Insert to Update only newly inserted fields?
Date: 2006-08-28 14:02:32
Message-ID: 2bffcc330608280702y16c25090i816589e20163e7e8@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

I have a On Insert Trigger that updates one of the columns in that same
table.

Is there a way for the trigger to run only for the newly inserted records?
Instead of all records in the database?

E.g.:
ID Start_Date End_Date
001 08-01-2006
002 08-02-2006

On Insert/Update, Update End_Date=now().
I want that to run only on new records.or the updated
record. How can I do this?

Thank you so much.

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Alvaro Herrera 2006-08-28 14:27:31 Re: Create Assertion -- Question from a newbie
Previous Message D'Arcy J.M. Cain 2006-08-28 13:49:30 Re: double precision vs. numeric