Getting last insert value

Поиск
Список
Период
Сортировка
От Yasir Malik
Тема Getting last insert value
Дата
Msg-id Pine.SGI.4.58.0311151003320.76056@guinness.cs.stevens-tech.edu
обсуждение исходный текст
Ответы Re: Getting last insert value
Re: Getting last insert value
Список pgsql-sql
Hello,
I have a table with many fields, and one of the fields is of type serial.
I will do many inserts, and there will be many repeats of the other fields
in the table, but, obviously, the serial field will be unique for all the
rows.  How can I get the value of serial field of the last row I inserted.
I know I can select the maximum value from the serial field, but is there
a better way, preferably something that takes constant time.
Thanks,
Yasir Malik


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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: Programatically switching database
Следующее
От: Guillaume LELARGE
Дата:
Сообщение: Re: Getting last insert value