Re: Remove Modifiers on Table

From: Carlos Mennens <carlos(dot)mennens(at)gmail(dot)com>
To: PostgreSQL <pgsql-general(at)postgresql(dot)org>
Subject: Re: Remove Modifiers on Table
Date: 2011-05-17 18:41:46
Message-ID: BANLkTinywuoOXXFUGRPu5B9pG0JauEHfDg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, May 17, 2011 at 2:32 PM, Susan Cassidy <scassidy(at)edgewave(dot)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, so that 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(dot)klaver(at)gmail(dot)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 ;)

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andreas Kretschmer 2011-05-17 18:44:41 Re: Can't unsubscribe
Previous Message Adrian Klaver 2011-05-17 18:33:33 Re: Remove Modifiers on Table