Re: [HACKERS] INSERT ... ON CONFLICT () SELECT

2017-06-19 Thread Matt Pulver
On Sun, Jun 18, 2017 at 9:21 PM, Peter Geoghegan wrote: > Returning rows with duplicate values seems rather unorthodox. > Ok, then option 2 it is. In summary, this is what I am going to (attempt to) implement for the new syntax: INSERT ... ON CONFLICT (...) DO SELECT RETURNING ... 1. Rows

Re: [HACKERS] INSERT ... ON CONFLICT () SELECT

2017-06-18 Thread Matt Pulver
On Sat, Jun 17, 2017 at 9:55 PM, Peter Geoghegan wrote: > On Sat, Jun 17, 2017 at 7:49 AM, Matt Pulver > wrote: > > With the proposed "INSERT ... ON CONFLICT () SELECT" feature, the > > get_or_create_id() function is simplified to: > > Are you locking the exi

[HACKERS] INSERT ... ON CONFLICT () SELECT

2017-06-17 Thread Matt Pulver
Hello, I am looking to add a new language feature that returns the rows that conflict on an INSERT, and would appreciate feedback and guidance on this. Here is an example. To implement a get_or_create_id() function, this is how it must currently be done: CREATE TABLE example ( id SERIAL PRI