X-Original-To: pgsql-sql-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 8E82A9FB2D5 for ; Fri, 14 Jul 2006 00:34:39 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 71330-03 for ; Fri, 14 Jul 2006 00:34:30 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.187]) by postgresql.org (Postfix) with ESMTP id D710D9FAE4E for ; Fri, 14 Jul 2006 00:34:30 -0300 (ADT) Received: by nf-out-0910.google.com with SMTP id d4so62442nfe for ; Thu, 13 Jul 2006 20:34:28 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:references:x-google-sender-auth; b=i+1hGVZhdk3ZX29fvMwCihJWH47ROFMqBZ1WJW5IPzE2hY0aWX7f5mTUFU3c2Tt3larLSiun10K7SVJF/8CrJ/RjCuQb3oTpdHRBOy7BgQf6V0oj2aFriIZ0ruvuL6cqxKax7+2hj2MYbZudsa28j0yTwl/TjEUAdSwdYmoLOG0= Received: by 10.78.178.5 with SMTP id a5mr1416056huf; Thu, 13 Jul 2006 20:34:28 -0700 (PDT) Received: by 10.78.29.15 with HTTP; Thu, 13 Jul 2006 20:34:28 -0700 (PDT) Message-ID: Date: Thu, 13 Jul 2006 22:34:28 -0500 From: "Aaron Bono" To: aklaver@comcast.net Subject: Re: Trigger, record "old" is not assigned yet Cc: pgsql-sql@postgresql.org, "Daniel Caune" In-Reply-To: <200607131638.54001.aklaver@comcast.net> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_22764_21638959.1152848068580" References: <1E293D3FF63A3740B10AD5AAD88535D202A29F60@UBIMAIL1.ubisoft.org> <200607131638.54001.aklaver@comcast.net> X-Google-Sender-Auth: aaeca1194b674a0b X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200607/206 X-Sequence-Number: 25780 ------=_Part_22764_21638959.1152848068580 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 7/13/06, Adrian Klaver wrote: > > For plpgsql use TG_OP. See link below. > http://www.postgresql.org/docs/8.1/interactive/plpgsql-trigger.html > On Thursday 13 July 2006 03:50 pm, Daniel Caune wrote: > > Hi, > > > > > > > > I've created a trigger BEFORE INSERT OR UPDATE on a table and, indeed, > > when the trigger is raised before insertion the record "old" is not > > assigned. Is there a way to distinguish in the trigger procedure from > > an insert statement to an update statement? > > > > > > > > Regards, > > > > > > Daniel CAUNE > > > > Ubisoft Online Technology > > > > (514) 490 2040 ext. 3613 > > -- > Adrian Klaver > aklaver@comcast.net Or to be more specific: IF (TG_OP = 'UPDATE') THEN ================================================================== Aaron Bono Aranya Software Technologies, Inc. http://www.aranya.com ================================================================== ------=_Part_22764_21638959.1152848068580 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On 7/13/06, Adrian Klaver <aklaver@comcast.net> wrote:
For plpgsql use TG_OP. See link below.
http://www.postgresql.org/docs/8.1/interactive/plpgsql-trigger.html
On Thursday 13 July 2006 03:50 pm, Daniel Caune wrote:
> Hi,
>
>
>
> I've created a trigger BEFORE INSERT OR UPDATE on a table and, indeed,
> when the trigger is raised before insertion the record "old" is not
> assigned.  Is there a way to distinguish in the trigger procedure from
> an insert statement to an update statement?
>
>
>
> Regards,
>
>
> Daniel CAUNE
>
> Ubisoft Online Technology
>
> (514) 490 2040 ext. 3613

--
Adrian Klaver
aklaver@comcast.net

Or to be more specific:

IF (TG_OP = 'UPDATE') THEN

==================================================================
   Aaron Bono
   Aranya Software Technologies, Inc.
   http://www.aranya.com
================================================================== ------=_Part_22764_21638959.1152848068580--