Re: Alter Column Position

From: Godshall Michael <Michael_Godshall(at)gmachs(dot)com>
To: 'Derrick Betts' <Derrick(at)grifflink(dot)com>, pgsql-novice(at)postgresql(dot)org
Subject: Re: Alter Column Position
Date: 2003-12-09 22:52:16
Message-ID: A596FA3368757645AF862C701495CA0002A5E357@hor1mspmx01.gmachs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)postgresql(dot)org
[mailto:pgsql-novice-owner(at)postgresql(dot)org]On Behalf Of Derrick Betts
Sent: Tuesday, December 09, 2003 4:35 PM
To: pgsql-novice(at)postgresql(dot)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(at)postgresql(dot)org

Browse pgsql-novice by date

  From Date Subject
Next Message Bruce Momjian 2003-12-09 22:56:01 Re: PostgreSQL Training
Previous Message Derrick Betts 2003-12-09 22:34:36 Alter Column Position