Re: Remove Modifiers on Table - Mailing list pgsql-general

From Carlos Mennens
Subject Re: Remove Modifiers on Table
Date
Msg-id BANLkTimB+NE4icu6PBD=4tJEc=rZRu2t5w@mail.gmail.com
Whole thread Raw
In response to Re: Remove Modifiers on Table  (Carlos Mennens <carlos.mennens@gmail.com>)
Responses Re: Remove Modifiers on Table  (Raymond O'Donnell <rod@iol.ie>)
List pgsql-general
On Tue, May 17, 2011 at 12:57 PM, Carlos Mennens
<carlos.mennens@gmail.com> wrote:
> On Tue, May 17, 2011 at 12:38 PM, Raymond O'Donnell <rod@iol.ie> wrote:
>> Yes, that's exactly right - SERIAL does it all for you. The mistake some
>> people make, on the other hand, is thinking that SERIAL is a type in its own
>> right - it's not, it just does all those steps automatically.

So if I have an existing column in my table with a INT data type, I
can't seem to understand how to convert this on my 8.4 production
server:

ALTER TABLE users ALTER COLUMN id TYPE SERIAL;
ERROR:  type "serial" does not exist

I verified from the docs that 8.4 does support SERIAL but how I
convert this data type, I can't seem to figure out. Below is my table
definition:

orlando=# \d users
            Table "public.users"
 Column |         Type          | Modifiers
--------+-----------------------+-----------
 id     | integer               | not null
 fname  | character varying(40) | not null
 lname  | character varying(40) | not null
 email  | character varying(40) | not null
 office | character varying(5)  | not null
 dob    | date                  | not null
 title  | character varying(40) | not null
Indexes:
    "users_pkey" PRIMARY KEY, btree (id)
    "users_email_key" UNIQUE, btree (email)

pgsql-general by date:

Previous
From: Carlos Mennens
Date:
Subject: Re: Remove Modifiers on Table
Next
From: Wells Oliver
Date:
Subject: Can't unsubscribe