Re: add column specify position - Mailing list pgsql-general

From Johan Nel
Subject Re: add column specify position
Date
Msg-id hkb1pd$b5e$1@news.eternal-september.org
Whole thread Raw
In response to add column specify position  (Scott Frankel <frankel@circlesfx.com>)
List pgsql-general
Hi Scott
Scott Frankel wrote:
>
> Hi all,
>
> Is it possible to specify a position when adding a column to a table?
No not AFAIK.

> 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;

ALTER TABLE qwe RENAME COLUMN foo TO bar;

That does imply the COLUMN TYPE stays the same though...  The help file
does have examples in the ALTER TABLE section how to change the TYPE of a
column.

HTH,

Johan Nel
Pretoria, South Africa.

pgsql-general by date:

Previous
From: Scott Frankel
Date:
Subject: add column specify position
Next
From: dipti shah
Date:
Subject: Re: Questions on PostGreSQL Authentication mechanism...