Re: UPSERT/RETURNING -> ON CONFLICT SELECT?

Поиск
Список
Период
Сортировка
Искать
От
Peter Geoghegan
Тема
Re: UPSERT/RETURNING -> ON CONFLICT SELECT?
Дата
Msg-id
CAM3SWZQwAT1=zfzFKC49sNhY9XSK9h7C10r2w1sOZ8YgNRpdxg@mail.gmail.com
Ответ на
Список
Дерево обсуждения
UPSERT/RETURNING -> ON CONFLICT SELECT? Bjørnar Ness <bjornar.ness@gmail.com>
Re: UPSERT/RETURNING -> ON CONFLICT SELECT? Peter Geoghegan <pg@heroku.com>
Re: UPSERT/RETURNING -> ON CONFLICT SELECT? Tom Lane <tgl@sss.pgh.pa.us>
On Wed, Jul 13, 2016 at 2:49 AM, Bjørnar Ness  wrote:
> But with upsert/do nothing, this will not work as "needed".
>
> Would it be possible to introduce a "ON CONFLICT SELECT" argument:
>
> with _foo as (
>   insert into foo(i) values(1)
>   on conflict select returning id
> ) insert into bar(foo_id,i)
>   select id,2 from _foo;

I gather that the point of this pseudo SQL is to show how you might be
able to project and select the values not successfully inserted. Can't
you just pipeline together some CTEs instead?


-- 
Peter Geoghegan


В списке pgsql-hackers по дате отправления
От: Tom Lane
Дата:
От: Tom Lane
Дата:
FAQ