Re: Get the last inserted id

Поиск
Список
Период
Сортировка
От A. Kretschmer
Тема Re: Get the last inserted id
Дата
Msg-id 20080411174806.GA21064@a-kretschmer.de
обсуждение исходный текст
Ответ на Get the last inserted id  ("Nacef LABIDI" <nacef.l@gmail.com>)
Список pgsql-sql
am  Fri, dem 11.04.2008, um 19:23:04 +0200 mailte Nacef LABIDI folgendes:
> Hi all,
>  
> I was wondering if postgres can return the last ID inserted for a table which
> the primary key is autoincremented. I need to retrieve this ID in my code to
> continue processing on that inserted row.

Either with RETURNING:
http://www.postgresql.org/docs/current/static/sql-insert.html

or with currval():
http://www.postgresql.org/docs/current/static/functions-sequence.html


HTH, Andreas
-- 
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net


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

Предыдущее
От: "Nacef LABIDI"
Дата:
Сообщение: Re: Get the last inserted id
Следующее
От: Andrew Sullivan
Дата:
Сообщение: Re: Get the last inserted id