Re: NEW in Rule makes another nextval call? - Mailing list pgsql-general

From Richard Huxton
Subject Re: NEW in Rule makes another nextval call?
Date
Msg-id 4357AAFD.8070902@archonet.com
Whole thread Raw
In response to Re: NEW in Rule makes another nextval call?  (Sven Willenberger <sven@dmv.com>)
List pgsql-general
Sven Willenberger wrote:
> On Thu, 2005-10-20 at 15:01 +0100, Richard Huxton wrote:
>>However, in this particular case I think you want an after insert
>>trigger on customer rather than a rule.
>
> As as AFTER INSERT trigger, I can safely assume here that NEW.custid wil
> now properly use the actual value of the custid rather than nextval()? I
> have dropped the rule and created the AFTER INSERT trigger so I guess I
> will find out shortly enough :-)

An AFTER TRIGGER does nothing to the plan-tree, it just calls a function
once per row (for a per-row trigger). You have two structures (NEW,OLD)
with ordinary values in them.

--
   Richard Huxton
   Archonet Ltd

pgsql-general by date:

Previous
From: Sven Willenberger
Date:
Subject: Re: NEW in Rule makes another nextval call?
Next
From: Michael Fuhr
Date:
Subject: Re: NULL != text ?