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)