add column specify position

From: Scott Frankel <frankel(at)circlesfx(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: add column specify position
Date: 2010-02-03 05:14:13
Message-ID: F3BAEFFA-B98B-4A9B-97FA-80B7D45CC689@circlesfx.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Hi all,

Is it possible to specify a position when adding a column to a table?

I want to swap one column for another without losing the column's
position. eg: given that 'foo' is the 5th column in an 8 column
table, I want to replace it with a 'bar' column at column 5.

ALTER TABLE qwe DROP COLUMN foo;
ALTER TABLE qwe ADD COLUMN bar;

I'm writing a sql script to migrate from one version of my schema to
another, dropping one column and adding another to a number of
tables. Unfortunately, the windowing toolkit I'm using relies on
integer values to determine column positions.

Any ideas come to mind?

Thanks in advance!
Scott

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Johan Nel 2010-02-03 05:32:06 Re: add column specify position
Previous Message Yan Cheng Cheok 2010-02-03 04:00:30 Need Advice In Improving Database Disc Usage