Thread: Obtaining value of last serial column after insert

Obtaining value of last serial column after insert

From
Shane Wegner
Date:
Hi all,

I have read about this topic in the FAQ but am hoping I can
get a bit more help obtaining the last inserted serial
column.  My program can use Mysql and Pgsql interchangeably
and I am looking for something which does what
the mysql_insert_id() function does. .

The problem with using curval() and nextval() in pgsql is
that it requires one to know the name of the sequence field
in the database.  Is there a way to use the oid to select
the primary key from a table without knowing the name of
the column?

Thanks in advance,
Shane


--
Shane Wegner: shane@cm.nu
              http://www.cm.nu/~shane/
PGP:          1024D/FFE3035D
              A0ED DAC4 77EC D674 5487
              5B5C 4F89 9A4E FFE3 035D