From: Scott Marlowe <scott.marlowe@ihs.com>
To: ameen eetemadi <ameen78101@yahoo.com>
Cc: pgsql-php@postgresql.org
Subject: Re: type of a field
Date: Tue, 7 May 2002 09:49:17 -0600 (MDT)
Message-ID: <Pine.LNX.4.33.0205070946210.17503-100000@css120.ihs.com> (raw)
In-Reply-To: <20020507130037.5405.qmail@web12603.mail.yahoo.com>
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
>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-php@postgresql.org
Cc: scott.marlowe@ihs.com, ameen78101@yahoo.com
Subject: Re: type of a field
In-Reply-To: <Pine.LNX.4.33.0205070946210.17503-100000@css120.ihs.com>
References: <20020507130037.5405.qmail@web12603.mail.yahoo.com> <Pine.LNX.4.33.0205070946210.17503-100000@css120.ihs.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox