From: Scott Marlowe <scott.marlowe@gmail.com>
To: Oliveiros Cristina <oliveiros.cristina@marktest.pt>
Cc: pgsql-sql@postgresql.org
Subject: Re: Obtaining the primary key of the record just inserted
Date: Thu, 8 Nov 2007 12:03:00 -0600
Message-ID: <dcc563d10711081003o515df294mdbf2b3bde2fe6b85@mail.gmail.com> (raw)
In-Reply-To: <009901c82230$a799d3b0$ec5a3d0a@marktestcr.marktest.pt>
References: <009901c82230$a799d3b0$ec5a3d0a@marktestcr.marktest.pt>
On Nov 8, 2007 11:56 AM, Oliveiros Cristina
<oliveiros.cristina@marktest.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;
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: scott.marlowe@gmail.com, oliveiros.cristina@marktest.pt
Subject: Re: Obtaining the primary key of the record just inserted
In-Reply-To: <dcc563d10711081003o515df294mdbf2b3bde2fe6b85@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox