Re: Remove Modifiers on Table

Поиск
Список
Период
Сортировка
От Carlos Mennens
Тема Re: Remove Modifiers on Table
Дата
Msg-id BANLkTinywuoOXXFUGRPu5B9pG0JauEHfDg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Remove Modifiers on Table  (Adrian Klaver <adrian.klaver@gmail.com>)
Ответы Re: Remove Modifiers on Table
Список pgsql-general
On Tue, May 17, 2011 at 2:32 PM, Susan Cassidy <scassidy@edgewave.com> wrote:
> Don't forget to use setval to set the current value of the sequence to the highest number used in the data already,
sothat the next insertion uses a new, unused value. 

Doesn't the SERIAL shortcut automatically do this on the fly? How
would I set this?

ALTER TABLE table_name ALTER COLUMN id SET DEFAULT nextval('foo_seq_id');

?

On Tue, May 17, 2011 at 2:33 PM, Adrian Klaver <adrian.klaver@gmail.com> wrote:
> It will work for an existing table if you are adding a column with 'type'
> SERIAL. You just cannot change an existing column to 'type' SERIAL.

Yup,

That's what I meant to say in a more clear and function statement ;)

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

Предыдущее
От: Susan Cassidy
Дата:
Сообщение: Re: Remove Modifiers on Table
Следующее
От: Susan Cassidy
Дата:
Сообщение: Re: Remove Modifiers on Table