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

Re: nooby q: how get a row just inserted?

From: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
To: Kenneth Tilton <kentilton(at)gmail(dot)com>
Cc: Martin Gainty <mgainty(at)hotmail(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: nooby q: how get a row just inserted?
Date: 2009-05-31 00:55:15
Message-ID: dcc563d10905301755y1497011dv1e45e9c3b7c35c75@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-general
On Sat, May 30, 2009 at 6:52 PM, Kenneth Tilton <kentilton(at)gmail(dot)com> wrote:
>
>
> Martin Gainty wrote:
>>
>> yes i would suggest using OID
>> included in Postgres distro is a sample create table,index named
>> fti.pl
>>
>> does this answer your question?
>
> oid would have been fine, but I am going with Rodrigo's suggestion to simply
> use the returning option on insert which I somehow missed.

One of the cool features of returning is that it can return sets.

insert into table values ('abc'),('def'),('ghi') returning id;
1
2
3

In response to

pgsql-general by date

Next:From: WojtekDate: 2009-05-31 06:23:52
Subject: PG_Bulkloader (or other tools) and partitions
Previous:From: Kenneth TiltonDate: 2009-05-31 00:52:56
Subject: Re: nooby q: how get a row just inserted?

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