Perhaps pg_last_oid() will help:
Hi everyone, I am new to the forum.
I am using PHP and PostgreSQL.
After I insert into a table "Task" who's primary key is a serial type (auto
sequence number) I would like to immediately retrieve that generated
sequence number to use for subsequent inserts into another table "Points."
So what is a correct and safe way to guarantee I can retrieve this record,
without requiring another indexed (and unique) field?
//run in php, insert a new TASK
INSERT INTO Task
("my new task", 0);
//this part I need help with.
//get the task_id of the new task from above
$new_task_id = ????????;
//run in php, insert a POINT, referencing the new TASK
INSERT INTO Point
($new_task_id, "this is a point with foreign key reference to the
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php