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:29:57
Message-ID: BANLkTikbdn_b3VtA4vQ+m=HFSrs5n0n4_A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, May 17, 2011 at 2:21 PM, Raymond O'Donnell <rod(at)iol(dot)ie> wrote:
> That's because of what I just mentioned above. :-) It's not a type: it's
> just a shortcut. What you need to do instead is something like this:
>
>  -- Create the sequence.
>  create sequence users_id_seq;
>
>  -- Tell the column to pull default values from the sequence.
>  alter table users alter column id set default nextval('users_id_seq');
>
>  -- Establish a dependency between the column and the sequence.
>  alter sequence users_id_seq owned by users.id;

Yup - that explains that the shortcut doesn't work for existing tables
but only during CREATE TABLE. Otherwise I will need to manually CREATE
SEQUENCE...blah blah blah.

Thank you!

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Susan Cassidy 2011-05-17 18:32:17 Re: Remove Modifiers on Table
Previous Message Raymond O'Donnell 2011-05-17 18:21:06 Re: Remove Modifiers on Table