Last_Inserted Value

Поиск
Список
Период
Сортировка
От Andre Schubert
Тема Last_Inserted Value
Дата
Msg-id 3CA2CF1F.3451C5B4@km3.de
обсуждение исходный текст
Ответы Re: Last_Inserted Value  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-admin
Hi all,

i have a little question on getting the last inserted value from a
table.

Lets say i have a transaction which does the following.

insert into foo values(1);
insert into bar values(2);
insert into foobar values(3);

All three tables use the same sequence to increment their id.
I want to know if it is possible to find the id of the inserted value of
foo.

Can i do a select id from foo order by id desc limit 1 before the end of
the transaction,
does this return exactly the row i inserted for this transaction?

Thanks in advance

В списке pgsql-admin по дате отправления:

Предыдущее
От: "Marc Mitchell"
Дата:
Сообщение: pg_dump and views
Следующее
От: "Marin Dimitrov"
Дата:
Сообщение: Re: Last_Inserted Value