Re: altering data type in a column

From: "Len Morgan" <len-morgan(at)crcom(dot)net>
To: "Madness" <devrim(at)oper(dot)metu(dot)edu(dot)tr>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: altering data type in a column
Date: 2001-05-28 15:12:09
Message-ID: 005601c0e788$9ebc8f60$0908a8c0@H233.bstx.cc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

The simple answer: No. What has been suggested here numerous times (check
the archives) is the following procedure:

pg_dump the table you want to change to a text file.
edit the dump file and change the CREATE TABLE section to have an int type
instead of char.
DROP the original table
read in ( \i ) the modified dump table.

You need to make sure that there are NO non-integers in the field you are
changing!

len morgan

-----Original Message-----
From: Madness <devrim(at)oper(dot)metu(dot)edu(dot)tr>
To: pgsql-general(at)postgresql(dot)org <pgsql-general(at)postgresql(dot)org>
Date: Monday, May 28, 2001 10:05 AM
Subject: [GENERAL] altering data type in a column

>Hi,
>
>I have a table in one of my databases which has a row of type char. I would
>like to convert it to int data type. Is there an easy way for doing it?
>
>With regards,
>Devrim GÜNDÜZ
>devrim(at)oper(dot)metu(dot)edu(dot)tr
>
>
>
>
>
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 6: Have you searched our list archives?
>
>http://www.postgresql.org/search.mpl
>

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2001-05-28 15:13:47 Re: problem with buffer in psql
Previous Message Tom Lane 2001-05-28 15:11:47 Re: set datestyle