Re: reordering sequences

Поиск
Список
Период
Сортировка
От Gregory Wood
Тема Re: reordering sequences
Дата
Msg-id 018d01c10a25$99c7cb40$7889ffcc@comstock.com
обсуждение исходный текст
Ответ на reordering sequences  ("mike" <matrix@quadrent.net>)
Список pgsql-general
> is it at all possiable to reorder a squence? I'm finding that our
sequences get some what out step and messed and would like to ocassionaly
reorder them, though I'm unable to find anything that might be able to do
this.

BEGIN;
SELECT setval('MyTable_MySeq_SEQ',1);
UPDATE MyTable SET MySeq=nextval('MyTable_MySeq_SEQ');
COMMIT;

Of course this will screw up any foreign keys that you have that don't have
an ON UPDATE CASCADE set on them. Also, this is not guaranteed to preserve
the current sequence order, if that's important to you.

Greg


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [PATCH] Partial indices final?
Следующее
От: Jan Wieck
Дата:
Сообщение: Re: Toast question