Re: alter table question

From: "Gregory Wood" <gregw(at)com-stock(dot)com>
To: "Medi Montaseri" <medi(at)cybershell(dot)com>
Cc: "PostgreSQL-General" <pgsql-general(at)postgresql(dot)org>
Subject: Re: alter table question
Date: 2002-03-04 12:21:57
Message-ID: 012e01c1c378$5c61f520$7889ffcc@comstock.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)cybershell(dot)com>
To: <pgsql-general(at)postgresql(dot)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(at)CyberShell(dot)com
> Unix Distributed Systems Engineer HTTP://www.CyberShell.com
> CyberShell Engineering
> -------------------------------------------------------------------------
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Gregory Wood 2002-03-04 12:32:43 Re: oids vs. serial question
Previous Message Ioannis 2002-03-04 11:57:44 postgre performance question