From: | Neil Conway <neilc(at)samurai(dot)com> |
---|---|
To: | "Williams, Travis L, " NPONS <tlw(at)att(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Changing column question.. |
Date: | 2002-12-19 21:36:54 |
Message-ID: | 1040333814.13723.4.camel@tokyo |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Thu, 2002-12-19 at 16:07, Williams, Travis L, NPONS wrote:
> I just want to make sure that from what I understand I can not change
> a column type from varchar(20) to text or anything else without
> dropping the table.
No, you don't need to drop the table. You can add a new column of the
type you want to change the existing column two, then move the data from
the old data to the new column (using UPDATE), then drop the old column,
and rename the new column to the name of the old column. This works in
7.3+ (as that's the first version that allowed you to drop columns).
> I want it to insert everything up to 20 chars then drop the rest..
Then call substring() on the value you're inserting to chop it down to
20 chars or less.
Cheers,
Neil
--
Neil Conway <neilc(at)samurai(dot)com> || PGP Key ID: DB3C29FC
From | Date | Subject | |
---|---|---|---|
Next Message | scott.marlowe | 2002-12-19 21:41:40 | Re: trouble caused by change in 7.3 handling of '' in |
Previous Message | Williams, Travis L, NPONS | 2002-12-19 21:07:54 | Changing column question.. |