From: | wsheldah(at)lexmark(dot)com |
---|---|
To: | "Yuri A(dot) Kabaenkov" <sec(at)artofit(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: changeing type of column |
Date: | 2002-04-02 19:56:44 |
Message-ID: | 200204021956.OAA18342@interlock2.lexmark.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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(dot)com(at)interlock(dot)lexmark(dot)com> on 04/02/2002
01:18:48 PM
Please respond to "Yuri A. Kabaenkov" <sec%artofit(dot)com(at)interlock(dot)lexmark(dot)com>
To: pgsql-general%postgresql(dot)org(at)interlock(dot)lexmark(dot)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(at)artofit(dot)com
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
From | Date | Subject | |
---|---|---|---|
Next Message | Stephan Szabo | 2002-04-02 20:32:45 | Re: retun cursor |
Previous Message | Jan Wieck | 2002-04-02 19:34:12 | Re: %ROWTYPE as PL/pgsql argument |