Received: from sss.sss.pgh.pa.us (sss.pgh.pa.us [209.114.166.2]) by hub.org (8.9.3/8.9.3) with ESMTP id KAA30454 for ; Sat, 18 Sep 1999 10:24:05 -0400 (EDT) (envelope-from tgl@sss.pgh.pa.us) Received: from sss.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.sss.pgh.pa.us (8.9.1/8.9.1) with ESMTP id KAA13300; Sat, 18 Sep 1999 10:23:32 -0400 (EDT) To: "Zot O'Connor" cc: postgres sql Subject: Re: [SQL] Converting an existing table? In-reply-to: Your message of Fri, 17 Sep 1999 14:04:07 -0700 <37E2ACC7.E2513AD9@zotconsulting.com> Date: Sat, 18 Sep 1999 10:23:32 -0400 Message-ID: <13298.937664612@sss.pgh.pa.us> From: Tom Lane "Zot O'Connor" writes: > I need to change the type on an existing table. From money to something > else. > What is the best way under postgres? Probably the best way at the moment is: 1. Create new table with the desired column declarations, using a different table name. 2. Use INSERT ... SELECT ... to copy the data from old table to new, with any transformations needed. 3. When you are happy with the contents of the new table, drop the old table and ALTER TABLE RENAME to rename the new table to the original table name. regards, tom lane