On Wed, Apr 29, 2015 at 12:09 PM, Robert Haas <robertmh...@gmail.com> wrote:
>> * Don't change the names of the pseudo-alias EXCLUDED.* (or the alias
>> TARGET.*). Those seem fine to me as well.
>
> There seem to be a few votes for NEW and OLD.  That's what I proposed
> originally, and (surprise, surprise) I still like that better too.

That makes the following valid:

  INSERT INTO distributors (did, dname)
  VALUES (5, 'Gizmo transglobal')
  ON CONFLICT (did) DO UPDATE SET dname = NEW.dname
  RETURNING OLD.dname;

So you're projecting "OLD.dname" from RETURNING, here -- so "OLD"
refers to the row added back to the relation on update (or perhaps the
row simply inserted). That's pretty bad. I really don't want to add a
kludge to make the target relation have an alias in one context but
not in the other.


-- 
Peter Geoghegan


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to