Re: Alter field type?
От | Bjørn T Johansen |
---|---|
Тема | Re: Alter field type? |
Дата | |
Msg-id | 412DB215.30308@havleik.no обсуждение исходный текст |
Ответ на | Re: Alter field type? (Tino Wildenhain <tino@wildenhain.de>) |
Список | 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@havleik.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" -----------------------------------------------------------------------------------------------
В списке pgsql-general по дате отправления: