From: | Scott Marlowe <scott(dot)marlowe(at)ihs(dot)com> |
---|---|
To: | ameen eetemadi <ameen78101(at)yahoo(dot)com> |
Cc: | <pgsql-php(at)postgresql(dot)org> |
Subject: | Re: type of a field |
Date: | 2002-05-07 15:49:17 |
Message-ID: | Pine.LNX.4.33.0205070946210.17503-100000@css120.ihs.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-php |
Short answer: You can't
Long answer: There are many workarounds.
Workaround 1:
dump the table with pg_dump dbase -t tablename
edit dump file to change table definition
drop and reload table.
Workaround 2:
Let's say you wanna change a varchar to a text type.
Original table t1:
col | type
----------
nam | varchar(32)
id | int4
select nam::text, id into t2 from t1;
drop table t1;
alter table t2 rename to t1;
You can do the above in a transaction if you are on a live database. I'd
back up the data first just to be sure.
On Tue, 7 May 2002, ameen eetemadi wrote:
> I want to change the type of a field in postgres .
> How can I do it ?
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Health - your guide to health and wellness
> http://health.yahoo.com
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
>
From | Date | Subject | |
---|---|---|---|
Next Message | Keary Suska | 2002-05-07 16:18:59 | Re: type of a field |
Previous Message | Dan Wilson | 2002-05-07 15:20:34 | Re: type of a field |