resetting sequence to cur max value

Поиск
Список
Период
Сортировка
От developer@wexwarez.com
Тема resetting sequence to cur max value
Дата
Msg-id 4075.192.168.1.235.1165941536.squirrel@mail.wexwarez.com
обсуждение исходный текст
Ответы Re: resetting sequence to cur max value  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
I am migrating a system from hsqldb to postgresql.  I have a bunch of
installs of this system live so moving the data is a headache.  I was
using identities in hsqldb and now I am using sequences.  I was able to
move all my data over however I am having an issue with the sequences.  I
default them all to start at a certain number; this works great for a
fresh install.

However when working with existing data the default is < the current
number.  ANd I have several installs and they are all different numbers.

Is there a way to set it up so it knows to skip past existing ids?

I would rather an automated solution  but I was even trying something like
this:

ALTER SEQUENCE seq_address restart with (select max(id) from address)

I guess that doesn't work because it wants a constant.

Any suggestions?
thanks


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

Предыдущее
От: Richard Broersma Jr
Дата:
Сообщение: Are updateable view as a linked table in ms-access a bad idea?
Следующее
От: "Belinda M. Giardine"
Дата:
Сообщение: date comparisons