Re: [INTERFACES] locking on database updates

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [INTERFACES] locking on database updates
Дата
Msg-id 23883.944588735@sss.pgh.pa.us
обсуждение исходный текст
Ответ на RE: [INTERFACES] locking on database updates  (Nicolas Huillard <nhuillard@ghs.fr>)
Список pgsql-interfaces
> The problem is that this does not actually give me the number that
> was just created.  As there is no guarantee that the other fields in
> the table are unique (hence the serial field in the first place) I cannot
> simply do a select to retrieve it.

Easiest answer is to do
SELECT nextval('sequence_object');

and then INSERT the new row into your table using the value you just
obtained as an explicit value for the ID column, thus overriding the
default expression.
        regards, tom lane


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

Предыдущее
От: Nicolas Huillard
Дата:
Сообщение: RE: [INTERFACES] locking on database updates
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [INTERFACES] locking on database updates