note 9200 added to pg_getlastoid
| From: | brooke at jump dot net | Date: | Sun, 22 Oct 2000 17:03:31 +0000 |
| Subject: | note 9200 added to pg_getlastoid | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-6827@lists.php.net to get a copy of this message | ||
The best way is to read nextval('sequence') and use the result in the primary key column
of your insert statement. That way, you get to reserve a unique ID, you know what it is ahead of
time, and you can use referential integrity constraints on your database with your keys. (It seems
DRI doesn't like OID fields)
http://www.php.net/manual/function.pg-getlastoid.php