You're confusing postgresql's get last oid with mysql and other databases get last inserted id.
An OID is an object id that is a unique identifier withing a database across all tables. I.e. no two records in a database in any of it's sub tables will have the same OID.
You can see OIDs by doing a select like so:
select *,oid from tablename;
And you'll see the OIDs for each row. These are not the same as serial datatypes, i.e. the ones made when you do a:
create table tablename (field1 text, id serial);
OIDs are maintained by the dbms engine not the user. Note that if you create records in two tables, back and forth, the OIDs assigned will go up by one for each table alternately like so:
table 1 oid:---table 2 oid:
3452-----------3453
3454-----------3455
3456-----------3457
and so on. But the same OID will never show up anywhere else in your database.
So, to get your last inserted ID you have to "roll your own" last getlastinsertid function like so:
function pg_getlastid($conn,$result,$table){
$OID = pg_getlastoid($result);
$idres = pg_exec($conn,"select id from $table where OID=$OID");
$id = pg_result($idres,0,"id");
return $id;
}
There may be some problems with variables not bein global enough here, I haven't tested this code at all, it's just from the hip.