Re: alter table question - Mailing list pgsql-general

From Gregory Wood
Subject Re: alter table question
Date
Msg-id 012e01c1c378$5c61f520$7889ffcc@comstock.com
Whole thread Raw
In response to alter table question  (Medi Montaseri <medi@cybershell.com>)
List pgsql-general
One option would be to rename the column (IIRC, that's allowable by
PostgreSQL) and then add the column back in with the datatype that you want,
then repopulate that field with the data from the old column. Of course,
this just creates an unused, unwanted column just hanging around. Not to
mention that it could be a real problem if the column is part of a foreign
key or has constraints tied to it.

Personally, if you can afford to do it, I think drop-create is the best
solution, as painful as that is to admit.

Greg

----- Original Message -----
From: "Medi Montaseri" <medi@cybershell.com>
To: <pgsql-general@postgresql.org>
Sent: Saturday, March 02, 2002 3:43 AM
Subject: [GENERAL] alter table question


> How can I alter  a column's data type in PG?
>
> If PG does not support such a change, what is a typical or clever
> way of doing that?
>
> I had to drop-create table a couple of times, but that does not
> feel right. I know informix allows you to do that.
>
> Thanks
>
> --
> -------------------------------------------------------------------------
> Medi Montaseri                               medi@CyberShell.com
> Unix Distributed Systems Engineer            HTTP://www.CyberShell.com
> CyberShell Engineering
> -------------------------------------------------------------------------
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>


pgsql-general by date:

Previous
From: Ioannis
Date:
Subject: postgre performance question
Next
From: "Gregory Wood"
Date:
Subject: Re: oids vs. serial question