Re: Migration problem - serial fields

Поиск
Список
Период
Сортировка
Искать
От
Tom Lane
Тема
Re: Migration problem - serial fields
Дата
Msg-id
11808.1015523961@sss.pgh.pa.us
Ответ на
Migration problem - serial fields (rick@planetdigital.com (Rick))
Список
Дерево обсуждения
Migration problem - serial fields rick@planetdigital.com (Rick)
Re: Migration problem - serial fields Jochen Mader <jochen@teg-webmedia.de>
Re: Migration problem - serial fields Tom Lane <tgl@sss.pgh.pa.us>
Re: Migration problem - serial fields "Serkan Bektas" <sbektas@karincaint.com.tr>
rick@planetdigital.com (Rick) writes:
> Obviously my transfer did not update the sequence used by the serial
> field -- it's still stuck at 1.  However, I'm just not sure of the
> best course of action.

No, it wouldn't.  After you transfer the data, advance the sequence
with something like

SELECT setval('seqname', (SELECT max(serialcol) FROM table));

and then you're good to go.

			regards, tom lane
В списке pgsql-general по дате отправления
От: Tom Lane
Дата:
Сообщение: Re: Temp Tables
От: Neil Conway
Дата:
FAQ