altering data type in a column

Started by Devrim GUNDUZalmost 25 years ago2 messagesgeneral
Jump to latest
#1Devrim GUNDUZ
devrim@oper.metu.edu.tr

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@oper.metu.edu.tr

#2Len Morgan
len-morgan@crcom.net
In reply to: Devrim GUNDUZ (#1)
Re: altering data type in a column

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@oper.metu.edu.tr>
To: pgsql-general@postgresql.org <pgsql-general@postgresql.org>
Date: Monday, May 28, 2001 10:05 AM
Subject: [GENERAL] altering data type in a column

Show quoted text

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@oper.metu.edu.tr

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://www.postgresql.org/search.mpl