Re: Looking for help regarding getting the latest inserted sequence value.
В списке pgsql-general по дате отправления:
| От | Jan de Visser |
|---|---|
| Тема | Re: Looking for help regarding getting the latest inserted sequence value. |
| Дата | |
| Msg-id | 200706292026.54358.jdevisser@digitalfairway.com обсуждение исходный текст |
| Ответ на | Looking for help regarding getting the latest inserted sequence value. ("Mavinakuli, Prasanna (STSD)" <prasanna.b-m@hp.com>) |
| Список | pgsql-general |
On Thursday 28 June 2007 01:31:33 Mavinakuli, Prasanna (STSD) wrote:
> .And getting the max(id) from the table.
Instead of that, use select currval('sequence'). currval will
"
Return the value most recently obtained by nextval for this sequence in the
current session. (An error is reported if nextval has never been called for
this sequence in this session.) Notice that because this is returning a
session-local value, it gives a predictable answer whether or not other
sessions have executed nextval since the current session did.
"
(or so the docs tell me:
http://www.postgresql.org/docs/8.2/interactive/functions-sequence.html).
jan
--
--------------------------------------------------------------
Jan de Visser jdevisser@digitalfairway.com
Baruk Khazad! Khazad ai-menu!
--------------------------------------------------------------
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера