Retrieve primary key after inserting

From: Alex Dovlecel <dovle(at)kbs(dot)twi(dot)tudelft(dot)nl>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Retrieve primary key after inserting
Date: 2002-11-19 13:36:13
Message-ID: E18E8Y1-00046R-00@ford.kbs.twi.tudelft.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hello all,

Is there a special mechanism to retrieve the primary key from a record that I
just inserted?

For example, I have a table with the PK of SERIAL type. So when inserting I
let the psql to choose the primary key. But how can I get the primary key
that was set for the record? BEcause i have a relation based on that primary
key... !!! (I think it is a classic problem...)

Does psql have some special feature to help me overcome this problem ?

Tx
dovle

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Bruce Momjian 2002-11-19 14:05:08 Re: documentation
Previous Message Dave Cramer 2002-11-19 12:40:53 Re: psql and passwd