From: | Bjørn T Johansen <btj(at)havleik(dot)no> |
---|---|
To: | Tino Wildenhain <tino(at)wildenhain(dot)de> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Alter field type? |
Date: | 2004-08-26 09:49:09 |
Message-ID: | 412DB215.30308@havleik.no |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
That looks like a recipe, thx... :)
BTJ
Tino Wildenhain wrote:
> Hi,
>
> Am Do, den 26.08.2004 schrieb Bjørn T Johansen um 9:48:
>
>>Is it possible to alter field type (from varchar to text) without making
>>a new table?
>
>
> In 8.0 I think.
> Common practice in 7.4.x is:
>
> BEGIN work;
> ALTER TABLE yourtable ADD COLUMN tempcolumn text;
> UPDATE yourtable SET tempcolumn = origcolumn;
> ALTER TABLE yourtable DROP COLUMN origcolumn;
> ALTER TABLE yourtable RENAME tempcolumn TO origcolumn;
> COMMIT work;
>
> Since text and (unlimited) varchar are quite the same,
> you could get away with modifying the system tables.
> But I would not recomment to do so.
>
> Regards
> Tino Wildenhain
>
--
-----------------------------------------------------------------------------------------------
Bjørn T Johansen (BSc,MNIF)
Executive Manager
btj(at)havleik(dot)no Havleik Consulting
Phone : +47 21 69 15 20 Bjørnebærstien 57
Fax : +47 41 13 09 15 N-1348 Rykkinn
Cellular : +47 926 93 298 http://www.havleik.no
-----------------------------------------------------------------------------------------------
Someone wrote:
"I understand that if you play a Windows CD backwards you hear strange
Satanic messages"
To which someone replied:
"It's even worse than that; play it forwards and it installs Windows"
-----------------------------------------------------------------------------------------------
From | Date | Subject | |
---|---|---|---|
Next Message | Markus Bertheau | 2004-08-26 09:57:23 | Re: Alter field type? |
Previous Message | Michal Hlavac | 2004-08-26 09:41:30 | Stored procedure failure |