Last_Inserted Value

From: Andre Schubert <andre(dot)schubert(at)km3(dot)de>
To: "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Last_Inserted Value
Date: 2002-03-28 08:06:55
Message-ID: 3CA2CF1F.3451C5B4@km3.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Marin Dimitrov 2002-03-28 11:11:39 Re: Last_Inserted Value
Previous Message Marc Mitchell 2002-03-27 22:26:15 pg_dump and views