Concurrency and pg_getlastoid()

From: Date: Tue, 22 Aug 2000 01:18:25 +0000
Subject: Concurrency and pg_getlastoid()
Groups: php.db 
Request: Send a blank email to php-db+get-2248@lists.php.net to get a copy of this message
I am searching for the best way to enter data into a postgresql database and return with the value of a serial type in the table into which I just inserted. I am currently using locks to guarantee atomicity, but I am looking for a better way. I currently have: BEGIN WORK INSERT ... SELECT currval(my_seq); END WORK Is there a less tortured way to do this? I considered pg_getlastoid(), but unless I have missed something in the documentation, this doesn't resolve my concurrency issue. Ben

« previous php.db (#2248) next »