Skip site navigation (1) Skip section navigation (2)

Getting back the primary key after INSERT

From: "Scott W(dot) Hill" <shill(at)verisign(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Getting back the primary key after INSERT
Date: 2001-10-22 20:40:28
Message-ID: 06F9B658-C72D-11D5-9984-003065BDABEC@verisign.com (view raw or flat)
Thread:
Lists: pgsql-novice
I'm pretty new with JDBC and Postgres. Here's my question:

I have a table with an automatically incrementing key. I'm inserting 
things into the table via an INSERT statement from JDBC. Once I do the 
INSERT, I want to know what new number was assigned by the database to 
the row that I just inserted. Any ideas?

--Scott


Responses

pgsql-novice by date

Next:From: Mihai GheorghiuDate: 2001-10-22 21:23:49
Subject: Re: Problems setting up PostgreSQL and Tomcat JDBC connection
Previous:From: Travis HoytDate: 2001-10-22 19:41:20
Subject: views, with check option

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group