Обсуждение: altering data type in a column

Поиск
Список
Период
Сортировка

altering data type in a column

От
"Madness"
Дата:
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







Re: altering data type in a column

От
"Len Morgan"
Дата:
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


>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
>