Re: Why do OLD and NEW have special internal names? - Mailing list pgsql-hackers

From Jan Wieck
Subject Re: Why do OLD and NEW have special internal names?
Date
Msg-id 4B06298E.5010507@Yahoo.com
Whole thread Raw
In response to Re: Why do OLD and NEW have special internal names?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Why do OLD and NEW have special internal names?
List pgsql-hackers
On 11/20/2009 1:12 AM, Tom Lane wrote:
> Jan Wieck <JanWieck@Yahoo.com> writes:
>> But this brings up another point about the recent discussion of what 
>> RENAME is good for. Removing RENAME may conflict with using OLD/NEW in 
>> UPDATE ... RETURNING. No?
> 
> Um ... not sure why.  Specific example please?
> 
>             regards, tom lane

Inside a trigger proc, NEW is supposed to mean the new row for the table 
that fired the trigger. However, inside an UPDATE RETURNING for example, 
there is another set of NEW and OLD. Let's call the trigger call's NEW 
NEW_a and the UPDATE RETURNING NEW NEW_b. How would the developer 
specify something like

INSERT ... RETURNING (NEW_a.value - NEW_b.value)?


Jan

-- 
Anyone who trades liberty for security deserves neither
liberty nor security. -- Benjamin Franklin



pgsql-hackers by date:

Previous
From: Selena Deckelmann
Date:
Subject: Re: Summary and Plan for Hot Standby
Next
From: Greg Stark
Date:
Subject: Re: Summary and Plan for Hot Standby