[Gllug] POSTGRES: Change type of column or delete

Christian Smith csmith at micromuse.com
Mon Oct 22 21:33:14 UTC 2001


On Mon, 22 Oct 2001, John Edwards wrote:

>
>Hi
>Anyone know to change the type of a column in postgres ? Or failing that
>even how to delete a column ?
>
>"ALTER TABLE" only seems to be able to add and rename them. I've tried
>the postgresql site and google, but can't find anything useful.

If you rename the column to <name>_old, then create a new <name> column,
you can achieve much the same effect. Just don't use the new <name>_old
column, and it'll probably be ignored, only taking space on existing rows.

You can then ignore the column, and recreate the table when convenient
from backups or using the method described by Vince.

IANADBA, however, so take time to check the docs.

Christian

-- 
    /"\
    \ /    ASCII RIBBON CAMPAIGN - AGAINST HTML MAIL
     X                           - AGAINST MS ATTACHMENTS
    / \



-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list