Re: NEW in Rule makes another nextval call?

From: Richard Huxton <dev(at)archonet(dot)com>
To: Sven Willenberger <sven(at)dmv(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: NEW in Rule makes another nextval call?
Date: 2005-10-20 14:34:37
Message-ID: 4357AAFD.8070902@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Michael Fuhr 2005-10-20 14:45:12 Re: NULL != text ?
Previous Message Sven Willenberger 2005-10-20 14:32:40 Re: NEW in Rule makes another nextval call?