Re: Ref to last INSERT on a table without OIDs?
От | Neil Conway |
---|---|
Тема | Re: Ref to last INSERT on a table without OIDs? |
Дата | |
Msg-id | 1043864169.519.11.camel@tokyo обсуждение исходный текст |
Ответ на | Ref to last INSERT on a table without OIDs? ("Mark Cave-Ayland" <mark.cave-ayland@webbased.co.uk>) |
Список | pgsql-general |
On Mon, 2003-01-27 at 10:59, Mark Cave-Ayland wrote: > Hopefully just a quick one: how is it possible to obtain a reference to > the last inserted record in a table which is created without oids? I > would like to dump/restore some of our larger tables so they don't use > oids, however I am concerned that simply getting the current PK sequence > value after insertion within a transaction is not safe when many people > are accessing the table/sequence at once? Can anyone clarify this? We're > using the latest and greatest 7.3.1. currval() is safe even in the face of concurrent insertions into the table: it always returns the last value that the sequence generated in the current session, regardless of whether any additional values have been generated from the sequence by other clients. See the docs on currval() for more information: http://www.ca.postgresql.org/users-lounge/docs/7.3/postgres/functions-sequence.html Cheers, Neil -- Neil Conway <neilc@samurai.com> || PGP Key ID: DB3C29FC
В списке pgsql-general по дате отправления: