On Thu, Jan 01, 2004 at 03:37:46PM -0600, Mike Nolan wrote:
> > Use currval() after you have inserted.
>
> That will not necessarily tell you the last insertion, depending
> upon how many other users there are doing inserts.
Where do you get that impression? currval() refers to the last ID for the
session you are in. It's also FAQ question 4.15.3. Even better, if you
havn't used nextval() in your current session, currval() returns an error,
so you can't even get it wrong by accident.
http://www.postgresql.org/docs/faqs/FAQ.html#4.15.3
Hope this helps,
--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/
> (... have gone from d-i being barely usable even by its developers
> anywhere, to being about 20% done. Sweet. And the last 80% usually takes
> 20% of the time, too, right?) -- Anthony Towns, debian-devel-announce