note 20566 added to function.pg-getlastoid

From: Date: Mon, 08 Apr 2002 15:47:24 +0000
Subject: note 20566 added to function.pg-getlastoid
Groups: php.notes 
Request: Send a blank email to php-notes+get-28958@lists.php.net to get a copy of this message
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. -- http://www.php.net/manual/en/function.pg-getlastoid.php http://master.php.net/manage/user-notes.php?action=edit+20566 http://master.php.net/manage/user-notes.php?action=delete+20566 http://master.php.net/manage/user-notes.php?action=reject+20566

« previous php.notes (#28958) next »