Last Id?

Поиск
Список
Период
Сортировка
От Jan Danielsson
Тема Last Id?
Дата
Msg-id 431B368B.6010109@gmail.com
обсуждение исходный текст
Ответы Re: Last Id?  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Last Id?  (Michael Glaesemann <grzm@myrealbox.com>)
Список pgsql-novice
Hello all,

   I know how do do this in IBM DB2 and MySQL, but now my interrest has
shifted towards postgresql; I need to be able to insert a row, and find
out which id it was assigned. (I'm talking about using sequences here).

   I have seen a few "currval", "last_value", tricks and such, but they
aren't good enough, AFAICT, since they only work when I can guarantee
that no one else will insert a new record between the time that I insert
one, and query for the last_value.

   In IBM DB2 and MySQL there's a connection specific "last id" value
which can be queried. I assume there's something similar in postgresql
-- but what is it?

--
Kind Regards,
Jan Danielsson
Te audire no possum. Musa sapientum fixa est in aure.

Вложения

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

Предыдущее
От: bob_a@xypro.com
Дата:
Сообщение: ERROR: 42P01: relation "
Следующее
От: "Toff"
Дата:
Сообщение: Inserting data in other db