Re: Obtaining the primary key of the record just inserted

From: "Oliveiros Cristina" <oliveiros(dot)cristina(at)marktest(dot)pt>
To: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Obtaining the primary key of the record just inserted
Date: 2007-11-08 19:10:41
Message-ID: 00c501c8223b$0dde0c90$ec5a3d0a@marktestcr.marktest.pt
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

It worked perfectly.
Thanks a million, Scott.

Best,
Oliveiros
----- Original Message -----
From: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
To: "Oliveiros Cristina" <oliveiros(dot)cristina(at)marktest(dot)pt>
Cc: <pgsql-sql(at)postgresql(dot)org>
Sent: Thursday, November 08, 2007 6:03 PM
Subject: Re: [SQL] Obtaining the primary key of the record just inserted

> On Nov 8, 2007 11:56 AM, Oliveiros Cristina
> <oliveiros(dot)cristina(at)marktest(dot)pt> wrote:
>>
>> Hello, All,
>>
>> 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 ?
>>
>> Similar to SQLServer's SELECT scope_identity() ; ?
>
> In 8.2 and up:
>
> insert into table a (info) values ('abc') returning id;
>

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Philippe Lang 2007-11-08 20:05:43 quote_nullable alternative?
Previous Message Scott Marlowe 2007-11-08 18:03:00 Re: Obtaining the primary key of the record just inserted