Skip site navigation (1) Skip section navigation (2)

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$ (view raw, whole thread or download thread mbox)
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

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

>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
>---------------------------(end of broadcast)---------------------------
>TIP 6: Have you searched our list archives?

pgsql-general by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group