Re: changing a column's position in table, how do you do that - Mailing list pgsql-sql

From Chris Browne
Subject Re: changing a column's position in table, how do you do that
Date
Msg-id 60wtl1j2n6.fsf@dba2.int.libertyrms.com
Whole thread Raw
In response to changing a column's position in table, how do you do that  (Ferindo Middleton Jr <fmiddleton@verizon.net>)
List pgsql-sql
fmiddleton@verizon.net (Ferindo Middleton Jr) writes:
> 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.

If you're running PostgreSQL 7.4 or later, you can specify field names
in the COPY statement.  That strikes me as a better way to control
this.
-- 
select 'cbbrowne' || '@' || 'ntlug.org';
http://www3.sympatico.ca/cbbrowne/nonrdbms.html
Rules of the Evil Overlord #65.  "If I must have computer systems with
publically available  terminals, the maps  they display of  my complex
will have  a room clearly marked  as the Main Control  Room. That room
will be  the Execution Chamber. The  actual main control  room will be
marked as Sewage Overflow Containment." <http://www.eviloverlord.com/>


pgsql-sql by date:

Previous
From: "Stewart Ben (RBAU/EQS4) *"
Date:
Subject: Re: changing a column's position in table, how do you do that
Next
From: "Brandon Metcalf"
Date:
Subject: Re: add column if doesn't exist