Re: INSERT ... ON CONFLICT syntax issues

Поиск
Список
Период
Сортировка
Искать
От
Peter Geoghegan
Тема
Re: INSERT ... ON CONFLICT syntax issues
Дата
в 22:55:05
Msg-id
CAM3SWZRnHp_W5e+zhB+WWRy0TZCVSKAvATe4Tc4qVPSy1BvVFg@mail.gmail.com
Ответ на
Список
Дерево обсуждения
INSERT ... ON CONFLICT syntax issues Andres Freund <andres@anarazel.de>
Re: INSERT ... ON CONFLICT syntax issues Peter Geoghegan <pg@heroku.com>
Re: INSERT ... ON CONFLICT syntax issues Andres Freund <andres@anarazel.de>
Re: INSERT ... ON CONFLICT syntax issues Peter Geoghegan <pg@heroku.com>
Re: INSERT ... ON CONFLICT syntax issues Andres Freund <andres@anarazel.de>
Re: INSERT ... ON CONFLICT syntax issues Peter Geoghegan <pg@heroku.com>
Re: INSERT ... ON CONFLICT syntax issues Peter Geoghegan <pg@heroku.com>
Re: INSERT ... ON CONFLICT syntax issues Peter Geoghegan <pg@heroku.com>
Re: INSERT ... ON CONFLICT syntax issues Peter Eisentraut <peter_e@gmx.net>
Re: INSERT ... ON CONFLICT syntax issues Peter Geoghegan <pg@heroku.com>
Re: INSERT ... ON CONFLICT syntax issues Simon Riggs <simon@2ndQuadrant.com>
Re: INSERT ... ON CONFLICT syntax issues Peter Geoghegan <pg@heroku.com>
On Wed, Apr 29, 2015 at 12:09 PM, Robert Haas  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


В списке pgsql-hackers по дате отправления
От: David Fetter
Дата:
Сообщение: tzdata and 9.4.2, etc.
От: mark
Дата:
FAQ