Last_Inserted Value - Mailing list pgsql-admin

From Andre Schubert
Subject Last_Inserted Value
Date
Msg-id 3CA2CF1F.3451C5B4@km3.de
Whole thread Raw
Responses Re: Last_Inserted Value  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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 by date:

Previous
From: "Marc Mitchell"
Date:
Subject: pg_dump and views
Next
From: "Marin Dimitrov"
Date:
Subject: Re: Last_Inserted Value