Re: [GENERAL] Example of RETURNING clause to get auto-generated keys from INSERT

2007-01-24 Thread Bruno Wolff III
On Tue, Jan 23, 2007 at 23:19:47 -0600, Adam Rich <[EMAIL PROTECTED]> wrote: > > And your normal query would be this: > > INSERT into mytable (id,value) values (1,"foo"),(2,"bar"); > > Your new query would be like this: > > INSERT into mytable (id,value) values (1,"foo"),(2,"bar") > RETURNING

Re: [GENERAL] Example of RETURNING clause to get auto-generated keys from INSERT

2007-01-23 Thread Adam Rich
Let's say you have a table with "id, value" columns. And your normal query would be this: INSERT into mytable (id,value) values (1,"foo"),(2,"bar"); Your new query would be like this: INSERT into mytable (id,value) values (1,"foo"),(2,"bar") RETURNING id; And you would get a result back with

Re: [GENERAL] Example of RETURNING clause to get auto-generated keys from INSERT

2007-01-23 Thread Alvaro Herrera
Ken Johanson wrote: > -support multiple values, ie. insert int tbl (a,b) values (1,2),(3,4), > should return a result with 2 rows containing the new keys (one for each > column the users declares). > -query the values atomically (so that insert by another client won't > skew the curval / sequen