U++ framework
Do not panic. Ask here before giving up.

Home » U++ Library support » U++ SQL » PostgreSQL GetInsertedId()
Re: PostgreSQL GetInsertedId() [message #16734 is a reply to message #16723] Tue, 08 July 2008 21:58 Go to previous message
captainc is currently offline  captainc
Messages: 278
Registered: December 2006
Location: New Jersey, USA
Experienced Member
zsolt wrote on Tue, 08 July 2008 10:56

luzr wrote on Tue, 08 July 2008 15:57


What if other client inserts a record between your INSERT and SELECT?


In PostgreSQL, curval returns the value after last "nextval" in current session.
If some other clients call "nextval" after yours, you will see your original value got from your last "nextval".



Also, curval and nextval are session specific (session safe). So unless you inserted another item in your session, you will get back the id expected. Other sessions will not interfere with this even if they add information to the database in between.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Quick explanation of function calls for postgresql
Next Topic: db access to MS ACCESS
Goto Forum:
  


Current Time: Wed Apr 29 16:04:29 GMT+2 2026

Total time taken to generate the page: 0.02611 seconds