[GENERAL] get inserted id from transaction - PG 9.2 - Mailing list pgsql-general

From Patrick B
Subject [GENERAL] get inserted id from transaction - PG 9.2
Date
Msg-id CAJNY3ivakPDmoNZGmsBeGpK-Y_hWZzQRK9FRMacDS7pGGoz0yw@mail.gmail.com
Whole thread Raw
Responses Re: [GENERAL] get inserted id from transaction - PG 9.2  ("David G. Johnston" <david.g.johnston@gmail.com>)
Re: [GENERAL] get inserted id from transaction - PG 9.2  (Steve Atkins <steve@blighty.com>)
Re: [GENERAL] get inserted id from transaction - PG 9.2  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Hi all,

I'm simply doing an insert and I want to get the inserted id with a select. I'm doing this all in the same transactions.

Example:

BEGIN;

INSERT INTO test (id,name,description) VALUES (default,'test 1','testing insert');
SELECT FROM test ORDER BY id DESC; -- I don't see the inserted row here

COMMIT;

I only can see that inserted row if I do the select outside of this transaction.

How could I get that ? 

Thanks!
Patrick

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: [GENERAL] Bad planning data resulting in OOM killing of postgres
Next
From: "David G. Johnston"
Date:
Subject: Re: [GENERAL] get inserted id from transaction - PG 9.2