Re: sequence

Поиск
Список
Период
Сортировка
От Manuel Sugawara
Тема Re: sequence
Дата
Msg-id m31xla38vx.fsf@conexa.fciencias.unam.mx
обсуждение исходный текст
Ответ на sequence  (Robert Morgan <robert_@ihug.co.nz>)
Список pgsql-novice
Robert Morgan <robert_@ihug.co.nz> writes:

> Do I need to drop the existing column and create a new one using
> create sequence.....?

No, or at least not necessarily. You can create the sequence and then
alter the existing column definition to get its default value from
that sequence, for instance, suppose that your table name is foo and
the column's name is bar:

create sequence new_seq;
select setval('new_seq', select max(bar) from foo);
alter table foo alter column bar set default nextval(new_seq');

Regards,
Manuel.

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

Предыдущее
От:
Дата:
Сообщение: Re: phppgadmin on Debian/unstable (sort of)
Следующее
От: "Rajan Bhide"
Дата:
Сообщение: Re: !!URGENT!! Should I keep INDEX on the table?