Re: Why do OLD and NEW have special internal names?

From: Jan Wieck <JanWieck(at)Yahoo(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Why do OLD and NEW have special internal names?
Date: 2009-11-20 05:30:54
Message-ID: 4B06298E.5010507@Yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 11/20/2009 1:12 AM, Tom Lane wrote:
> Jan Wieck <JanWieck(at)Yahoo(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nikhil Sontakke 2009-11-20 05:44:58 Re: Syntax for partitioning
Previous Message Josh Berkus 2009-11-20 04:36:59 Re: operator exclusion constraints