UPSERT/RETURNING -> ON CONFLICT SELECT?

Поиск
Список
Период
Сортировка
От Bjørnar Ness
Тема UPSERT/RETURNING -> ON CONFLICT SELECT?
Дата
Msg-id CAJO99Tk8ZJ482RVGNn=147FmCZ=Tne2iOOJ18MU9bvEu5wXbZA@mail.gmail.com
обсуждение исходный текст
Ответы Re: UPSERT/RETURNING -> ON CONFLICT SELECT?  (Peter Geoghegan <pg@heroku.com>)
Список pgsql-hackers
The new upsert feature is a great addition, but in some cases is not
as usable as
I and seems lots of others would like it to be, take an example with
circular references:

create table foo ( id serial references bar(foo_id) on delete cascade, i int
);

create table bar ( foo_id integer references foo(id) on delete cascade, i int
);

A insert here would be:

with _foo as ( insert into foo(i) values(1) returning id
) insert into bar(foo_id,i) select id,2 from _foo;

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;

-- 
Bj(/)rnar



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Amit Kapila
Дата:
Сообщение: Re: Re: [COMMITTERS] pgsql: Avoid extra locks in GetSnapshotData if old_snapshot_threshold <
Следующее
От: Netanel Katzburg
Дата:
Сообщение: Re: Disable WAL completely - Performance and Persistency research