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

Re: Obtaining the primary key of the record just inserted

From: Hans-Peter Oeri <hp(at)oeri(dot)ch>
To: Oliveiros Cristina <oliveiros(dot)cristina(at)marktest(dot)pt>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Obtaining the primary key of the record just inserted
Date: 2007-11-08 19:24:49
Message-ID: 47336281.1040906@oeri.ch (view raw or flat)
Thread:
Lists: pgsql-novice
Hi!

Oliveiros Cristina wrote:
> I have the need to know the primary key assigned to a record I've just
> INSERTed .
> Is there an easy way to solve this ?
I prefer:
INSERT INTO [...] RETURNING id;

HPO

In response to

pgsql-novice by date

Next:From: David MonarchiDate: 2007-11-09 00:13:28
Subject: Constructing two-dimensional arrays from a query
Previous:From: Sean DavisDate: 2007-11-08 18:01:48
Subject: Re: Obtaining the primary key of the record just inserted

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