Re: Alter Column Position - Mailing list pgsql-novice

From Godshall Michael
Subject Re: Alter Column Position
Date
Msg-id A596FA3368757645AF862C701495CA0002A5E357@hor1mspmx01.gmachs.com
Whole thread Raw
In response to Alter Column Position  ("Derrick Betts" <Derrick@grifflink.com>)
List pgsql-novice

You can't change the position of a column in an existing table. 

You can do a Insert into (select new column order) into a revised_order_copy_of_table, drop original table, rename new table.

Maybe export the data into a text file and re-import file into new table etc.

-----Original Message-----
From: pgsql-novice-owner@postgresql.org
[mailto:pgsql-novice-owner@postgresql.org]On Behalf Of Derrick Betts
Sent: Tuesday, December 09, 2003 4:35 PM
To: pgsql-novice@postgresql.org
Subject: [NOVICE] Alter Column Position

I have a table with 10,000 rows.  We have an application that parses a *.csv
file and uploads the data to the database table.  The csv parser takes the
column numbers form the csv file and matches the column numbers to the field
positions in the DB table.

Now, I have to change the position of a column in the DB to match the csv
parser.  I have a column in position 28 that I need to move to position 7.

Anyone know how to do that?

Thanks,
Derrick

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

pgsql-novice by date:

Previous
From: "Derrick Betts"
Date:
Subject: Alter Column Position
Next
From: Bruce Momjian
Date:
Subject: Re: PostgreSQL Training