On Mon, Oct 17, 2005 at 09:12:35AM -0400, Dave Cramer wrote: > I fail to see how this solves the problem of getting auto generated > keys. > > AFAIKS, the protocol needs to be tweaked to return at a minimum the > currval for the first serial in the row, but more correctly all of > the modified currval's for an insert
In what sense? It seems to do exactly what you want. The example in the
documentation is:
INSERT INTO films (title) VALUES ('Yojimbo') RETURNING film_id;
film_id
---------
123
The protocol allows you to return a result set for any command already
so I don't think there's any protocol changes at all. You don't even
need to know the name of the sequence which is something I wasn't even
hoping for. Well done...
> if we had that then we could correctly implement getAutoGeneratedKeys
> for jdbc.
There is a function now to return the sequence associated with a table
so I think this would be quite straightforward actually, assuming you
know the table being operated on.
Have a nice day,
--
Martijn van Oosterhout <[email protected]> http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.
pgpRKb2spaOwp.pgp
Description: PGP signature
