Obtaining value of last serial column after insert

From: Shane Wegner <shane(at)cm(dot)nu>
To: pgsql-general(at)postgresql(dot)org
Subject: Obtaining value of last serial column after insert
Date: 2001-11-14 01:00:17
Message-ID: 20011113170017.A11240@cm.nu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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(at)cm(dot)nu
http://www.cm.nu/~shane/
PGP: 1024D/FFE3035D
A0ED DAC4 77EC D674 5487
5B5C 4F89 9A4E FFE3 035D

Browse pgsql-general by date

  From Date Subject
Next Message Scott Muir 2001-11-14 01:32:12 Vacuuming - how often?
Previous Message Glen Parker 2001-11-14 00:28:23 Re: CREATE DATABASE WITH LOCATION