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:07:25
Message-ID: BANLkTimB+NE4icu6PBD=4tJEc=rZRu2t5w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, May 17, 2011 at 12:57 PM, Carlos Mennens
<carlos(dot)mennens(at)gmail(dot)com> wrote:
> On Tue, May 17, 2011 at 12:38 PM, Raymond O'Donnell <rod(at)iol(dot)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)

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Wells Oliver 2011-05-17 18:12:06 Can't unsubscribe
Previous Message Carlos Mennens 2011-05-17 16:57:58 Re: Remove Modifiers on Table