Re: OID use - Mailing list pgsql-general

From Peter Mount
Subject Re: OID use
Date
Msg-id Pine.LNX.4.21.0010091235250.772-100000@maidast.demon.co.uk
Whole thread Raw
In response to OID use  (Jeff Davis <jdavis@genesiswd.com>)
List pgsql-general
On Thu, 5 Oct 2000, Jeff Davis wrote:

> Here is essentially what I am trying to do:
>
> I want to have a 'serial' type column, so that it provides a unique
> identifier for records. However, when I do the insert, I need the know
> what value was assigned to that so I can use it in another table for
> reference, by doing another insert.

When you have used your SERIAL, the currval() function holds the last
value inserted. It's the only way to guarantee getting the correct value,
especially when there's multiple sessions going on.

Peter

--
Peter T Mount peter@retep.org.uk http://www.retep.org.uk
PostgreSQL JDBC Driver http://www.retep.org.uk/postgres/
Java PDF Generator http://www.retep.org.uk/pdf/



pgsql-general by date:

Previous
From: Peter Mount
Date:
Subject: Re: OIDs and JDBC
Next
From: Peter Mount
Date:
Subject: Re: OIDs and JDBC