X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DE680D909E for ; Wed, 28 Sep 2005 16:37:02 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 85992-03 for ; Wed, 28 Sep 2005 19:36:57 +0000 (GMT) Received: from website.brandywine.com (mailcheck.brandywine.com [146.145.113.9]) by svr1.postgresql.org (Postfix) with ESMTP id 4C61BD6EAF for ; Wed, 28 Sep 2005 16:36:56 -0300 (ADT) X-eSCM-MailFrom: Received: from BAM_EXCHANGE (10.1.0.100) by website.brandywine.com (10.1.0.9); Wed, 28 September 2005 15:39:07 -0400 Received: from [10.1.0.60] (gen-wayne [10.1.0.60]) by bam_exchange.brandywine.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id R6ZYXWTW; Wed, 28 Sep 2005 15:36:44 -0400 Message-ID: <433AF11D.801@brandywine.com> Date: Wed, 28 Sep 2005 15:38:05 -0400 From: Daryl Richter Reply-To: daryl@brandywine.com Organization: Brandywine Asset Management User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 To: fmiddleton@verizon.net Cc: pgsql-sql@postgresql.org Subject: Re: changing a column's position in table, how do you do that References: <4339CD1B.10404@verizon.net> In-Reply-To: <4339CD1B.10404@verizon.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 required=5 tests=[none] X-Spam-Level: X-Archive-Number: 200509/284 X-Sequence-Number: 22831 Ferindo Middleton Jr wrote: > Is there a way to change the position attribute of a column in a table? > I have data that I need to import into various tables in my db on a > consistent basis... I usually us e the COPY ... FROM query but I can't > control the -order- of the fields my client dumps the data so I would > like to be able to change the position the columns in my table to be > able to better align the data to be imported with the format of my > table. I was thinking I could do something like "ALTER TABLE ALTER > COLUMN ... " or something like that to change the columns position in > the table but I can't figure out how. > > Ferindo > > ---------------------------(end of broadcast)--------------------------- > TIP 6: explain analyze is your friend Constantly changing the column order of a table doesn't make sense (and is a pain!). I would suggest setting up a temporary staging table with generic column names to take in the input data and then using SQL to move it into its permanent location. -- Daryl "We want great men who, when fortune frowns, will not be discouraged." -- Colonel Henry Knox, 1776