1: ok checking into that. thanx for the tip.
2: ok i think i get it...the RETURNING part of the query is what specifies which field to return. but WHERE does this returned value show up in this php:
$sql = "INSERT INTO distributors (did, dname) VALUES (DEFAULT, 'XYZ Widgets') RETURNING did;";
$result = pg_query($sql);
3: The last thing I want to do is irritate my savior, but are you sure? Suppose I had this script on my Linux/Apache/PHP server and was running PostGreSQL:
$sql1 = "INSERT INTO my_table SET field1=1, field2='val2', field3='val3'";
$result = pg_query($sql);
// CHECK POINT 1
// ...some other code runs here for some stupid reason
$sql2 = "SELECT CURRVAL('public.test_zip_assoc_id_seq')";
$result = pg_query($sql2);
While it is unlikely that the operating system might halt execution of the thread running this PHP script right at CHECK POINT 1 to schedule some other user's PHP thread, it is nevertheless a remote possibility is it not? In the event that the OS scheduled the same PHP script to run for some other user, the value returned by the second query would have been contaminated by the other user's script runnin the same query.