| От | Bruno Wolff III |
|---|---|
| Тема | Re: Ref to last INSERT on a table without OIDs? |
| Дата | |
| Msg-id | 20030128170842.GB14694@wolff.to обсуждение |
| Ответ на | Ref to last INSERT on a table without OIDs? ("Mark Cave-Ayland" <mark.cave-ayland@webbased.co.uk>) |
| Список | pgsql-general |
On Tue, Jan 28, 2003 at 14:25:32 -0000, Mark Cave-Ayland <mark.cave-ayland@webbased.co.uk> 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. If you are trying to get the primary key of the last record inserted during the same database session, then using serial for the type of the primary key and the currval function is exactly what you want.
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера