Use the pg_dump command to dump both the schema and data to an ascii file. Make
a backup of that file, then edit it and change the column definition to varchar
(any reason not to use text instead?).
Then you'll want to write a short script to put single quotes around every
integer value of that column; I would probably use perl, but there are lots of
ways to do this.
Then just run pg_restore and you should be set. Hope this helps,
Wes
"Yuri A. Kabaenkov" <sec%artofit.com@interlock.lexmark.com> on 04/02/2002
01:18:48 PM
Please respond to "Yuri A. Kabaenkov" <sec%artofit.com@interlock.lexmark.com>
To: pgsql-general%postgresql.org@interlock.lexmark.com
cc: (bcc: Wesley Sheldahl/Lex/Lexmark)
Subject: [GENERAL] changeing type of column
I've know that there is no function to change type of column in postgresql
table.
But i have a table with serial field (sequence) and many other field.
And i need to change one field from int4 to varchar.
What is the best way to do it ?
--
Best regards,
Yuri mailto:sec@artofit.com
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org