Re: Howto change column length - Mailing list pgsql-general

From bpalmer
Subject Re: Howto change column length
Date
Msg-id Pine.BSO.4.33.0111061147140.8406-100000@mizer.crimelabs.net
Whole thread Raw
In response to Howto change column length  ("DC" <danc@bspmail.com>)
Responses Re: Howto change column length  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
List pgsql-general
> I have a column (ie name varchar(10))
> and I want to alter it to varchar(20)
> I've looked throught the docementation and web for examples (no luck),
> can anyone help?

That can't be done.  Once the datatype has been set,  it can't be changed
(how would changing it from 20 to 10 work?  how about from varchar to int,
etc).  With the limitation of not being able to drop a column yet,  you
would need to create the new table and copy all the data from one to the
other.

- Brandon

----------------------------------------------------------------------------
 c: 646-456-5455                                            h: 201-798-4983
 b. palmer,  bpalmer@crimelabs.net           pgp:crimelabs.net/bpalmer.pgp5



pgsql-general by date:

Previous
From: Jeff Eckermann
Date:
Subject: Re: copy command with PSQL
Next
From: Mark Nickel
Date:
Subject: Re: copy command with PSQL