[GENERAL] change column data type from smallint to integer
Hello, we run 'out of space' in one of our columns which is smallint and we need to make it integer. I did some research and found out that the only way is to create a new column with integer data type, then SET new = old, then drop old and rename new like old [1]. Could somebody confirm if this is really the best way and if it is stable in respect to indexes, RI, triggers, stored procedures, etc. Thank you, Iv [1] http://www.foranewliberty.com/blog/archives/2005/01/15/changing-data-types-in-postgresql/ ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster
Re: [GENERAL] change column data type from smallint to integer
On Thu, Sep 08, 2005 at 04:22:07AM +0200, [EMAIL PROTECTED] wrote: Hi, > we run 'out of space' in one of our columns which is smallint and we > need to make it integer. > > I did some research and found out that the only way is to create a new > column with integer data type, then SET new = old, then drop old and > rename new like old [1]. > > Could somebody confirm if this is really the best way and if it is > stable in respect to indexes, RI, triggers, stored procedures, etc. In 8.0, you can alter the type directly in the table. In releases before 8.0, you have found the right workaround. -- Alvaro Herrera -- Valdivia, Chile Architect, www.EnterpriseDB.com "Crear es tan difĂcil como ser libre" (Elsa Triolet) ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings
Re: [GENERAL] change column data type from smallint to integer
Alvaro Herrera wrote: On Thu, Sep 08, 2005 at 04:22:07AM +0200, [EMAIL PROTECTED] wrote: Hi, we run 'out of space' in one of our columns which is smallint and we need to make it integer. I did some research and found out that the only way is to create a new column with integer data type, then SET new = old, then drop old and rename new like old [1]. Could somebody confirm if this is really the best way and if it is stable in respect to indexes, RI, triggers, stored procedures, etc. In 8.0, you can alter the type directly in the table. In releases before 8.0, you have found the right workaround. Thank you, Alvaro, for the confirmation! ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly