Re: nextval() clarification

Поиск
Список
Период
Сортировка
От Greg Donald
Тема Re: nextval() clarification
Дата
Msg-id ea9da26c040913135570c29353@mail.gmail.com
обсуждение исходный текст
Ответ на Re: nextval() clarification  (Ennio-Sr <nasr.laili@tin.it>)
Ответы Re: nextval() clarification  (Ron St-Pierre <rstpierre@syscor.com>)
Re: nextval() clarification  (Michael Fuhr <mike@fuhr.org>)
Список pgsql-novice
On Mon, 13 Sep 2004 21:54:11 +0200, Ennio-Sr <nasr.laili@tin.it> wrote:
> I think you should put <nextval(....)> directly into the INSERT
> instruction, so that it advances only once per added record.
> Have a look at Documentation PostgreSQL 7.4, Ch 9.11, table 9.34.
> HTH

I would but then I don't know how to ensure I return that exact same
id from the insert, like mysql_insert_id() does.  That's the whole
reason why I aquire the id first, so I know what it is after the
insert.  SELECT max(id) would be off under load I think.

I just didn't understand why it appeared to be +2 and not +1 as a
novice might expect.  But now I get it.  Thanks to all.

--
Greg Donald
http://destiney.com/

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

Предыдущее
От: Ron St-Pierre
Дата:
Сообщение: Re: nextval() clarification
Следующее
От: vhikida@inreach.com
Дата:
Сообщение: Re: Subnovice question