X-Original-To: pgsql-sql-postgresql.org@postgresql.org Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id 1ADBF9FCF2B for ; Mon, 28 Aug 2006 11:02:42 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 62596-07 for ; Mon, 28 Aug 2006 14:02:34 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.189]) by postgresql.org (Postfix) with ESMTP id E3D769FCF2C for ; Mon, 28 Aug 2006 11:02:33 -0300 (ADT) Received: by nf-out-0910.google.com with SMTP id p77so1336715nfc for ; Mon, 28 Aug 2006 07:02:32 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type; b=XFBGEWJYdZwyRc/wABuYpcSVfrf9bpqnjJLiNQ5M5hgnlbGNiv0a2DL0jkK7nS3h6zKmluPgamo2FbYyAOWFwWgYLRm+DeS4DG6Ch9F5yAPeZJ5svPqvg4pc3LT1LBNSKJNf53i2B1HPyfZMo3EUZwJupxlF1Hg5MWt3Nci4M44= Received: by 10.48.210.20 with SMTP id i20mr9028949nfg; Mon, 28 Aug 2006 07:02:32 -0700 (PDT) Received: by 10.48.243.12 with HTTP; Mon, 28 Aug 2006 07:02:32 -0700 (PDT) Message-ID: <2bffcc330608280702y16c25090i816589e20163e7e8@mail.gmail.com> Date: Mon, 28 Aug 2006 10:02:32 -0400 From: "Henry Ortega" To: pgsql-sql@postgresql.org Subject: Trigger on Insert to Update only newly inserted fields? MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_45484_15130338.1156773752069" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.2 tagged_above=0 required=5 tests=DNS_FROM_RFC_ABUSE, HTML_MESSAGE, SPF_PASS X-Spam-Level: X-Archive-Number: 200608/219 X-Sequence-Number: 26177 ------=_Part_45484_15130338.1156773752069 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline 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. ------=_Part_45484_15130338.1156773752069 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline 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.
------=_Part_45484_15130338.1156773752069--