Re: Postgresql indices (was Re: lisp mail archive software)
Zachary Beane <[email protected]> Mon, 7 Jul 2003 10:08:18 -0400
| Newsgroups | gmane.lisp.clump |
|---|---|
| Message-ID | <[email protected]> |
On Mon, Jul 07, 2003 at 02:53:10PM +0100, Daniel Barlow wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > John DeSoi <[email protected]> writes: > > > I suspected this was the case. I'm doing something similar and opted > > for a serial primary key for instances. It would be nice get an object > > ID back from the insert without the need to call currval, but I > > thought this was the best way to go since indexing is taken care of > > with the primary key specification. > > Isn't that potentially racey? What happens if another user does an > insert between when you do yours and when you call currval? This is a Postgres FAQ, and the answer is no. 'currval' is tracked per session so you'll always get the result of your own most-recent 'nextval', not someone else's. Zach