Re: OID use

From: Peter Mount <peter(at)retep(dot)org(dot)uk>
To: Jeff Davis <jdavis(at)genesiswd(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: OID use
Date: 2000-10-09 11:36:28
Message-ID: Pine.LNX.4.21.0010091235250.772-100000@maidast.demon.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)retep(dot)org(dot)uk http://www.retep.org.uk
PostgreSQL JDBC Driver http://www.retep.org.uk/postgres/
Java PDF Generator http://www.retep.org.uk/pdf/

In response to

  • OID use at 2000-10-06 03:20:16 from Jeff Davis

Browse pgsql-general by date

  From Date Subject
Next Message Peter Mount 2000-10-09 11:39:33 Re: OIDs and JDBC
Previous Message Peter Mount 2000-10-09 11:34:44 Re: OIDs and JDBC