Re: [HACKERS] UPSERT/RETURNING -> ON CONFLICT SELECT?

2016-07-13 Thread Tom Lane
Peter Geoghegan writes: > 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 retu

Re: [HACKERS] UPSERT/RETURNING -> ON CONFLICT SELECT?

2016-07-13 Thread Peter Geoghegan
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_

[HACKERS] UPSERT/RETURNING -> ON CONFLICT SELECT?

2016-07-13 Thread Bjørnar Ness
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 refer