note 35270 added to function.pg-last-oid
| From: | julian at e2-media dot co dot nz | Date: | Tue, 26 Aug 2003 04:21:30 +0000 |
| Subject: | note 35270 added to function.pg-last-oid | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-55071@lists.php.net to get a copy of this message | ||
The way I nuderstand it, each value is emitted by a sequence only ONCE. If you retrieve a number
(say 12) from a sequence using nextval(), the sequence will advance and subsequent calls to
nextval() will return further numbers (after 12) in the sequence.
This means that if you use nextval() to retrieve a value to use as a primary key, you can be
guaranteed that no other calls to nextval() on that sequence will return the same value. No race
conditions, no transactions required.
That's what sequences are *for* afaik :^)
----
Manual Page -- http://www.php.net/manual/en/function.pg-last-oid.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+35270
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+35270&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+35270&report=yes