Re: INSERT ... ON CONFLICT syntax issues

Поиск
Список
Период
Сортировка
От Peter Geoghegan
Тема Re: INSERT ... ON CONFLICT syntax issues
Дата
Msg-id CAM3SWZRnHp_W5e+zhB+WWRy0TZCVSKAvATe4Tc4qVPSy1BvVFg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: INSERT ... ON CONFLICT syntax issues  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-hackers
On Wed, Apr 29, 2015 at 12:09 PM, Robert Haas <robertmhaas@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.dnameRETURNING 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
Дата:
Сообщение: Re: [GENERAL] Insert result does not match record count