[GENERAL] get inserted id from transaction - PG 9.2

Поиск
Список
Период
Сортировка
От Patrick B
Тема [GENERAL] get inserted id from transaction - PG 9.2
Дата
Msg-id CAJNY3ivakPDmoNZGmsBeGpK-Y_hWZzQRK9FRMacDS7pGGoz0yw@mail.gmail.com
обсуждение исходный текст
Ответы 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>)
Список 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 по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [GENERAL] Bad planning data resulting in OOM killing of postgres
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: [GENERAL] get inserted id from transaction - PG 9.2