Re: Object Relational, Foreign Keys and Triggers

Поиск
Список
Период
Сортировка
От Tino Wildenhain
Тема Re: Object Relational, Foreign Keys and Triggers
Дата
Msg-id 1106674555.4014.164.camel@Andrea.peacock.de
обсуждение исходный текст
Ответ на Re: Object Relational, Foreign Keys and Triggers  (Alex Turner <armtuk@gmail.com>)
Список pgsql-general
Am Dienstag, den 25.01.2005, 08:36 -0500 schrieb Alex Turner:
> Actualy max() works just fine.  It's not the solution I use in the
> middle tier, but it works for a functional example.  both max() and
> currval() are bad because they can cause a race condition where the
> sequence has been incremented by another thread.  It's always better
> to get nextval('sequence') and store it in a local var, then use it in
> the main insert and corresponding sub-inserts.

No, thats wrong. If you read the documentation again on that matter, you
will see. currval() works on at least one nextval() in the connection
you are running and therefore keeps showing the last result of nextval()
in this very connection - no matter what other connections/sessions do.
Thats the whole point of sequences anyway.

HTH
Tino


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

Предыдущее
От: "Thomas Chille (spoon)"
Дата:
Сообщение: difficult JOIN
Следующее
От: Michael Fuhr
Дата:
Сообщение: Re: Validating user-input to be inserted in regular expressions