Re: auto generated keys

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: auto generated keys
Дата
Msg-id 6503.1048084063@sss.pgh.pa.us
обсуждение исходный текст
Ответ на auto generated keys  ("Paul Sorenson" <pauls@classware.com.au>)
Список pgsql-jdbc
"Paul Sorenson" <pauls@classware.com.au> writes:
> I have a somewhat klunky hack in an application which immediately after
> inserting a row into a table with a "serial" for the primary key I do a
> select based on values I know to be unique (at least for the table in
> question).

You can use currval() to read the assigned sequence value after the
insertion.  The other common approach is to select the nextval()
explicitly and then insert it into the new row, instead of allowing
nextval() to be invoked by default.  See the FAQ ...

            regards, tom lane

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

Предыдущее
От: Dave Cramer
Дата:
Сообщение: Re: Follow-up OpenOffice and Postgres 7.3.2
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: Follow-up OpenOffice and Postgres 7.3.2