note 20566 deleted from function.pg-getlastoid by nlopess

From: Date: Fri, 25 Jun 2004 16:52:47 +0000
Subject: note 20566 deleted from function.pg-getlastoid by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-71681@lists.php.net to get a copy of this message
Note Submitter: bob@bobarmadillo.com ---- Warning - nextval('sequence') advances the sequence. If you select nextval('sequence') and then don't use the value it returns in your insert statement it skips a value. Regardless, it's multi-user safe - by advancing the sequence it prevents any other connection from using the same ID. If you'd rather find out the ID after the fact (and you're using a sequence) select currval('sequence') - this will return the sequence value for the last insert on *this connection*, so it is multi-user safe.

« previous php.notes (#71681) next »